From 09e49eed6181cea145cd08c65c87986a6e033be9 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 9 May 2018 20:00:47 +0200 Subject: rsl: log errors when parsing of encryption information fails ... also log a DEBUG message whenever we change the lchan->encr Related: OS#3254 Change-Id: Icda7722eef319f343178b0bb8f79362026948199 --- src/common/rsl.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/common/rsl.c') diff --git a/src/common/rsl.c b/src/common/rsl.c index 8a1a232f..229d960c 100644 --- a/src/common/rsl.c +++ b/src/common/rsl.c @@ -868,18 +868,26 @@ static int encr_info2lchan(struct gsm_lchan *lchan, /* check if the encryption algorithm sent by BSC is supported! */ rc = bts_supports_cipher(bts, *val); - if (rc != 1) + if (rc != 1) { + LOGP(DRSL, LOGL_ERROR, "%s: BTS doesn't support cipher 0x%02x\n", + gsm_lchan_name(lchan), *val); return rc; + } /* length can be '1' in case of no ciphering */ - if (len < 1) + if (len < 1) { + LOGP(DRSL, LOGL_ERROR, "%s: Encryption Info cannot have len=%d\n", + gsm_lchan_name(lchan), len); return -EINVAL; + } lchan->encr.alg_id = *val++; lchan->encr.key_len = len -1; if (lchan->encr.key_len > sizeof(lchan->encr.key)) lchan->encr.key_len = sizeof(lchan->encr.key); memcpy(lchan->encr.key, val, lchan->encr.key_len); + DEBUGP(DRSL, "%s: Setting lchan cipher algorithm 0x%02x\n", + gsm_lchan_name(lchan), lchan->encr.alg_id); return 0; } -- cgit v1.2.3