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

Change subject: err log: fully log MS supported A5 algos on mismatch
......................................................................

err log: fully log MS supported A5 algos on mismatch

Change-Id: Icb18e0f0bb420de066e7eb8fc683f192ba2a7368
---
M src/libmsc/gsm_04_08.c
1 file changed, 38 insertions(+), 2 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Neels Hofmeyr: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c
index 4baf996..7a485c7 100644
--- a/src/libmsc/gsm_04_08.c
+++ b/src/libmsc/gsm_04_08.c
@@ -118,6 +118,41 @@
        return classmark2_is_r99(cm->classmark2, cm->classmark2_len);
 }

+static const char *classmark_a5_name(const struct gsm_classmark *cm)
+{
+       static char buf[128];
+       char cm1[42];
+       char cm2[42];
+       char cm3[42];
+
+       if (cm->classmark1_set)
+               snprintf(cm1, sizeof(cm1), "cm1{a5/1=%s}",
+                    cm->classmark1.a5_1 ? "not-supported":"supported" /* 
inverted logic */);
+       else
+               snprintf(cm1, sizeof(cm1), "no-cm1");
+
+       if (cm->classmark2_len >= 3)
+               snprintf(cm2, sizeof(cm2), " cm2{0x%x=%s%s}",
+                        cm->classmark2[2],
+                        cm->classmark2[2] & 0x1 ? " A5/2" : "",
+                        cm->classmark2[2] & 0x2 ? " A5/3" : "");
+       else
+               snprintf(cm2, sizeof(cm2), " no-cm2");
+
+       if (cm->classmark3_len >= 1)
+               snprintf(cm3, sizeof(cm3), " cm3{0x%x=%s%s%s%s}",
+                        cm->classmark3[0],
+                        cm->classmark3[0] & (1 << 0) ? " A5/4" : "",
+                        cm->classmark3[0] & (1 << 1) ? " A5/5" : "",
+                        cm->classmark3[0] & (1 << 2) ? " A5/6" : "",
+                        cm->classmark3[0] & (1 << 3) ? " A5/7" : "");
+       else
+               snprintf(cm3, sizeof(cm3), " no-cm3");
+
+       snprintf(buf, sizeof(buf), "%s%s%s", cm1, cm2, cm3);
+       return buf;
+}
+
 /* Determine if the given CLASSMARK (1/2/3) value permits a given A5/n cipher.
  * Return 1 when the given A5/n is permitted, 0 when not, and negative if the 
respective MS CLASSMARK is
  * not known, where the negative number indicates the classmark type: -2 means 
Classmark 2 is not
@@ -1617,8 +1652,9 @@

        if (ei.perm_algo_len == 0) {
                LOGP(DMM, LOGL_ERROR, "%s: cannot start ciphering, no 
intersection "
-                    "between MSC-configured and MS-supported A5 algorithms\n",
-                    vlr_subscr_name(conn->vsub));
+                    "between MSC-configured and MS-supported A5 algorithms. 
MSC: %x  MS: %s\n",
+                    vlr_subscr_name(conn->vsub), net->a5_encryption_mask,
+                    classmark_a5_name(&conn->vsub->classmark));
                return -ENOTSUP;
        }


--
To view, visit https://gerrit.osmocom.org/12404
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: Icb18e0f0bb420de066e7eb8fc683f192ba2a7368
Gerrit-Change-Number: 12404
Gerrit-PatchSet: 13
Gerrit-Owner: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>

Reply via email to