aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2017-06-30 15:26:22 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-07-12 23:42:47 +0200
commit901b3bb13e39c8664762cd7a45b784595a3d3550 (patch)
tree16b5f63c90776f6ddd5f5bad4aaaf5e0616d3262
parent7155937e4e5512f5c213a228241e13db4315d315 (diff)
osmo-bsc: make sure only default SSNs are used
The VTY technically allows setting custom values for the SSN. However, SSN values and their purposes are well standardized. If the user has configured an SSN, check that is compliant to the standard. If not, warn and ignore the setting by using the stanard SSN. If the user left out the SSN, automatically use the standard SSN. Change-Id: Ib34fe0474f625b964dbfedfb4263fb0b5f976bdc
-rw-r--r--src/osmo-bsc/osmo_bsc_sigtran.c2
-rw-r--r--src/osmo-bsc/osmo_bsc_vty.c21
2 files changed, 21 insertions, 2 deletions
diff --git a/src/osmo-bsc/osmo_bsc_sigtran.c b/src/osmo-bsc/osmo_bsc_sigtran.c
index 0646a69a..b40177eb 100644
--- a/src/osmo-bsc/osmo_bsc_sigtran.c
+++ b/src/osmo-bsc/osmo_bsc_sigtran.c
@@ -427,7 +427,7 @@ int osmo_bsc_sigtran_init(struct llist_head *mscs)
osmo_sccp_simple_client(NULL, msc_name, msc->a.g_calling_addr.pc,
OSMO_SS7_ASP_PROT_M3UA, 0, NULL, M3UA_PORT, "127.0.0.1");
msc->a.sccp_user =
- osmo_sccp_user_bind(msc->a.sccp, msc_name, sccp_sap_up, SCCP_SSN_BSSAP);
+ osmo_sccp_user_bind(msc->a.sccp, msc_name, sccp_sap_up, msc->a.g_calling_addr.ssn);
/* Start MSC reset procedure */
msc->a.reset = a_reset_alloc(msc, msc_name, osmo_bsc_sigtran_reset_cb, msc);
diff --git a/src/osmo-bsc/osmo_bsc_vty.c b/src/osmo-bsc/osmo_bsc_vty.c
index 5d649104..17764e85 100644
--- a/src/osmo-bsc/osmo_bsc_vty.c
+++ b/src/osmo-bsc/osmo_bsc_vty.c
@@ -28,6 +28,7 @@
#include <osmocom/core/talloc.h>
#include <osmocom/vty/logging.h>
+#include <osmocom/sccp/sccp_types.h>
#include <time.h>
@@ -717,6 +718,21 @@ DEFUN(cfg_msc_cs7_instance,
return CMD_SUCCESS;
}
+/* Make sure only standard SSN numbers are used. If no ssn number is
+ * configured, silently apply the default SSN */
+static void enforce_standard_ssn(struct vty *vty, struct osmo_sccp_addr *addr)
+{
+ if (addr->presence & OSMO_SCCP_ADDR_T_SSN) {
+ if (addr->ssn != SCCP_SSN_BSSAP)
+ vty_out(vty,
+ "setting ssn different from the standard (%u) is not allowd!%s",
+ SCCP_SSN_BSSAP, VTY_NEWLINE);
+ }
+
+ addr->presence |= OSMO_SCCP_ADDR_T_SSN;
+ addr->ssn = SCCP_SSN_BSSAP;
+}
+
DEFUN(cfg_msc_cs7_calling_addr,
cfg_msc_cs7_calling_addr_cmd,
"calling-addr NAME",
@@ -739,8 +755,9 @@ DEFUN(cfg_msc_cs7_calling_addr,
return CMD_WARNING;
}
- memcpy(&msc->a.g_calling_addr, calling_addr, sizeof(*calling_addr));
+ enforce_standard_ssn(vty, calling_addr);
+ memcpy(&msc->a.g_calling_addr, calling_addr, sizeof(*calling_addr));
return CMD_SUCCESS;
}
@@ -766,6 +783,8 @@ DEFUN(cfg_msc_cs7_called_addr,
return CMD_WARNING;
}
+ enforce_standard_ssn(vty, called_addr);
+
memcpy(&msc->a.g_called_addr, called_addr, sizeof(*called_addr));
return CMD_SUCCESS;