aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-10-01 21:10:51 +0700
committerlaforge <laforge@osmocom.org>2020-10-08 07:15:01 +0000
commita88fa1f12f81a05558c67802a328114adee69d45 (patch)
tree1555942f01968d9d0e3ec28daeab79b25e9d1062 /src/osmo-bsc
parent1ae1826245f7b2148a086e39f9feb8af9679426d (diff)
RSL/BSSAP: fix: properly convert between RSL Link ID and DLCI
Data Link Connection Identifier (DLCI) is defined in 3GPP TS 48.006, section 9.3.2, and coded as follows: .... .SSS - SAPI value used on the radio link; CC.. .... - control channel identification: 00.. .... - indicates that the control channel is not further specified, 10.. .... - represents the FACCH or the SDCCH, 11.. .... - represents the SACCH, other values are reserved. RSL Link Identifier is defined in 3GPP TS 3GPP TS 48.058, section 9.3.2, and coded as follows: .... .SSS - SAPI value used on the radio link; ...P P... - priority for SAPI0 messages; CC.. .... - control channel identification: 00.. .... - main signalling channel (FACCH or SDCCH), 01.. .... - SACCH, other values are reserved. As can be seen, CC bits in both DLCI and RSL Link Identifier are coded differently. Therefore, we cannot just assign one identifier to another, we need to do conversion. I noticed that osmo-bsc indicates DLCI '01000011'B for SMS messages sent over SACCH/F (SAPI3), and this is wrong because '01'B is reserved. Let's fix this. P.S. Interesting coincidence: section 9.3.2 in both documents. Change-Id: If4d479a54cad467f53b49065c1c435a4471ac7d2 Related: Ica69ae95b47a67ba99ba9cc36629b6bd210d11e4 Related: OS#3716
Diffstat (limited to 'src/osmo-bsc')
-rw-r--r--src/osmo-bsc/gsm_08_08.c15
-rw-r--r--src/osmo-bsc/osmo_bsc_bssap.c16
2 files changed, 27 insertions, 4 deletions
diff --git a/src/osmo-bsc/gsm_08_08.c b/src/osmo-bsc/gsm_08_08.c
index a4b53f09f..f3214c7db 100644
--- a/src/osmo-bsc/gsm_08_08.c
+++ b/src/osmo-bsc/gsm_08_08.c
@@ -537,6 +537,16 @@ early_exit:
return rc;
}
+/* Data Link Connection Identifier (DLCI) is defined in 3GPP TS 48.006, section 9.3.2.
+ * .... .SSS - SAPI value used on the radio link;
+ * CC.. .... - control channel identification:
+ * 00.. .... - indicates that the control channel is not further specified,
+ * 10.. .... - represents the FACCH or the SDCCH,
+ * 11.. .... - represents the SACCH,
+ * other values are reserved. */
+#define RSL_LINK_ID2DLCI(link_id) \
+ (link_id & 0x40 ? 0xc0 : 0x80) | (link_id & 0x07)
+
/*! MS->BSC/MSC: Um L3 message. */
void bsc_dtap(struct gsm_subscriber_connection *conn, uint8_t link_id, struct msgb *msg)
{
@@ -549,8 +559,9 @@ void bsc_dtap(struct gsm_subscriber_connection *conn, uint8_t link_id, struct ms
parse_powercap(conn, msg);
- /* Store link_id in msg->cb */
- OBSC_LINKID_CB(msg) = link_id;
+ /* convert RSL link ID to DLCI, store in msg->cb */
+ OBSC_LINKID_CB(msg) = RSL_LINK_ID2DLCI(link_id);
+
osmo_fsm_inst_dispatch(conn->fi, GSCON_EV_MO_DTAP, msg);
done:
log_set_context(LOG_CTX_BSC_SUBSCR, NULL);
diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c
index 124f61353..10f0edd6d 100644
--- a/src/osmo-bsc/osmo_bsc_bssap.c
+++ b/src/osmo-bsc/osmo_bsc_bssap.c
@@ -1186,6 +1186,16 @@ static int bssmap_rcvmsg_dt1(struct gsm_subscriber_connection *conn,
return ret;
}
+/* RSL Link Identifier is defined in 3GPP TS 3GPP TS 48.058, section 9.3.2.
+ * .... .SSS - SAPI value used on the radio link;
+ * ...P P... - priority for SAPI0 messages;
+ * CC.. .... - control channel identification:
+ * 00.. .... - main signalling channel (FACCH or SDCCH),
+ * 01.. .... - SACCH,
+ * other values are reserved. */
+#define DLCI2RSL_LINK_ID(dlci) \
+ ((dlci & 0xc0) == 0xc0 ? 0x40 : 0x00) | (dlci & 0x07)
+
static int dtap_rcvmsg(struct gsm_subscriber_connection *conn,
struct msgb *msg, unsigned int length)
{
@@ -1235,8 +1245,10 @@ static int dtap_rcvmsg(struct gsm_subscriber_connection *conn,
/* pass it to the filter for extra actions */
bsc_scan_msc_msg(conn, gsm48);
- /* Store link_id in msgb->cb */
- OBSC_LINKID_CB(gsm48) = header->link_id;
+
+ /* convert DLCI to RSL link ID, store in msg->cb */
+ OBSC_LINKID_CB(gsm48) = DLCI2RSL_LINK_ID(header->link_id);
+
dtap_rc = osmo_fsm_inst_dispatch(conn->fi, GSCON_EV_MT_DTAP, gsm48);
return dtap_rc;
}