Change in ...osmo-msc[master]: libmsc/ran_msg_iu.c: fix: properly handle SAPI IE of RANAP_DirectTran...

laforge gerrit-no-reply at
Thu Jun 20 16:54:46 UTC 2019

laforge has submitted this change and it was merged. ( )

Change subject: libmsc/ran_msg_iu.c: fix: properly handle SAPI IE of RANAP_DirectTransfer

libmsc/ran_msg_iu.c: fix: properly handle SAPI IE of RANAP_DirectTransfer

The RANAP DirectTransfer message may contain an optional SAPI IE.
Thanks to our TTCN-3 tests (and Wireshark!), it was discovered
that this IE is ignored, so even if the MO SMS related messages
arrive on SAPI 3 (as per GSM TS 04.11, section 2.3) OsmoMSC sends
MT messages on SAPI 0.

In ran_iu_decode_l3() we need to check if the SAPI IE is present,
and tag the NAS PDU message buffer with a proper DLCI value.

This change makes the failing SMS related test cases pass.

Change-Id: I728b55b04e87fc23be6d4f8735e8cad82b6f640e
M src/libmsc/ran_msg_iu.c
1 file changed, 12 insertions(+), 2 deletions(-)

  laforge: Looks good to me, approved
  Jenkins Builder: Verified

diff --git a/src/libmsc/ran_msg_iu.c b/src/libmsc/ran_msg_iu.c
index f443944..d5b9143 100644
--- a/src/libmsc/ran_msg_iu.c
+++ b/src/libmsc/ran_msg_iu.c
@@ -37,6 +37,7 @@
 #include <osmocom/msc/msc_common.h>
 #include <osmocom/msc/sccp_ran.h>
 #include <osmocom/msc/ran_msg_iu.h>
+#include <osmocom/msc/gsm_04_11.h>
 /* Implement the extern talloc_asn1_ctx from libasn1c as talloc ctx for ASN.1 message composition */
 void *talloc_asn1_ctx = NULL;
@@ -92,8 +93,11 @@
-static void ran_iu_decode_l3(struct ran_dec *ran_iu_decode, const RANAP_NAS_PDU_t *nas_pdu, const char *msg_name)
+static void ran_iu_decode_l3(struct ran_dec *ran_iu_decode,
+			     const RANAP_DirectTransferIEs_t *ies,
+			     const char *msg_name)
+	const RANAP_NAS_PDU_t *nas_pdu = &ies->nas_pdu;
 	struct msgb *ran = msgb_alloc(256, msg_name);
 	struct ran_msg ran_dec_msg;
@@ -101,6 +105,12 @@
 	ran->l3h = msgb_put(ran, nas_pdu->size);
 	memcpy(ran->l3h, nas_pdu->buf, nas_pdu->size);
+	/* Handle optional SAPI IE */
+		if (ies->sapi == RANAP_SAPI_sapi_3)
+	}
 	ran_dec_msg = (struct ran_msg){
 		.msg_type = RAN_MSG_DTAP,
 		.msg_name = msg_name,
@@ -266,7 +276,7 @@
 	case RANAP_ProcedureCode_id_DirectTransfer:
-		ran_iu_decode_l3(ran_iu_decode, &message->msg.directTransferIEs.nas_pdu, "RANAP DirectTransfer RAN PDU");
+		ran_iu_decode_l3(ran_iu_decode, &message->msg.directTransferIEs, "RANAP DirectTransfer RAN PDU");
 	case RANAP_ProcedureCode_id_SecurityModeControl:

To view, visit
To unsubscribe, or for help writing mail filters, visit

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I728b55b04e87fc23be6d4f8735e8cad82b6f640e
Gerrit-Change-Number: 14552
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <axilirator at>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gerrit-log mailing list