Change in osmo-bts[master]: l1sap: fix gsmtap_ph_rach(): properly pack 8-bit and 11-bit RA

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

fixeria gerrit-no-reply at lists.osmocom.org
Sun Mar 29 11:55:46 UTC 2020


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/17653 )


Change subject: l1sap: fix gsmtap_ph_rach(): properly pack 8-bit and 11-bit RA
......................................................................

l1sap: fix gsmtap_ph_rach(): properly pack 8-bit and 11-bit RA

According to 3GPP TS 44.004, section 7.4a, two alternative RACH
block formats are specified: 8 bit (1 octet) and 11 bit. The
bit order is little-endian (right to left).

In L1SAP PH-RACH.ind structure (see ph_rach_ind_param) we use
a field of type uint16_t to store RA values regardles of the
block format. Thus when packing it to bytes, we cannot just
cast uint16_t* to uint8_t*, we need to use osmo_store16le().

Change-Id: I0e91d825bb2e1897647dd5403c311d833a89ff2e
---
M src/common/l1sap.c
1 file changed, 4 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/53/17653/1

diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 673430d..059fd80 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -434,6 +434,7 @@
 	uint8_t *tn, uint8_t *ss, uint32_t *fn, uint8_t **data, unsigned int *len)
 {
 	uint8_t chan_nr = l1sap->u.rach_ind.chan_nr;
+	static uint8_t ra_buf[2];
 
 	*chan_type = GSMTAP_CHANNEL_RACH;
 	*fn = l1sap->u.rach_ind.fn;
@@ -454,8 +455,9 @@
 		}
 	}
 
-	*data = (uint8_t *)&l1sap->u.rach_ind.ra;
-	*len = (l1sap->u.rach_ind.is_11bit) ? 2 : 1;
+	*len = (l1sap->u.rach_ind.is_11bit) ? sizeof(uint16_t) : sizeof(uint8_t);
+	osmo_store16le(l1sap->u.rach_ind.ra, ra_buf);
+	*data = ra_buf;
 
 	return 0;
 }

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I0e91d825bb2e1897647dd5403c311d833a89ff2e
Gerrit-Change-Number: 17653
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200329/1aa5172f/attachment.htm>


More information about the gerrit-log mailing list