aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-10-08 13:37:28 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-10-09 18:14:09 +0200
commitcc8856f9d3671cc64adc611677f1d3f5feff7bbd (patch)
tree8e49fe3fd5cd1479f1a63e81dd3929975e136458
parent49389178cc6059f4e80f30dda2192560e580b29d (diff)
gbproxy: Refuse to configure conflicting NSEIs
Currently it is possible to set the secondary SGSN NSEI to the same value like the (primary) SGSN NSEI. This leads to undefined behaviour and is hard to recognize. This patch adds checks to either NSEI configuration command to refuse conflicting values. Ticket: OW#1306 Sponsored-by: On-Waves ehf
-rw-r--r--openbsc/src/gprs/gb_proxy_vty.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/openbsc/src/gprs/gb_proxy_vty.c b/openbsc/src/gprs/gb_proxy_vty.c
index eb7eb600a..8a7523c4e 100644
--- a/openbsc/src/gprs/gb_proxy_vty.c
+++ b/openbsc/src/gprs/gb_proxy_vty.c
@@ -150,9 +150,15 @@ DEFUN(cfg_nsip_sgsn_nsei,
"NSEI to be used in the connection with the SGSN\n"
"The NSEI\n")
{
- unsigned int port = atoi(argv[0]);
+ unsigned int nsei = atoi(argv[0]);
- g_cfg->nsip_sgsn_nsei = port;
+ if (g_cfg->route_to_sgsn2 && g_cfg->nsip_sgsn2_nsei == nsei) {
+ vty_out(vty, "SGSN NSEI %d conflicts with secondary SGSN NSEI%s",
+ nsei, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ g_cfg->nsip_sgsn_nsei = nsei;
return CMD_SUCCESS;
}
@@ -359,8 +365,16 @@ DEFUN(cfg_gbproxy_secondary_sgsn,
"NSEI to be used in the connection with the SGSN\n"
"The NSEI\n")
{
+ unsigned int nsei = atoi(argv[0]);
+
+ if (g_cfg->nsip_sgsn_nsei == nsei) {
+ vty_out(vty, "Secondary SGSN NSEI %d conflicts with primary SGSN NSEI%s",
+ nsei, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
g_cfg->route_to_sgsn2 = 1;
- g_cfg->nsip_sgsn2_nsei = atoi(argv[0]);
+ g_cfg->nsip_sgsn2_nsei = nsei;
g_cfg->patch_ptmsi = 1;