From 6878fc2565446f1f43fae3308ac7e6db3f069249 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Mon, 23 Oct 2017 12:03:27 +0330 Subject: [PATCH] mobile/vty: add Key Sequence number change command Change-Id: I2400a80c9804159dfe1faa26b84e33776d30a79f --- src/host/layer23/src/mobile/vty_interface.c | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/host/layer23/src/mobile/vty_interface.c b/src/host/layer23/src/mobile/vty_interface.c index 2cf17ba13..52f914b04 100644 --- a/src/host/layer23/src/mobile/vty_interface.c +++ b/src/host/layer23/src/mobile/vty_interface.c @@ -488,6 +488,29 @@ DEFUN(clone_imsi, clone_imsi_cmd, "clone imsi MS_NAME IMSI", return CMD_SUCCESS; } +DEFUN(clone_kc_num, clone_kc_num_cmd, "clone kc_num MS_NAME NUM", + "Spoof mobile identity\n" + "Change current Key Sequence number\n" + "Name of MS (see \"show ms\")\n" + "Key Sequence number") +{ + uint8_t kc_num = 0; + struct osmocom_ms *ms; + + ms = get_ms(argv[0], vty); + if (!ms) + return CMD_WARNING; + + if (argc >= 2) + kc_num = strtoul(argv[1], NULL, 10); + + ms->subscr.key_seq = kc_num; + vty_out(vty, "Forced to use the following " + "Key Sequence number: %u%s", kc_num, VTY_NEWLINE); + + return CMD_SUCCESS; +} + DEFUN(monitor_network, monitor_network_cmd, "monitor network MS_NAME", "Monitor...\nMonitor network information\nName of MS (see \"show ms\")") { @@ -2966,6 +2989,7 @@ int ms_vty_init(void) install_element(ENABLE_NODE, &delete_forbidden_plmn_cmd); install_element(ENABLE_NODE, &clone_tsmi_cmd); install_element(ENABLE_NODE, &clone_imsi_cmd); + install_element(ENABLE_NODE, &clone_kc_num_cmd); #ifdef _HAVE_GPSD install_element(CONFIG_NODE, &cfg_gps_host_cmd);