summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2015-12-25 08:37:19 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2016-09-25 08:12:41 +0200
commit2f5c76a9946dd97866deda70a6f777c63fb9be49 (patch)
treec4f729d6a20829af42739b17d94cb6abfedc6066
parent2e1f0ca0192955f2b398602b8ccbb4946d65422e (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 39d1c415..9a868805 100644
--- a/src/host/layer23/src/mobile/vty_interface.c
+++ b/src/host/layer23/src/mobile/vty_interface.c
@@ -1102,6 +1102,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"
@@ -3139,6 +3167,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