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.orglaforge has submitted this change. ( 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 do some bit shifting.
Change-Id: I0e91d825bb2e1897647dd5403c311d833a89ff2e
---
M src/common/l1sap.c
1 file changed, 12 insertions(+), 2 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 673430d..99aa11b 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,17 @@
}
}
- *data = (uint8_t *)&l1sap->u.rach_ind.ra;
- *len = (l1sap->u.rach_ind.is_11bit) ? 2 : 1;
+ if (l1sap->u.rach_ind.is_11bit) {
+ /* Pack as described in 3GPP TS 44.004, figure 7.4a.b */
+ ra_buf[0] = (uint8_t) (l1sap->u.rach_ind.ra >> 3);
+ ra_buf[1] = (uint8_t) (l1sap->u.rach_ind.ra & 0x07);
+ *len = sizeof(ra_buf);
+ *data = ra_buf;
+ } else {
+ ra_buf[0] = (uint8_t) (l1sap->u.rach_ind.ra & 0xff);
+ *len = sizeof(ra_buf[0]);
+ *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: 2
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200401/3c3da2bf/attachment.htm>