Change in osmo-pcu[master]: Allow Gb PAGING-PS without P-TMSI

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Tue Dec 10 19:15:20 UTC 2019


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/16536 )


Change subject: Allow Gb PAGING-PS without P-TMSI
......................................................................

Allow Gb PAGING-PS without P-TMSI

P-TMSI is optional IE, but IE is mandatory and hence always available.
Since the encoding is actually a Mobile Identity, the IMSI is used in
case P-TMSI is not available.

Change-Id: I4dbf8db04e81f98352a42ce34a5d91326be9bfd1
---
M src/encoding.cpp
M src/encoding.h
M src/gprs_bssgp_pcu.cpp
M src/gprs_rlcmac.cpp
M src/gprs_rlcmac.h
5 files changed, 32 insertions(+), 27 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/36/16536/1

diff --git a/src/encoding.cpp b/src/encoding.cpp
index d4a7ae0..69d2ace 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -729,7 +729,7 @@
 }
 
 /* Generate paging request. See 44.018, sections 10 and 9.1.22 */
-int Encoding::write_paging_request(bitvec * dest, uint8_t *ptmsi, uint16_t ptmsi_len)
+int Encoding::write_paging_request(bitvec * dest, const uint8_t *identity_lv)
 {
 	unsigned wp = 0;
 	int plen;
@@ -742,13 +742,9 @@
 	bitvec_write_field(dest, &wp,0x0,4);  // Channel Needed
 
 	// Mobile Identity
-	bitvec_write_field(dest, &wp,ptmsi_len+1,8);  // Mobile Identity length
-	bitvec_write_field(dest, &wp,0xf,4);          // unused
-	bitvec_write_field(dest, &wp,0x4,4);          // PTMSI type
-	for (int i = 0; i < ptmsi_len; i++)
-	{
-		bitvec_write_field(dest, &wp,ptmsi[i],8); // PTMSI
-	}
+	bitvec_write_field(dest, &wp, identity_lv[0], 8);  // Mobile Identity length
+	for (int i = 1; i < identity_lv[0]; i++)
+		bitvec_write_field(dest, &wp, identity_lv[i], 8); // IMSI/PTMSI
 
 	if ((wp % 8))
 		log_alert_exit("Length of PAG.REQ without rest octets is not "
diff --git a/src/encoding.h b/src/encoding.h
index 6dcced0..966b0c5 100644
--- a/src/encoding.h
+++ b/src/encoding.h
@@ -77,7 +77,7 @@
 			bitvec * dest, struct gprs_rlcmac_ul_tbf *tbf, bool is_final,
 			uint8_t rrbp);
 
-	static int write_paging_request(bitvec * dest, uint8_t *ptmsi, uint16_t ptmsi_len);
+	static int write_paging_request(bitvec * dest, const uint8_t *identity_lv);
 
 	static unsigned write_repeated_page_info(bitvec * dest, unsigned& wp, uint8_t len,
 			uint8_t *identity, uint8_t chan_needed);
diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index 8ce1342..67c8653 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -18,6 +18,8 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#include "inttypes.h"
+
 #include <gprs_rlcmac.h>
 #include <gprs_bssgp_pcu.h>
 #include <pcu_l1_if.h>
@@ -173,32 +175,40 @@
 
 static int gprs_bssgp_pcu_rx_paging_ps(struct msgb *msg, struct tlv_parsed *tp)
 {
+	uint8_t identity_lv[9];
 	char imsi[16];
-	uint8_t *ptmsi = (uint8_t *) TLVP_VAL(tp, BSSGP_IE_TMSI);
-	uint16_t ptmsi_len = TLVP_LEN(tp, BSSGP_IE_TMSI);
 	int rc;
 
-	LOGP(DBSSGP, LOGL_NOTICE, " P-TMSI = ");
-	for (int i = 0; i < ptmsi_len; i++)
-	{
-		LOGPC(DBSSGP, LOGL_NOTICE, "%02x", ptmsi[i]);
-	}
-	LOGPC(DBSSGP, LOGL_NOTICE, "\n");
-
 	if (!TLVP_PRESENT(tp, BSSGP_IE_IMSI)) {
 		LOGP(DBSSGP, LOGL_ERROR, "No IMSI\n");
-		return -EINVAL;
+		return bssgp_tx_status(BSSGP_CAUSE_COND_IE_ERR, NULL, msg);
 	}
 
 	/* gsm48_mi_to_string() returns number of bytes written, including '\0' */
 	rc = gsm48_mi_to_string(imsi, sizeof(imsi), TLVP_VAL(tp, BSSGP_IE_IMSI),
-						    TLVP_LEN(tp, BSSGP_IE_IMSI));
+				TLVP_LEN(tp, BSSGP_IE_IMSI));
 	if (rc != GSM23003_IMSI_MAX_DIGITS + 1) {
 		LOGP(DBSSGP, LOGL_NOTICE, "Failed to parse IMSI IE (rc=%d)\n", rc);
 		return bssgp_tx_status(BSSGP_CAUSE_COND_IE_ERR, NULL, msg);
 	}
 
-	return gprs_rlcmac_paging_request(ptmsi, ptmsi_len, imsi);
+	if (TLVP_PRESENT(tp, BSSGP_IE_TMSI)) {
+		identity_lv[0] = TLVP_LEN(tp, BSSGP_IE_TMSI);
+		if (identity_lv[0] >= sizeof(identity_lv)) {
+			LOGP(DBSSGP, LOGL_NOTICE, "TMSI IE too big (%" PRIu8 ")\n", identity_lv[0]);
+			return bssgp_tx_status(BSSGP_CAUSE_COND_IE_ERR, NULL, msg);
+		}
+		memcpy(&identity_lv[1], TLVP_VAL(tp, BSSGP_IE_TMSI), identity_lv[0]);
+	} else { /* Use IMSI if TMSI not available: */
+		identity_lv[0] = TLVP_LEN(tp, BSSGP_IE_IMSI);
+		if (identity_lv[0] >= sizeof(identity_lv)) {
+			LOGP(DBSSGP, LOGL_NOTICE, "IMSI IE too big (%" PRIu8 ")\n", identity_lv[0]);
+			return bssgp_tx_status(BSSGP_CAUSE_COND_IE_ERR, NULL, msg);
+		}
+		memcpy(&identity_lv[1], TLVP_VAL(tp, BSSGP_IE_IMSI), identity_lv[0]);
+	}
+
+	return gprs_rlcmac_paging_request(identity_lv, imsi);
 }
 
 /* Receive a BSSGP PDU from a BSS on a PTP BVCI */
