aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-09-24 10:21:40 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-09-24 10:28:43 +0200
commit925504bfe0834be6b1549af51242ef24fa2a0eaa (patch)
tree14e4ef1ab32173c90c4f29d64f6b3b0594aacb6a
parente57e0fa701d659ad8acf83cb14f7caa0bd563068 (diff)
gbproxy: Add quirk commands to allow upgrade from pre-release
The pre-release didn't add a newline after the apn and the patching pattern command. Create a quirk command that combines both. The pre-release didn't include a differentation between routing and patching. The TLLI handling has a different and more generic name now. Make it handle the old one that is actively used. Add a file with the broken format and the standard config file test should pick it up.
-rw-r--r--openbsc/doc/examples/osmo-gbproxy/osmo-gbproxy-legacy.cfg44
-rw-r--r--openbsc/osmoappdesc.py3
-rw-r--r--openbsc/src/gprs/gb_proxy_vty.c53
3 files changed, 99 insertions, 1 deletions
diff --git a/openbsc/doc/examples/osmo-gbproxy/osmo-gbproxy-legacy.cfg b/openbsc/doc/examples/osmo-gbproxy/osmo-gbproxy-legacy.cfg
new file mode 100644
index 00000000..566258e5
--- /dev/null
+++ b/openbsc/doc/examples/osmo-gbproxy/osmo-gbproxy-legacy.cfg
@@ -0,0 +1,44 @@
+!
+! OsmoGbProxy (UNKNOWN) configuration saved from vty
+!!
+!
+log stderr
+ logging filter all 1
+ logging color 1
+ logging timestamp 0
+ logging level all everything
+ logging level gprs debug
+ logging level ns info
+ logging level bssgp debug
+ logging level lglobal notice
+ logging level llapd notice
+ logging level linp notice
+ logging level lmux notice
+ logging level lmi notice
+ logging level lmib notice
+ logging level lsms notice
+!
+line vty
+ no login
+!
+ns
+ nse 666 nsvci 666
+ nse 666 remote-role sgsn
+! nse 666 encapsulation framerelay-gre
+! nse 666 remote-ip 172.16.1.70
+! nse 666 fr-dlci 666
+ timer tns-block 3
+ timer tns-block-retries 3
+ timer tns-reset 3
+ timer tns-reset-retries 3
+ timer tns-test 30
+ timer tns-alive 3
+ timer tns-alive-retries 10
+ encapsulation udp local-port 23000
+! encapsulation framerelay-gre enabled 1
+gbproxy
+ sgsn nsei 666
+ core-mobile-country-code 666
+ core-mobile-network-code 6
+ core-access-point-name none match-imsi ^666066|^66607
+ tlli-list max-length 200
diff --git a/openbsc/osmoappdesc.py b/openbsc/osmoappdesc.py
index 9d6fbe67..ddda6ab7 100644
--- a/openbsc/osmoappdesc.py
+++ b/openbsc/osmoappdesc.py
@@ -31,7 +31,8 @@ app_configs = {
"osmo-bsc": ["doc/examples/osmo-bsc/osmo-bsc.cfg"],
"nat": ["doc/examples/osmo-bsc_nat/osmo-bsc_nat.cfg"],
"mgcp": ["doc/examples/osmo-bsc_mgcp/mgcp.cfg"],
- "gbproxy": ["doc/examples/osmo-gbproxy/osmo-gbproxy.cfg"],
+ "gbproxy": ["doc/examples/osmo-gbproxy/osmo-gbproxy.cfg",
+ "doc/examples/osmo-gbproxy/osmo-gbproxy-legacy.cfg"],
"sgsn": ["doc/examples/osmo-sgsn/osmo-sgsn.cfg"],
"nitb": ["doc/examples/osmo-nitb/nanobts/openbsc-multitrx.cfg",
"doc/examples/osmo-nitb/nanobts/openbsc.cfg"]
diff --git a/openbsc/src/gprs/gb_proxy_vty.c b/openbsc/src/gprs/gb_proxy_vty.c
index de20e6ad..933b6b01 100644
--- a/openbsc/src/gprs/gb_proxy_vty.c
+++ b/openbsc/src/gprs/gb_proxy_vty.c
@@ -746,6 +746,55 @@ DEFUN(delete_gb_link, delete_gb_link_cmd,
return CMD_SUCCESS;
}
+/*
+ * legacy commands to provide an upgrade path from "broken" releases
+ * or pre-releases
+ */
+DEFUN_DEPRECATED(cfg_gbproxy_broken_apn_match,
+ cfg_gbproxy_broken_apn_match_cmd,
+ "core-access-point-name none match-imsi .REGEXP",
+ GBPROXY_CORE_APN_STR GBPROXY_MATCH_IMSI_STR "Remove APN\n"
+ "Patch MS related information elements on match only\n"
+ "Route to the secondary SGSN on match only\n"
+ "Regular expression for the IMSI match\n")
+{
+ const char *filter = argv[0];
+ const char *err_msg = NULL;
+ struct gbproxy_match *match;
+ enum gbproxy_match_id match_id = get_string_value(match_ids, "patching");
+
+ /* apply APN none */
+ set_core_apn(vty, "");
+
+ /* do the matching... with copy and paste */
+ OSMO_ASSERT(match_id >= GBPROX_MATCH_PATCHING &&
+ match_id < GBPROX_MATCH_LAST);
+ match = &g_cfg->matches[match_id];
+
+ if (gbproxy_set_patch_filter(match, filter, &err_msg) != 0) {
+ vty_out(vty, "Match expression invalid: %s%s",
+ err_msg, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ g_cfg->acquire_imsi = 1;
+
+ return CMD_SUCCESS;
+}
+
+#define GBPROXY_TLLI_LIST_STR "Set TLLI list parameters\n"
+#define GBPROXY_MAX_LEN_STR "Limit list length\n"
+DEFUN_DEPRECATED(cfg_gbproxy_depr_tlli_list_max_len,
+ cfg_gbproxy_depr_tlli_list_max_len_cmd,
+ "tlli-list max-length <1-99999>",
+ GBPROXY_TLLI_LIST_STR GBPROXY_MAX_LEN_STR
+ "Maximum number of TLLIs in the list\n")
+{
+ g_cfg->tlli_max_len = atoi(argv[0]);
+
+ return CMD_SUCCESS;
+}
+
int gbproxy_vty_init(void)
{
install_element_ve(&show_gbproxy_cmd);
@@ -780,6 +829,10 @@ int gbproxy_vty_init(void)
install_element(GBPROXY_NODE, &cfg_gbproxy_link_list_no_max_age_cmd);
install_element(GBPROXY_NODE, &cfg_gbproxy_link_list_no_max_len_cmd);
+ /* broken or deprecated to allow an upgrade path */
+ install_element(GBPROXY_NODE, &cfg_gbproxy_broken_apn_match_cmd);
+ install_element(GBPROXY_NODE, &cfg_gbproxy_depr_tlli_list_max_len_cmd);
+
return 0;
}