jolly has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-msc/+/38514?usp=email )


Change subject: Indicate errior and release BSS connection when SMS transaction 
fails
......................................................................

Indicate errior and release BSS connection when SMS transaction fails

When the creation of the transaction structure fails, the MSC will
send a CP-ERROR message.

This patch ensures that the MSC_A use counter is decremented, so
that the BSS connection is released, if it is not used by any other
transaction.

Without this patch, the msc_a_fsm would wait 5 seconds for an initial
transaction before releasing the BSS connection.

Related: OS#6427
Change-Id: I82da9c283205c69b19ceb4ba40ac5aa7f37d159b
---
M src/libmsc/gsm_04_11.c
1 file changed, 20 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/14/38514/1

diff --git a/src/libmsc/gsm_04_11.c b/src/libmsc/gsm_04_11.c
index 6536d0b..d2a919c 100644
--- a/src/libmsc/gsm_04_11.c
+++ b/src/libmsc/gsm_04_11.c
@@ -231,6 +231,20 @@
        return gsm411_sendmsg(trans, msg);
 }

+int gsm411_send_cp_error(struct msc_a *msc_a, uint8_t pdisc, uint8_t cause)
+{
+       struct msgb *msg = gsm411_msgb_alloc();
+       struct gsm48_hdr *gh;
+
+       msgb_put_u8(msg, cause);
+
+       gh = (struct gsm48_hdr *) msgb_push(msg, sizeof(*gh));
+       gh->proto_discr = pdisc;
+       gh->msg_type = GSM411_MT_CP_ERROR;
+
+       return msc_a_tx_dtap_to_i(msc_a, msg);
+}
+
 /* mm_send: receive MMCCSMS sap message from SMC */
 static int gsm411_mm_send(struct gsm411_smc_inst *inst, int msg_type,
                        struct msgb *msg, int cp_msg_type)
@@ -1318,7 +1332,12 @@
                new_trans = 1;
                trans = gsm411_trans_init(net, vsub, msc_a, transaction_id, 
true);
                if (!trans) {
-                       /* FIXME: send some error message */
+                       /* Send error message. */
+                       gsm411_send_cp_error(msc_a, GSM48_PDISC_SMS | 
(transaction_id << 4),
+                                            GSM411_CP_CAUSE_NET_FAIL);
+                       /* Decrement use counter that has been incremented by 
CM Service Request (SMS).
+                        * If there is no other service request, the BSS 
connection will be released. */
+                       msc_a_put(msc_a, MSC_A_USE_CM_SERVICE_SMS);
                        return -ENOMEM;
                }


--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/38514?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I82da9c283205c69b19ceb4ba40ac5aa7f37d159b
Gerrit-Change-Number: 38514
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <[email protected]>

Reply via email to