aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2018-11-01 17:34:12 +0100
committerHarald Welte <laforge@gnumonks.org>2018-11-02 22:06:09 +0000
commit662e2ba73e6d4643b603476bf9ee95b8aef2423c (patch)
tree40736663c39d1b6711ed825b3cfeda05011d3336
parentdd2aeba02c7064679be5d1fadabfaa865c8b8aad (diff)
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
-rw-r--r--src/libmsc/a_iface_bssap.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libmsc/a_iface_bssap.c b/src/libmsc/a_iface_bssap.c
index 11d367383..4666ae3a6 100644
--- a/src/libmsc/a_iface_bssap.c
+++ b/src/libmsc/a_iface_bssap.c
@@ -420,21 +420,22 @@ static int bssmap_rx_ciph_compl(struct gsm_subscriber_connection *conn, struct m
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. */