Change in ...osmo-pcu[master]: pcu_l1_if.cpp: Imm Assign PCH: clarify size of different items

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 Oct 7 19:57:47 UTC 2019


laforge has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-pcu/+/15683 )

Change subject: pcu_l1_if.cpp: Imm Assign PCH: clarify size of different items
......................................................................

pcu_l1_if.cpp: Imm Assign PCH: clarify size of different items

Change-Id: I32876858e3e93951e965b0fc7875c95c1f36f3ac
---
M src/pcu_l1_if.cpp
1 file changed, 12 insertions(+), 8 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index b0dfcc5..4ed512a 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -220,27 +220,31 @@
 	pcu_tx_data_req(0, 0, PCU_IF_SAPI_AGCH, 0, 0, 0, data, 23);
 }
 
+#define PAGING_GROUP_LEN 3
 void pcu_l1if_tx_pch(bitvec * block, int plen, const char *imsi)
 {
 	struct gprs_rlcmac_bts *bts = bts_main_data();
-	uint8_t data[3+23]; /* paging group, prefix PLEN */
+	uint8_t data[PAGING_GROUP_LEN + GSM_MACBLOCK_LEN];
 
-	/* paging group */
-	if (!imsi || strlen(imsi) < 3)
+	/* prepend paging group */
+	if (!imsi || strlen(imsi) < PAGING_GROUP_LEN)
 		return;
-	imsi += strlen(imsi) - 3;
+	imsi += strlen(imsi) - PAGING_GROUP_LEN;
 	data[0] = imsi[0];
 	data[1] = imsi[1];
 	data[2] = imsi[2];
 
-	OSMO_ASSERT(block->data_len <= sizeof(data) - (3+1));
-	bitvec_pack(block, data + 3+1);
+	/* block provided by upper layer comes without first byte (plen),
+	 * prepend it manually:
+	 */
+	OSMO_ASSERT(sizeof(data) >= PAGING_GROUP_LEN + 1 + block->data_len);
 	data[3] = (plen << 2) | 0x01;
+	bitvec_pack(block, data + PAGING_GROUP_LEN + 1);
 
 	if (bts->gsmtap_categ_mask & (1 << PCU_GSMTAP_C_DL_PCH))
-		gsmtap_send(bts->gsmtap, 0, 0, GSMTAP_CHANNEL_PCH, 0, 0, 0, 0, data + 3, 23);
+		gsmtap_send(bts->gsmtap, 0, 0, GSMTAP_CHANNEL_PCH, 0, 0, 0, 0, data + 3, GSM_MACBLOCK_LEN);
 
-	pcu_tx_data_req(0, 0, PCU_IF_SAPI_PCH, 0, 0, 0, data, 23+3);
+	pcu_tx_data_req(0, 0, PCU_IF_SAPI_PCH, 0, 0, 0, data, PAGING_GROUP_LEN + GSM_MACBLOCK_LEN);
 }
 
 extern "C" void pcu_rx_block_time(uint16_t arfcn, uint32_t fn, uint8_t ts_no)

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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I32876858e3e93951e965b0fc7875c95c1f36f3ac
Gerrit-Change-Number: 15683
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-CC: fixeria <axilirator at gmail.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191007/9b52377c/attachment.htm>


More information about the gerrit-log mailing list