Change in osmo-msc[master]: Use libosmocore to function to parse cipher mode reject cause

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Tue Nov 20 17:27:40 UTC 2018


Max has submitted this change and it was merged. ( https://gerrit.osmocom.org/11832 )

Change subject: Use libosmocore to function to parse cipher mode reject cause
......................................................................

Use libosmocore to function to parse cipher mode reject cause

This allow us to handle both regular and extended cause transparently.

Change-Id: I7742ac41dd0642a5a40ce79d23250f8d9e6ae556
Related: OS#3187
---
M src/libmsc/a_iface_bssap.c
1 file changed, 7 insertions(+), 6 deletions(-)

Approvals:
  Pau Espin Pedrol: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/libmsc/a_iface_bssap.c b/src/libmsc/a_iface_bssap.c
index f24fb05..c11347e 100644
--- a/src/libmsc/a_iface_bssap.c
+++ b/src/libmsc/a_iface_bssap.c
@@ -427,20 +427,21 @@
 static int bssmap_rx_ciph_rej(struct gsm_subscriber_connection *conn,
 			      struct msgb *msg, struct tlv_parsed *tp)
 {
+	int rc;
 	enum gsm0808_cause cause;
 	struct rate_ctr_group *msc = conn->network->msc_ctrs;
 
 	LOGPCONN(conn, LOGL_NOTICE, "RX BSSMAP CIPHER MODE REJECT\n");
 
-	if (!TLVP_PRES_LEN(tp, GSM0808_IE_CAUSE, 1)) {
-		LOGPCONN(conn, LOGL_ERROR, "Cause code is missing -- discarding message!\n");
-		return -EINVAL;
+	rc = gsm0808_get_cipher_reject_cause(tp);
+	if (rc < 0) {
+		LOGPCONN(conn, LOGL_ERROR, "failed (%s) to extract Cause from Cipher mode reject: %s\n",
+			 strerror(-rc), msgb_hexdump(msg));
+		return rc;
 	}
 
 	rate_ctr_inc(&msc->ctr[MSC_CTR_BSSMAP_CIPHER_MODE_REJECT]);
-
-	/* FIXME: add support for 2-byte Cause values using libosmocore functions */
-	cause = *TLVP_VAL(tp, GSM0808_IE_CAUSE);
+	cause = (enum gsm0808_cause)rc;
 	LOGPCONN(conn, LOGL_NOTICE, "Cipher mode rejection cause: %s\n", gsm0808_cause_name(cause));
 
 	/* FIXME: Can we do something meaningful here? e.g. report to the

-- 
To view, visit https://gerrit.osmocom.org/11832
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I7742ac41dd0642a5a40ce79d23250f8d9e6ae556
Gerrit-Change-Number: 11832
Gerrit-PatchSet: 3
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181120/f422e7c4/attachment.htm>


More information about the gerrit-log mailing list