summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2015-12-25 08:37:19 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2015-12-25 09:33:12 +0100
commitad435fc269f16f85ba729b30e234f4d4def44316 (patch)
treed32ca724ebcff8c7ef78245d44b9fcbdfe5466bd
parent467b11a32759cf4608612546d837960be0578ece (diff)
Add VTY option to add forbidden PLMN network manually
The given network is appended and also stored in the SIM card. This is useful to block networks that would detach SIM cards with unknown (test) PLMN. Then the mobile will not register to that network, as long it is kept in the blocked list. Note that only the last four forbidden PLMNs will be stored in the SIM card.
-rw-r--r--src/host/layer23/src/mobile/vty_interface.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/host/layer23/src/mobile/vty_interface.c b/src/host/layer23/src/mobile/vty_interface.c
index 167d99d9..84b679be 100644
--- a/src/host/layer23/src/mobile/vty_interface.c
+++ b/src/host/layer23/src/mobile/vty_interface.c
@@ -1076,6 +1076,34 @@ DEFUN(test_handover, test_handover_cmd, "test handover NAME <0-1024> [pcs]",
return CMD_SUCCESS;
}
+DEFUN(add_forbidden_plmn, add_forbidden_plmn_cmd,
+ "add forbidden plmn NAME MCC MNC CAUSE",
+ "Delete\nForbidden\nplmn\nName of MS (see \"show ms\")\n"
+ "Mobile Country Code\nMobile Network Code\nCause value")
+{
+ struct osmocom_ms *ms;
+ uint16_t mcc = gsm_input_mcc((char *)argv[1]),
+ mnc = gsm_input_mnc((char *)argv[2]);
+ uint8_t cause = gsm_input_mnc((char *)argv[3]);
+
+ ms = get_ms(argv[0], vty);
+ if (!ms)
+ return CMD_WARNING;
+
+ if (mcc == GSM_INPUT_INVALID) {
+ vty_out(vty, "Given MCC invalid%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ if (mnc == GSM_INPUT_INVALID) {
+ vty_out(vty, "Given MNC invalid%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ gsm_subscr_add_forbidden_plmn(&ms->subscr, mcc, mnc, cause);
+
+ return CMD_SUCCESS;
+}
+
DEFUN(delete_forbidden_plmn, delete_forbidden_plmn_cmd,
"delete forbidden plmn NAME MCC MNC",
"Delete\nForbidden\nplmn\nName of MS (see \"show ms\")\n"
@@ -3105,6 +3133,7 @@ int ms_vty_init(void *tall_ctx)
install_element(ENABLE_NODE, &service_cmd);
install_element(ENABLE_NODE, &test_reselection_cmd);
install_element(ENABLE_NODE, &test_handover_cmd);
+ install_element(ENABLE_NODE, &add_forbidden_plmn_cmd);
install_element(ENABLE_NODE, &delete_forbidden_plmn_cmd);
#ifdef _HAVE_GPSD