<p>pespin has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-pcu/+/16536">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Allow Gb PAGING-PS without P-TMSI<br><br>P-TMSI is optional IE, but IE is mandatory and hence always available.<br>Since the encoding is actually a Mobile Identity, the IMSI is used in<br>case P-TMSI is not available.<br><br>Change-Id: I4dbf8db04e81f98352a42ce34a5d91326be9bfd1<br>---<br>M src/encoding.cpp<br>M src/encoding.h<br>M src/gprs_bssgp_pcu.cpp<br>M src/gprs_rlcmac.cpp<br>M src/gprs_rlcmac.h<br>5 files changed, 32 insertions(+), 27 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/36/16536/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/encoding.cpp b/src/encoding.cpp</span><br><span>index d4a7ae0..69d2ace 100644</span><br><span>--- a/src/encoding.cpp</span><br><span>+++ b/src/encoding.cpp</span><br><span>@@ -729,7 +729,7 @@</span><br><span> }</span><br><span> </span><br><span> /* Generate paging request. See 44.018, sections 10 and 9.1.22 */</span><br><span style="color: hsl(0, 100%, 40%);">-int Encoding::write_paging_request(bitvec * dest, uint8_t *ptmsi, uint16_t ptmsi_len)</span><br><span style="color: hsl(120, 100%, 40%);">+int Encoding::write_paging_request(bitvec * dest, const uint8_t *identity_lv)</span><br><span> {</span><br><span>   unsigned wp = 0;</span><br><span>     int plen;</span><br><span>@@ -742,13 +742,9 @@</span><br><span>     bitvec_write_field(dest, &wp,0x0,4);  // Channel Needed</span><br><span> </span><br><span>      // Mobile Identity</span><br><span style="color: hsl(0, 100%, 40%);">-      bitvec_write_field(dest, &wp,ptmsi_len+1,8);  // Mobile Identity length</span><br><span style="color: hsl(0, 100%, 40%);">-     bitvec_write_field(dest, &wp,0xf,4);          // unused</span><br><span style="color: hsl(0, 100%, 40%);">-     bitvec_write_field(dest, &wp,0x4,4);          // PTMSI type</span><br><span style="color: hsl(0, 100%, 40%);">- for (int i = 0; i < ptmsi_len; i++)</span><br><span style="color: hsl(0, 100%, 40%);">-  {</span><br><span style="color: hsl(0, 100%, 40%);">-               bitvec_write_field(dest, &wp,ptmsi[i],8); // PTMSI</span><br><span style="color: hsl(0, 100%, 40%);">-  }</span><br><span style="color: hsl(120, 100%, 40%);">+     bitvec_write_field(dest, &wp, identity_lv[0], 8);  // Mobile Identity length</span><br><span style="color: hsl(120, 100%, 40%);">+      for (int i = 1; i < identity_lv[0]; i++)</span><br><span style="color: hsl(120, 100%, 40%);">+           bitvec_write_field(dest, &wp, identity_lv[i], 8); // IMSI/PTMSI</span><br><span> </span><br><span>      if ((wp % 8))</span><br><span>                log_alert_exit("Length of PAG.REQ without rest octets is not "</span><br><span>diff --git a/src/encoding.h b/src/encoding.h</span><br><span>index 6dcced0..966b0c5 100644</span><br><span>--- a/src/encoding.h</span><br><span>+++ b/src/encoding.h</span><br><span>@@ -77,7 +77,7 @@</span><br><span>                    bitvec * dest, struct gprs_rlcmac_ul_tbf *tbf, bool is_final,</span><br><span>                        uint8_t rrbp);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-      static int write_paging_request(bitvec * dest, uint8_t *ptmsi, uint16_t ptmsi_len);</span><br><span style="color: hsl(120, 100%, 40%);">+   static int write_paging_request(bitvec * dest, const uint8_t *identity_lv);</span><br><span> </span><br><span>      static unsigned write_repeated_page_info(bitvec * dest, unsigned& wp, uint8_t len,</span><br><span>                       uint8_t *identity, uint8_t chan_needed);</span><br><span>diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp</span><br><span>index 8ce1342..67c8653 100644</span><br><span>--- a/src/gprs_bssgp_pcu.cpp</span><br><span>+++ b/src/gprs_bssgp_pcu.cpp</span><br><span>@@ -18,6 +18,8 @@</span><br><span>  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.</span><br><span>  */</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#include "inttypes.h"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> #include <gprs_rlcmac.h></span><br><span> #include <gprs_bssgp_pcu.h></span><br><span> #include <pcu_l1_if.h></span><br><span>@@ -173,32 +175,40 @@</span><br><span> </span><br><span> static int gprs_bssgp_pcu_rx_paging_ps(struct msgb *msg, struct tlv_parsed *tp)</span><br><span> {</span><br><span style="color: hsl(120, 100%, 40%);">+  uint8_t identity_lv[9];</span><br><span>      char imsi[16];</span><br><span style="color: hsl(0, 100%, 40%);">-  uint8_t *ptmsi = (uint8_t *) TLVP_VAL(tp, BSSGP_IE_TMSI);</span><br><span style="color: hsl(0, 100%, 40%);">-       uint16_t ptmsi_len = TLVP_LEN(tp, BSSGP_IE_TMSI);</span><br><span>    int rc;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-     LOGP(DBSSGP, LOGL_NOTICE, " P-TMSI = ");</span><br><span style="color: hsl(0, 100%, 40%);">-      for (int i = 0; i < ptmsi_len; i++)</span><br><span style="color: hsl(0, 100%, 40%);">-  {</span><br><span style="color: hsl(0, 100%, 40%);">-               LOGPC(DBSSGP, LOGL_NOTICE, "%02x", ptmsi[i]);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-       LOGPC(DBSSGP, LOGL_NOTICE, "\n");</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>  if (!TLVP_PRESENT(tp, BSSGP_IE_IMSI)) {</span><br><span>              LOGP(DBSSGP, LOGL_ERROR, "No IMSI\n");</span><br><span style="color: hsl(0, 100%, 40%);">-                return -EINVAL;</span><br><span style="color: hsl(120, 100%, 40%);">+               return bssgp_tx_status(BSSGP_CAUSE_COND_IE_ERR, NULL, msg);</span><br><span>  }</span><br><span> </span><br><span>        /* gsm48_mi_to_string() returns number of bytes written, including '\0' */</span><br><span>   rc = gsm48_mi_to_string(imsi, sizeof(imsi), TLVP_VAL(tp, BSSGP_IE_IMSI),</span><br><span style="color: hsl(0, 100%, 40%);">-                                                    TLVP_LEN(tp, BSSGP_IE_IMSI));</span><br><span style="color: hsl(120, 100%, 40%);">+                             TLVP_LEN(tp, BSSGP_IE_IMSI));</span><br><span>        if (rc != GSM23003_IMSI_MAX_DIGITS + 1) {</span><br><span>            LOGP(DBSSGP, LOGL_NOTICE, "Failed to parse IMSI IE (rc=%d)\n", rc);</span><br><span>                return bssgp_tx_status(BSSGP_CAUSE_COND_IE_ERR, NULL, msg);</span><br><span>  }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   return gprs_rlcmac_paging_request(ptmsi, ptmsi_len, imsi);</span><br><span style="color: hsl(120, 100%, 40%);">+    if (TLVP_PRESENT(tp, BSSGP_IE_TMSI)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                identity_lv[0] = TLVP_LEN(tp, BSSGP_IE_TMSI);</span><br><span style="color: hsl(120, 100%, 40%);">+         if (identity_lv[0] >= sizeof(identity_lv)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                       LOGP(DBSSGP, LOGL_NOTICE, "TMSI IE too big (%" PRIu8 ")\n", identity_lv[0]);</span><br><span style="color: hsl(120, 100%, 40%);">+                      return bssgp_tx_status(BSSGP_CAUSE_COND_IE_ERR, NULL, msg);</span><br><span style="color: hsl(120, 100%, 40%);">+           }</span><br><span style="color: hsl(120, 100%, 40%);">+             memcpy(&identity_lv[1], TLVP_VAL(tp, BSSGP_IE_TMSI), identity_lv[0]);</span><br><span style="color: hsl(120, 100%, 40%);">+     } else { /* Use IMSI if TMSI not available: */</span><br><span style="color: hsl(120, 100%, 40%);">+                identity_lv[0] = TLVP_LEN(tp, BSSGP_IE_IMSI);</span><br><span style="color: hsl(120, 100%, 40%);">+         if (identity_lv[0] >= sizeof(identity_lv)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                       LOGP(DBSSGP, LOGL_NOTICE, "IMSI IE too big (%" PRIu8 ")\n", identity_lv[0]);</span><br><span style="color: hsl(120, 100%, 40%);">+                      return bssgp_tx_status(BSSGP_CAUSE_COND_IE_ERR, NULL, msg);</span><br><span style="color: hsl(120, 100%, 40%);">+           }</span><br><span style="color: hsl(120, 100%, 40%);">+             memcpy(&identity_lv[1], TLVP_VAL(tp, BSSGP_IE_IMSI), identity_lv[0]);</span><br><span style="color: hsl(120, 100%, 40%);">+     }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   return gprs_rlcmac_paging_request(identity_lv, imsi);</span><br><span> }</span><br><span> </span><br><span> /* Receive a BSSGP PDU from a BSS on a PTP BVCI */</span><br><span>diff --git a/src/gprs_rlcmac.cpp b/src/gprs_rlcmac.cpp</span><br><span>index e381b11..96de51d 100644</span><br><span>--- a/src/gprs_rlcmac.cpp</span><br><span>+++ b/src/gprs_rlcmac.cpp</span><br><span>@@ -28,13 +28,13 @@</span><br><span> </span><br><span> extern void *tall_pcu_ctx;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-int gprs_rlcmac_paging_request(uint8_t *ptmsi, uint16_t ptmsi_len,</span><br><span style="color: hsl(0, 100%, 40%);">-     const char *imsi)</span><br><span style="color: hsl(120, 100%, 40%);">+int gprs_rlcmac_paging_request(const uint8_t *identity_lv, const char *imsi)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">-    LOGP(DRLCMAC, LOGL_NOTICE, "TX: [PCU -> BTS] Paging Request (CCCH)\n");</span><br><span style="color: hsl(120, 100%, 40%);">+  LOGP(DRLCMAC, LOGL_NOTICE, "TX: [PCU -> BTS] Paging Request (CCCH) MI=%s\n",</span><br><span style="color: hsl(120, 100%, 40%);">+          osmo_hexdump(identity_lv + 1, identity_lv[0]));</span><br><span>         bitvec *paging_request = bitvec_alloc(22, tall_pcu_ctx);</span><br><span>     bitvec_unhex(paging_request, DUMMY_VEC);</span><br><span style="color: hsl(0, 100%, 40%);">-        int plen = Encoding::write_paging_request(paging_request, ptmsi, ptmsi_len);</span><br><span style="color: hsl(120, 100%, 40%);">+  int plen = Encoding::write_paging_request(paging_request, identity_lv);</span><br><span>      pcu_l1if_tx_pch(paging_request, plen, (char *)imsi);</span><br><span>         bitvec_free(paging_request);</span><br><span> </span><br><span>diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h</span><br><span>index 5361a1c..b504ad9 100644</span><br><span>--- a/src/gprs_rlcmac.h</span><br><span>+++ b/src/gprs_rlcmac.h</span><br><span>@@ -92,8 +92,7 @@</span><br><span> </span><br><span> int gprs_rlcmac_tx_ul_ud(gprs_rlcmac_tbf *tbf);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-int gprs_rlcmac_paging_request(uint8_t *ptmsi, uint16_t ptmsi_len,</span><br><span style="color: hsl(0, 100%, 40%);">-      const char *imsi);</span><br><span style="color: hsl(120, 100%, 40%);">+int gprs_rlcmac_paging_request(const uint8_t *identity_lv, const char *imsi);</span><br><span> </span><br><span> struct msgb *gprs_rlcmac_app_info_msg(const struct gsm_pcu_if_app_info_req *req);</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-pcu/+/16536">change 16536</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-pcu/+/16536"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-pcu </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I4dbf8db04e81f98352a42ce34a5d91326be9bfd1 </div>
<div style="display:none"> Gerrit-Change-Number: 16536 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>