diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2018-03-21 14:45:13 +0100 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2018-03-22 05:23:11 +0100 |
commit | 408856088bcf376f5317803fd8d1747f8b920054 (patch) | |
tree | 9266e5698859483ef5b359f4d6f2e3e7cdd4f109 /openbsc/src/osmo-bsc/osmo_bsc_vty.c | |
parent | 8469818e33ef81e9f707a0c4dd13d7b91ecf83f5 (diff) |
backport support for 3-digit MNC with leading zerosneels/mnc3
Backport the patches with the following change-ids:
osmo-bsc.git:
I5b097dbb6329f284e3b4914a744d5c3ad628f715
I8e722103344186fde118b26d8353db95a4581daa
I78f30aef7aa224b2e9db54c3a844d8f520b3aee0
I38ac98a4d25159cfd4f686efbfbaf8f00625a6d8
osmo-iuh.git:
I29ebcddd45fe3079f8883589a83cc7216a535475
Also apply change of ipac_bcch_info.cgi to struct osmo_cell_global_id in
src/ipaccess/network_listen.c, a change that appears to not have been necessary
in the new split repositories.
Related: OS#3010
Change-Id: Ibf50fd7e1ca5472d0a38fcb87c68227d6de44f42
Diffstat (limited to 'openbsc/src/osmo-bsc/osmo_bsc_vty.c')
-rw-r--r-- | openbsc/src/osmo-bsc/osmo_bsc_vty.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_vty.c b/openbsc/src/osmo-bsc/osmo_bsc_vty.c index 7bb123dcf..e124b31fc 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_vty.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_vty.c @@ -27,6 +27,7 @@ #include <openbsc/bsc_msg_filter.h> #include <osmocom/core/talloc.h> +#include <osmocom/gsm/gsm48.h> #include <osmocom/vty/logging.h> #include <time.h> @@ -110,12 +111,12 @@ static void write_msc(struct vty *vty, struct bsc_msc_data *msc) if (msc->bsc_key_present) vty_out(vty, " auth-key %s%s", osmo_hexdump(msc->bsc_key, sizeof(msc->bsc_key)), VTY_NEWLINE); - if (msc->core_mnc != -1) - vty_out(vty, " core-mobile-network-code %d%s", - msc->core_mnc, VTY_NEWLINE); - if (msc->core_mcc != -1) - vty_out(vty, " core-mobile-country-code %d%s", - msc->core_mcc, VTY_NEWLINE); + if (msc->core_plmn.mnc != GSM_MCC_MNC_INVALID) + vty_out(vty, " core-mobile-network-code %s%s", + osmo_mnc_name(msc->core_plmn.mnc, msc->core_plmn.mnc_3_digits), VTY_NEWLINE); + if (msc->core_plmn.mcc != GSM_MCC_MNC_INVALID) + vty_out(vty, " core-mobile-country-code %s%s", + osmo_mcc_name(msc->core_plmn.mcc), VTY_NEWLINE); if (msc->core_lac != -1) vty_out(vty, " core-location-area-code %d%s", msc->core_lac, VTY_NEWLINE); @@ -264,7 +265,15 @@ DEFUN(cfg_net_bsc_ncc, "Use this network code for the core network\n" "MNC value\n") { struct bsc_msc_data *data = bsc_msc_data(vty); - data->core_mnc = atoi(argv[0]); + uint16_t mnc; + bool mnc_3_digits; + + 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; + } + data->core_plmn.mnc = mnc; + data->core_plmn.mnc_3_digits = mnc_3_digits; return CMD_SUCCESS; } @@ -273,8 +282,13 @@ DEFUN(cfg_net_bsc_mcc, "core-mobile-country-code <1-999>", "Use this country code for the core network\n" "MCC value\n") { + uint16_t mcc; struct bsc_msc_data *data = bsc_msc_data(vty); - data->core_mcc = atoi(argv[0]); + if (osmo_mcc_from_str(argv[0], &mcc)) { + vty_out(vty, "%% Error decoding MCC: %s%s", argv[0], VTY_NEWLINE); + return CMD_WARNING; + } + data->core_plmn.mcc = mcc; return CMD_SUCCESS; } |