diff --git a/src/gprs_rlcmac.cpp b/src/gprs_rlcmac.cpp
index e381b11..96de51d 100644
--- a/src/gprs_rlcmac.cpp
+++ b/src/gprs_rlcmac.cpp
@@ -28,13 +28,13 @@
 
 extern void *tall_pcu_ctx;
 
-int gprs_rlcmac_paging_request(uint8_t *ptmsi, uint16_t ptmsi_len,
-	const char *imsi)
+int gprs_rlcmac_paging_request(const uint8_t *identity_lv, const char *imsi)
 {
-	LOGP(DRLCMAC, LOGL_NOTICE, "TX: [PCU -> BTS] Paging Request (CCCH)\n");
+	LOGP(DRLCMAC, LOGL_NOTICE, "TX: [PCU -> BTS] Paging Request (CCCH) MI=%s\n",
+	     osmo_hexdump(identity_lv + 1, identity_lv[0]));
 	bitvec *paging_request = bitvec_alloc(22, tall_pcu_ctx);
 	bitvec_unhex(paging_request, DUMMY_VEC);
-	int plen = Encoding::write_paging_request(paging_request, ptmsi, ptmsi_len);
+	int plen = Encoding::write_paging_request(paging_request, identity_lv);
 	pcu_l1if_tx_pch(paging_request, plen, (char *)imsi);
 	bitvec_free(paging_request);
 
diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h
index 5361a1c..b504ad9 100644
--- a/src/gprs_rlcmac.h
+++ b/src/gprs_rlcmac.h
@@ -92,8 +92,7 @@
 
 int gprs_rlcmac_tx_ul_ud(gprs_rlcmac_tbf *tbf);
 
-int gprs_rlcmac_paging_request(uint8_t *ptmsi, uint16_t ptmsi_len,
-	const char *imsi);
+int gprs_rlcmac_paging_request(const uint8_t *identity_lv, const char *imsi);
 
 struct msgb *gprs_rlcmac_app_info_msg(const struct gsm_pcu_if_app_info_req *req);
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/16536
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I4dbf8db04e81f98352a42ce34a5d91326be9bfd1
Gerrit-Change-Number: 16536
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191210/28208eed/attachment.htm>


More information about the gerrit-log mailing list