Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/11569 )

Change subject: Properly parse cause in cipher mode reject
......................................................................

Properly parse cause in cipher mode reject

Use appropriate TLV routines to get and log the value of rejection
cause.

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

Approvals:
  Harald Welte: 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 11d3673..4666ae3 100644
--- a/src/libmsc/a_iface_bssap.c
+++ b/src/libmsc/a_iface_bssap.c
@@ -420,21 +420,22 @@
        return 0;
 }

-/* Endpoint to handle BSSMAP cipher mode reject */
+/* Endpoint to handle BSSMAP cipher mode reject, 3GPP TS 08.08 ยง3.2.1.48 */
 static int bssmap_rx_ciph_rej(struct gsm_subscriber_connection *conn,
                              struct msgb *msg, struct tlv_parsed *tp)
 {
-       uint8_t cause;
+       enum gsm0808_cause cause;

        LOGPCONN(conn, LOGL_NOTICE, "RX BSSMAP CIPHER MODE REJECT\n");

-       if (!TLVP_PRESENT(tp, BSS_MAP_MSG_CIPHER_MODE_REJECT)) {
+       if (!TLVP_PRES_LEN(tp, GSM0808_IE_CAUSE, 1)) {
                LOGPCONN(conn, LOGL_ERROR, "Cause code is missing -- discarding 
message!\n");
                return -EINVAL;
        }

-       cause = TLVP_VAL(tp, BSS_MAP_MSG_CIPHER_MODE_REJECT)[0];
-       LOGPCONN(conn, LOGL_NOTICE, "Cipher mode rejection cause: %i\n", cause);
+       /* FIXME: add support for 2-byte Cause values using libosmocore 
functions */
+       cause = *TLVP_VAL(tp, GSM0808_IE_CAUSE);
+       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
         * msc code somehow that the cipher mode command has failed. */

--
To view, visit https://gerrit.osmocom.org/11569
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: I26b3eb0deff6dbd217b23d284bbc6e6a9eebc8e6
Gerrit-Change-Number: 11569
Gerrit-PatchSet: 3
Gerrit-Owner: Max <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <[email protected]>
Gerrit-Reviewer: Pau Espin Pedrol <[email protected]>

Reply via email to