diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2018-02-22 04:04:54 +0100 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2018-02-28 19:30:14 +0100 |
commit | 379d5799f0d6bbfce031c2f17c2840ce43a5ac98 (patch) | |
tree | c56503b5466c5cb719c70f46e9e34b56e6aa9a48 /src/libcommon-cs | |
parent | 7f48420923e46f9476ef7af2d4fe0bd0ed5e30b0 (diff) |
implement support for 3-digit MNC with leading zeros
Add 3-digit flags and use the new RAI and LAI API from libosmocore throughout
the code base to be able to handle an MNC < 100 that has three digits (leading
zeros).
Depends: Id2240f7f518494c9df6c8bda52c0d5092f90f221 (libosmocore),
Ib7176b1d65a03b76f41f94bc9d3293a8a07d24c6 (libosmocore)
Change-Id: I82f0016d9512ee8722a3489a3cb4b6c704a271fc
Diffstat (limited to 'src/libcommon-cs')
-rw-r--r-- | src/libcommon-cs/common_cs.c | 4 | ||||
-rw-r--r-- | src/libcommon-cs/common_cs_vty.c | 12 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/libcommon-cs/common_cs.c b/src/libcommon-cs/common_cs.c index c64719bc4..a1d229816 100644 --- a/src/libcommon-cs/common_cs.c +++ b/src/libcommon-cs/common_cs.c @@ -45,8 +45,8 @@ struct gsm_network *gsm_network_init(void *ctx, mncc_recv_cb_t mncc_recv) if (!net) return NULL; - net->country_code = 1; - net->network_code = 1; + net->plmn = (struct osmo_plmn_id){ .mcc=1, .mnc=1 }; + /* Permit a compile-time default of A5/3 and A5/1 */ net->a5_encryption_mask = (1 << 3) | (1 << 1); diff --git a/src/libcommon-cs/common_cs_vty.c b/src/libcommon-cs/common_cs_vty.c index 01c6b357f..d59f31c16 100644 --- a/src/libcommon-cs/common_cs_vty.c +++ b/src/libcommon-cs/common_cs_vty.c @@ -61,7 +61,7 @@ DEFUN(cfg_net_ncc, { struct gsm_network *gsmnet = gsmnet_from_vty(vty); - gsmnet->country_code = atoi(argv[0]); + gsmnet->plmn.mcc = atoi(argv[0]); return CMD_SUCCESS; } @@ -75,8 +75,16 @@ DEFUN(cfg_net_mnc, "Mobile Network Code to use\n") { struct gsm_network *gsmnet = gsmnet_from_vty(vty); + uint16_t mnc; + bool mnc_3_digits; - gsmnet->network_code = atoi(argv[0]); + if (osmo_mnc_from_str(argv[0], &mnc, &mnc_3_digits)) { + vty_out(vty, "%% Error decoding MNC: %s%s", argv[0], VTY_NEWLINE); + return CMD_WARNING; + } + + gsmnet->plmn.mnc = mnc; + gsmnet->plmn.mnc_3_digits = mnc_3_digits; return CMD_SUCCESS; } |