<p>fixeria has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/20386">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">RSL/BSSAP: fix: properly convert between RSL Link ID and DLCI<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;">git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/86/20386/1</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 59032d6..c85eb86 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>@@ -540,6 +540,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 & 0x03)</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>@@ -552,8 +562,9 @@</span><br><span> </span><br><span>      bsc_scan_bts_msg(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 65fee04..cef8df7 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>@@ -1199,6 +1199,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 & 0x03)</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>@@ -1248,8 +1258,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: 1 </div>
<div style="display:none"> Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>