<p>laforge <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/20386">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">RSL/BSSAP: fix: properly convert between RSL Link ID and DLCI<br><br>Data Link Connection Identifier (DLCI) is defined in 3GPP TS 48.006,<br>section 9.3.2, and coded as follows:<br><br>  .... .SSS - SAPI value used on the radio link;<br>  CC.. .... - control channel identification:<br>    00.. .... - indicates that the control channel is not further specified,<br>    10.. .... - represents the FACCH or the SDCCH,<br>    11.. .... - represents the SACCH,<br>    other values are reserved.<br><br>RSL Link Identifier is defined in 3GPP TS 3GPP TS 48.058,<br>section 9.3.2, and coded as follows:<br><br>  .... .SSS - SAPI value used on the radio link;<br>  ...P P... - priority for SAPI0 messages;<br>  CC.. .... - control channel identification:<br>    00.. .... - main signalling channel (FACCH or SDCCH),<br>    01.. .... - SACCH,<br>    other values are reserved.<br><br>As can be seen, CC bits in both DLCI and RSL Link Identifier<br>are coded differently.  Therefore, we cannot just assign<br>one identifier to another, we need to do conversion.<br><br>I noticed that osmo-bsc indicates DLCI '01000011'B for SMS<br>messages sent over SACCH/F (SAPI3), and this is wrong because<br>'01'B is reserved.  Let's fix this.<br><br>P.S. Interesting coincidence: section 9.3.2 in both documents.<br><br>Change-Id: If4d479a54cad467f53b49065c1c435a4471ac7d2<br>Related: Ica69ae95b47a67ba99ba9cc36629b6bd210d11e4<br>Related: OS#3716<br>---<br>M src/osmo-bsc/gsm_08_08.c<br>M src/osmo-bsc/osmo_bsc_bssap.c<br>2 files changed, 27 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/osmo-bsc/gsm_08_08.c b/src/osmo-bsc/gsm_08_08.c</span><br><span>index a4b53f0..f3214c7 100644</span><br><span>--- a/src/osmo-bsc/gsm_08_08.c</span><br><span>+++ b/src/osmo-bsc/gsm_08_08.c</span><br><span>@@ -537,6 +537,16 @@</span><br><span>         return rc;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/* Data Link Connection Identifier (DLCI) is defined in 3GPP TS 48.006, section 9.3.2.</span><br><span style="color: hsl(120, 100%, 40%);">+ * .... .SSS - SAPI value used on the radio link;</span><br><span style="color: hsl(120, 100%, 40%);">+ * CC.. .... - control channel identification:</span><br><span style="color: hsl(120, 100%, 40%);">+ *   00.. .... - indicates that the control channel is not further specified,</span><br><span style="color: hsl(120, 100%, 40%);">+ *   10.. .... - represents the FACCH or the SDCCH,</span><br><span style="color: hsl(120, 100%, 40%);">+ *   11.. .... - represents the SACCH,</span><br><span style="color: hsl(120, 100%, 40%);">+ *   other values are reserved. */</span><br><span style="color: hsl(120, 100%, 40%);">+#define RSL_LINK_ID2DLCI(link_id) \</span><br><span style="color: hsl(120, 100%, 40%);">+   (link_id & 0x40 ? 0xc0 : 0x80) | (link_id & 0x07)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /*! MS->BSC/MSC: Um L3 message. */</span><br><span> void bsc_dtap(struct gsm_subscriber_connection *conn, uint8_t link_id, struct msgb *msg)</span><br><span> {</span><br><span>@@ -549,8 +559,9 @@</span><br><span> </span><br><span>      parse_powercap(conn, msg);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-  /* Store link_id in msg->cb */</span><br><span style="color: hsl(0, 100%, 40%);">-       OBSC_LINKID_CB(msg) = link_id;</span><br><span style="color: hsl(120, 100%, 40%);">+        /* convert RSL link ID to DLCI, store in msg->cb */</span><br><span style="color: hsl(120, 100%, 40%);">+        OBSC_LINKID_CB(msg) = RSL_LINK_ID2DLCI(link_id);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>   osmo_fsm_inst_dispatch(conn->fi, GSCON_EV_MO_DTAP, msg);</span><br><span> done:</span><br><span>         log_set_context(LOG_CTX_BSC_SUBSCR, NULL);</span><br><span>diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c</span><br><span>index 124f613..10f0edd 100644</span><br><span>--- a/src/osmo-bsc/osmo_bsc_bssap.c</span><br><span>+++ b/src/osmo-bsc/osmo_bsc_bssap.c</span><br><span>@@ -1186,6 +1186,16 @@</span><br><span>         return ret;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/* RSL Link Identifier is defined in 3GPP TS 3GPP TS 48.058, section 9.3.2.</span><br><span style="color: hsl(120, 100%, 40%);">+ * .... .SSS - SAPI value used on the radio link;</span><br><span style="color: hsl(120, 100%, 40%);">+ * ...P P... - priority for SAPI0 messages;</span><br><span style="color: hsl(120, 100%, 40%);">+ * CC.. .... - control channel identification:</span><br><span style="color: hsl(120, 100%, 40%);">+ *   00.. .... - main signalling channel (FACCH or SDCCH),</span><br><span style="color: hsl(120, 100%, 40%);">+ *   01.. .... - SACCH,</span><br><span style="color: hsl(120, 100%, 40%);">+ *   other values are reserved. */</span><br><span style="color: hsl(120, 100%, 40%);">+#define DLCI2RSL_LINK_ID(dlci) \</span><br><span style="color: hsl(120, 100%, 40%);">+  ((dlci & 0xc0) == 0xc0 ? 0x40 : 0x00) | (dlci & 0x07)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static int dtap_rcvmsg(struct gsm_subscriber_connection *conn,</span><br><span>                   struct msgb *msg, unsigned int length)</span><br><span> {</span><br><span>@@ -1235,8 +1245,10 @@</span><br><span> </span><br><span>      /* pass it to the filter for extra actions */</span><br><span>        bsc_scan_msc_msg(conn, gsm48);</span><br><span style="color: hsl(0, 100%, 40%);">-  /* Store link_id in msgb->cb */</span><br><span style="color: hsl(0, 100%, 40%);">-      OBSC_LINKID_CB(gsm48) = header->link_id;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* convert DLCI to RSL link ID, store in msg->cb */</span><br><span style="color: hsl(120, 100%, 40%);">+        OBSC_LINKID_CB(gsm48) = DLCI2RSL_LINK_ID(header->link_id);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>      dtap_rc = osmo_fsm_inst_dispatch(conn->fi, GSCON_EV_MT_DTAP, gsm48);</span><br><span>      return dtap_rc;</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bsc/+/20386">change 20386</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-bsc/+/20386"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bsc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: If4d479a54cad467f53b49065c1c435a4471ac7d2 </div>
<div style="display:none"> Gerrit-Change-Number: 20386 </div>
<div style="display:none"> Gerrit-PatchSet: 4 </div>
<div style="display:none"> Gerrit-Owner: Vadim Yanitskiy <vyanitskiy@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: Vadim Yanitskiy <vyanitskiy@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>