jolly submitted this change.

View Change

Approvals: laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, approved Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve
Indicate error 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, 29 insertions(+), 1 deletion(-)

diff --git a/src/libmsc/gsm_04_11.c b/src/libmsc/gsm_04_11.c
index b6d5f4a..209ca28 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)
@@ -1339,6 +1353,12 @@
"to us anymore. We are ignoring it, maybe a CP-ERROR "
"from a MS?\n",
transaction_id);
+ /* 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. */
+ if (!osmo_use_count_by(&msc_a->use_count, MSC_A_USE_CM_SERVICE_SMS))
+ LOG_TRANS(trans, LOGL_ERROR, "MO SMS without prior CM Service Request\n");
+ else
+ msc_a_put(msc_a, MSC_A_USE_CM_SERVICE_SMS);
return -EINVAL;
}

@@ -1346,7 +1366,15 @@
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. */
+ if (!osmo_use_count_by(&msc_a->use_count, MSC_A_USE_CM_SERVICE_SMS))
+ LOG_TRANS(trans, LOGL_ERROR, "MO SMS without prior CM Service Request\n");
+ else
+ msc_a_put(msc_a, MSC_A_USE_CM_SERVICE_SMS);
return -ENOMEM;
}


To view, visit change 38514. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I82da9c283205c69b19ceb4ba40ac5aa7f37d159b
Gerrit-Change-Number: 38514
Gerrit-PatchSet: 6
Gerrit-Owner: jolly <andreas@eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: jolly <andreas@eversberg.eu>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>