aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gprs/gb_proxy_vty.c
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-05-19 10:14:58 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-07-22 16:04:54 +0200
commit67a4445675170c584be6b424e57b07b8c88b05b7 (patch)
tree5af5d41af928b2ce676dca323266e6c805ea90f6 /openbsc/src/gprs/gb_proxy_vty.c
parentfd636aed1ed266d68c0a8cec4750f068fc911cd2 (diff)
gprs: Implement BSSGP MCC/MNC patching
This adds a feature to patch the BSSGP MNC/MCC fields of messages going to and coming from the SGSN. To enable this feature, the gbproxy's VTY commands 'core-mobile-country-code' and/or 'core-mobile-network-code' must be used. All packets to the SGSN are patched to match the configured values. Packets received from the SGSN are patched to the corresponding values as last seen from the BSS side. Note that this will probably not work with a gbproxy used for several BSS simultaneously. Note also, that MCC/MNC contained in a LLC IE will not be patched. Ticket: OW#1185 Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc/src/gprs/gb_proxy_vty.c')
-rw-r--r--openbsc/src/gprs/gb_proxy_vty.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/openbsc/src/gprs/gb_proxy_vty.c b/openbsc/src/gprs/gb_proxy_vty.c
index 2de0d3bc5..04431f0e3 100644
--- a/openbsc/src/gprs/gb_proxy_vty.c
+++ b/openbsc/src/gprs/gb_proxy_vty.c
@@ -51,6 +51,13 @@ static int config_write_gbproxy(struct vty *vty)
vty_out(vty, " sgsn nsei %u%s", g_cfg->nsip_sgsn_nsei,
VTY_NEWLINE);
+ if (g_cfg->core_mcc > 0)
+ vty_out(vty, " core-mobile-country-code %d%s",
+ g_cfg->core_mcc, VTY_NEWLINE);
+ if (g_cfg->core_mnc > 0)
+ vty_out(vty, " core-mobile-network-code %d%s",
+ g_cfg->core_mnc, VTY_NEWLINE);
+
return CMD_SUCCESS;
}
@@ -76,6 +83,47 @@ DEFUN(cfg_nsip_sgsn_nsei,
return CMD_SUCCESS;
}
+#define GBPROXY_CORE_MNC_STR "Use this network code for the core network\n"
+
+DEFUN(cfg_gbproxy_core_mnc,
+ cfg_gbproxy_core_mnc_cmd,
+ "core-mobile-network-code <1-999>",
+ GBPROXY_CORE_MNC_STR "NCC value\n")
+{
+ g_cfg->core_mnc = atoi(argv[0]);
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_gbproxy_no_core_mnc,
+ cfg_gbproxy_no_core_mnc_cmd,
+ "no core-mobile-network-code",
+ NO_STR GBPROXY_CORE_MNC_STR)
+{
+ g_cfg->core_mnc = 0;
+ return CMD_SUCCESS;
+}
+
+#define GBPROXY_CORE_MCC_STR "Use this country code for the core network\n"
+
+DEFUN(cfg_gbproxy_core_mcc,
+ cfg_gbproxy_core_mcc_cmd,
+ "core-mobile-country-code <1-999>",
+ GBPROXY_CORE_MCC_STR "MCC value\n")
+{
+ g_cfg->core_mcc = atoi(argv[0]);
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_gbproxy_no_core_mcc,
+ cfg_gbproxy_no_core_mcc_cmd,
+ "no core-mobile-country-code",
+ NO_STR GBPROXY_CORE_MCC_STR)
+{
+ g_cfg->core_mcc = 0;
+ return CMD_SUCCESS;
+}
+
+
int gbproxy_vty_init(void)
{
install_element_ve(&show_gbproxy_cmd);
@@ -87,6 +135,10 @@ int gbproxy_vty_init(void)
install_node(&gbproxy_node, config_write_gbproxy);
vty_install_default(GBPROXY_NODE);
install_element(GBPROXY_NODE, &cfg_nsip_sgsn_nsei_cmd);
+ install_element(GBPROXY_NODE, &cfg_gbproxy_core_mcc_cmd);
+ install_element(GBPROXY_NODE, &cfg_gbproxy_core_mnc_cmd);
+ install_element(GBPROXY_NODE, &cfg_gbproxy_no_core_mcc_cmd);
+ install_element(GBPROXY_NODE, &cfg_gbproxy_no_core_mnc_cmd);
return 0;
}