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/.

laforge gerrit-no-reply at lists.osmocom.org
Mon Jan 6 10:26:46 UTC 2020


laforge has submitted this change. ( 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, 27 insertions(+), 27 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  fixeria: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/encoding.cpp b/src/encoding.cpp
index d4a7ae0..8c3aaed 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 *mi, uint8_t mi_len)
 {
 	unsigned wp = 0;
 	int plen;
@@ -741,14 +741,9 @@
 	bitvec_write_field(dest, &wp,0x0,4);  // Page Mode
 	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, mi_len, 8);  // Mobile Identity length
+	bitvec_set_bytes(dest, mi, mi_len);        // Mobile Identity
+	wp += mi_len * 8;
 
 	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..31f74d1 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 *mi, uint8_t mi_len);
 
 	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 54927f5..33b2ded 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -175,25 +175,18 @@
 {
 	char imsi[16];
 	uint16_t pgroup;
-	uint8_t *ptmsi = (uint8_t *) TLVP_VAL(tp, BSSGP_IE_TMSI);
-	uint16_t ptmsi_len = TLVP_LEN(tp, BSSGP_IE_TMSI);
+	const uint8_t *mi;
+	uint8_t mi_len;
 	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_MISSING_MAND_IE, 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_INV_MAND_INF, NULL, msg);
@@ -204,7 +197,15 @@
 		return bssgp_tx_status(BSSGP_CAUSE_INV_MAND_INF, NULL, msg);
 	}
 
-	return gprs_rlcmac_paging_request(ptmsi, ptmsi_len, pgroup);
+	if (TLVP_PRESENT(tp, BSSGP_IE_TMSI)) {
+		mi_len = TLVP_LEN(tp, BSSGP_IE_TMSI);
+		mi = TLVP_VAL(tp, BSSGP_IE_TMSI);
+	} else { /* Use IMSI if TMSI not available: */
+		mi_len = TLVP_LEN(tp, BSSGP_IE_IMSI);
+		mi = TLVP_VAL(tp, BSSGP_IE_IMSI);
+	}
+
+	return gprs_rlcmac_paging_request(mi, mi_len, pgroup);
 }
 
 /* Receive a BSSGP PDU from a BSS on a PTP BVCI */
diff --git a/src/gprs_rlcmac.cpp b/src/gprs_rlcmac.cpp
index cbfc87f..c890021 100644
--- a/src/gprs_rlcmac.cpp
+++ b/src/gprs_rlcmac.cpp
@@ -19,6 +19,10 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+extern "C" {
+	#include <osmocom/gsm/gsm48.h>
+}
+
 #include <pcu_l1_if.h>
 #include <gprs_rlcmac.h>
 #include <bts.h>
@@ -28,13 +32,13 @@
 
 extern void *tall_pcu_ctx;
 
-int gprs_rlcmac_paging_request(uint8_t *ptmsi, uint16_t ptmsi_len,
-			       uint16_t pgroup)
+int gprs_rlcmac_paging_request(const uint8_t *mi, uint8_t mi_len, uint16_t pgroup)
 {
-	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_mi_name(mi, mi_len));
 	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, mi, mi_len);
 	pcu_l1if_tx_pch(paging_request, plen, pgroup);
 	bitvec_free(paging_request);
 
diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h
index 6f3418c..6d87107 100644
--- a/src/gprs_rlcmac.h
+++ b/src/gprs_rlcmac.h
@@ -93,7 +93,7 @@
 
 int gprs_rlcmac_tx_ul_ud(gprs_rlcmac_tbf *tbf);
 
-int gprs_rlcmac_paging_request(uint8_t *ptmsi, uint16_t ptmsi_len, uint16_t pgroup);
+int gprs_rlcmac_paging_request(const uint8_t *mi, uint8_t mi_len, uint16_t pgroup);
 
 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: 6
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200106/a14a6df9/attachment.htm>


More information about the gerrit-log mailing list