[PATCH] osmo-bts[master]: rsl: log errors when parsing of encryption information fails

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed May 9 18:11:31 UTC 2018


Review at  https://gerrit.osmocom.org/8090

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
---
M src/common/rsl.c
1 file changed, 10 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/90/8090/1

diff --git a/src/common/rsl.c b/src/common/rsl.c
index 9adb89a..f50c1d2 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -821,18 +821,26 @@
 
 	/* 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;
 }

-- 
To view, visit https://gerrit.osmocom.org/8090
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icda7722eef319f343178b0bb8f79362026948199
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list