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 <msur...@sysmocom.de> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Jenkins Builder (1000002) Gerrit-Reviewer: Max <msur...@sysmocom.de> Gerrit-Reviewer: Pau Espin Pedrol <pes...@sysmocom.de>