<p>fixeria has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bts/+/17653">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">l1sap: fix gsmtap_ph_rach(): properly pack 8-bit and 11-bit RA<br><br>According to 3GPP TS 44.004, section 7.4a, two alternative RACH<br>block formats are specified: 8 bit (1 octet) and 11 bit. The<br>bit order is little-endian (right to left).<br><br>In L1SAP PH-RACH.ind structure (see ph_rach_ind_param) we use<br>a field of type uint16_t to store RA values regardles of the<br>block format. Thus when packing it to bytes, we cannot just<br>cast uint16_t* to uint8_t*, we need to use osmo_store16le().<br><br>Change-Id: I0e91d825bb2e1897647dd5403c311d833a89ff2e<br>---<br>M src/common/l1sap.c<br>1 file changed, 4 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/53/17653/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/common/l1sap.c b/src/common/l1sap.c</span><br><span>index 673430d..059fd80 100644</span><br><span>--- a/src/common/l1sap.c</span><br><span>+++ b/src/common/l1sap.c</span><br><span>@@ -434,6 +434,7 @@</span><br><span>     uint8_t *tn, uint8_t *ss, uint32_t *fn, uint8_t **data, unsigned int *len)</span><br><span> {</span><br><span>      uint8_t chan_nr = l1sap->u.rach_ind.chan_nr;</span><br><span style="color: hsl(120, 100%, 40%);">+       static uint8_t ra_buf[2];</span><br><span> </span><br><span>        *chan_type = GSMTAP_CHANNEL_RACH;</span><br><span>    *fn = l1sap->u.rach_ind.fn;</span><br><span>@@ -454,8 +455,9 @@</span><br><span>                 }</span><br><span>    }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   *data = (uint8_t *)&l1sap->u.rach_ind.ra;</span><br><span style="color: hsl(0, 100%, 40%);">-        *len = (l1sap->u.rach_ind.is_11bit) ? 2 : 1;</span><br><span style="color: hsl(120, 100%, 40%);">+       *len = (l1sap->u.rach_ind.is_11bit) ? sizeof(uint16_t) : sizeof(uint8_t);</span><br><span style="color: hsl(120, 100%, 40%);">+  osmo_store16le(l1sap->u.rach_ind.ra, ra_buf);</span><br><span style="color: hsl(120, 100%, 40%);">+      *data = ra_buf;</span><br><span> </span><br><span>  return 0;</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bts/+/17653">change 17653</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-bts/+/17653"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bts </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I0e91d825bb2e1897647dd5403c311d833a89ff2e </div>
<div style="display:none"> Gerrit-Change-Number: 17653 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: fixeria <axilirator@gmail.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>