Change in osmo-msc[master]: MT-forwardSM Message Reference fix.

Mykola Shchetinin gerrit-no-reply at
Fri Mar 29 10:49:33 UTC 2019

Mykola Shchetinin has uploaded this change for review. (

Change subject: MT-forwardSM Message Reference fix.

MT-forwardSM Message Reference fix.

The Message Reference that came in GSUP message was not used and the GSUP
response for the SMS contained the wrong Message Reference which was assigned by
MSC, hence the HLR or whatever on the other side of the GSUP connection is was
not able to correlate the request and the response.

transaction.h: gsm_trans: add a field 'msg_ref_gsup' to 'sms' union to store the
original Message Reference (from GSUP).

gsm411_send_rp_data: add an argument to pass Message Reference from GSUP message
to the function. Assign Message Reference to the new trans->sms.msg_ref_gsup

gsm411_gsup_mt_handler: pass the *gsup_msg->sm_rp_mr to gsm411_send_rp_data.

gsm411_rx_rp_ack and gsm411_rx_rp_error: pass trans->sms.msg_ref_gsup instead of
rph->msg_ref to the function that sends GSUP reponse.

Change-Id: Ia50fd0e6c7ba7876522f49a00c55f8499c164331
M include/osmocom/msc/gsm_04_11.h
M include/osmocom/msc/transaction.h
M src/libmsc/gsm_04_11.c
M src/libmsc/gsm_04_11_gsup.c
4 files changed, 11 insertions(+), 5 deletions(-)

  git pull ssh:// refs/changes/64/13464/1

diff --git a/include/osmocom/msc/gsm_04_11.h b/include/osmocom/msc/gsm_04_11.h
index 4297cdb..ec160b2 100644
--- a/include/osmocom/msc/gsm_04_11.h
+++ b/include/osmocom/msc/gsm_04_11.h
@@ -44,7 +44,8 @@
 		    struct gsm_sms *sms);
 int gsm411_send_rp_data(struct gsm_network *net, struct vlr_subscr *vsub,
 			size_t sm_rp_oa_len, const uint8_t *sm_rp_oa,
-			size_t sm_rp_ud_len, const uint8_t *sm_rp_ud);
+			size_t sm_rp_ud_len, const uint8_t *sm_rp_ud,
+			uint8_t sm_rp_mr);
 void gsm411_sapi_n_reject(struct ran_conn *conn);
diff --git a/include/osmocom/msc/transaction.h b/include/osmocom/msc/transaction.h
index 830328b..b5a6662 100644
--- a/include/osmocom/msc/transaction.h
+++ b/include/osmocom/msc/transaction.h
@@ -78,6 +78,7 @@
 			/* SM-RP-MR, Message Reference (see GSM TS 04.11, section 8.2.3) */
 			uint8_t sm_rp_mr;
+			uint8_t msg_ref_gsup;
 			struct gsm_sms *sms;
 		} sms;
diff --git a/src/libmsc/gsm_04_11.c b/src/libmsc/gsm_04_11.c
index ccb2610..af21831 100644
--- a/src/libmsc/gsm_04_11.c
+++ b/src/libmsc/gsm_04_11.c
@@ -800,7 +800,7 @@
 	if (trans->net->sms_over_gsup) {
 		/* Forward towards SMSC via GSUP */
-		return gsm411_gsup_mt_fwd_sm_res(trans, rph->msg_ref);
+		return gsm411_gsup_mt_fwd_sm_res(trans, trans->sms.msg_ref_gsup);
 	if (!sms) {
@@ -841,7 +841,7 @@
 	if (trans->net->sms_over_gsup) {
 		/* Forward towards SMSC via GSUP */
-		return gsm411_gsup_mt_fwd_sm_err(trans, rph->msg_ref, cause);
+		return gsm411_gsup_mt_fwd_sm_err(trans, trans->sms.msg_ref_gsup, cause);
 	if (!sms) {
@@ -1167,7 +1167,8 @@
 /* Low-level function to send raw RP-DATA to a given subscriber */
 int gsm411_send_rp_data(struct gsm_network *net, struct vlr_subscr *vsub,
 			size_t sm_rp_oa_len, const uint8_t *sm_rp_oa,
-			size_t sm_rp_ud_len, const uint8_t *sm_rp_ud)
+			size_t sm_rp_ud_len, const uint8_t *sm_rp_ud,
+			uint8_t sm_rp_mr)
 	struct gsm_trans *trans;
 	struct msgb *msg;
@@ -1177,6 +1178,8 @@
 	if (!trans)
 		return -ENOMEM;
+	trans->sms.msg_ref_gsup = sm_rp_mr;
 	/* Allocate a message buffer for to be encoded SMS */
 	msg = gsm411_msgb_alloc();
 	if (!msg) {
diff --git a/src/libmsc/gsm_04_11_gsup.c b/src/libmsc/gsm_04_11_gsup.c
index eb092ae..c8ec89f 100644
--- a/src/libmsc/gsm_04_11_gsup.c
+++ b/src/libmsc/gsm_04_11_gsup.c
@@ -271,7 +271,8 @@
 	/* Send RP-DATA */
 	rc = gsm411_send_rp_data(net, vsub,
 		gsup_msg->sm_rp_oa_len, gsup_msg->sm_rp_oa,
-		gsup_msg->sm_rp_ui_len, gsup_msg->sm_rp_ui);
+		gsup_msg->sm_rp_ui_len, gsup_msg->sm_rp_ui,
+		*gsup_msg->sm_rp_mr);
 	if (rc) {
 		LOGP(DLSMS, LOGL_NOTICE, "Failed to send MT SMS, "
 			"ignoring MT-forwardSM-Req message...\n");

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

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia50fd0e6c7ba7876522f49a00c55f8499c164331
Gerrit-Change-Number: 13464
Gerrit-PatchSet: 1
Gerrit-Owner: Mykola Shchetinin <mykola at>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gerrit-log mailing list