aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2017-06-30 16:04:13 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-07-25 01:06:59 +0200
commit15886b47efdbc8e30cc4a66d031b033e92bb5c5e (patch)
tree144d5c0577d05c4dcbc243dfe1ec3e35918ccb48
parent0c22af911fad4bb7aeda80c8aa2410a70db1a9d5 (diff)
osmo-bsc: check configured sccp addresses before start
do not start unless the user has configured sufficient SCCP addresses via VTY. Do not accept address that lack point codes or ssn Change-Id: I42b4fb0ef93dec225e220e88e1b92664b9b55be3
-rw-r--r--src/osmo-bsc/osmo_bsc_sigtran.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/osmo-bsc/osmo_bsc_sigtran.c b/src/osmo-bsc/osmo_bsc_sigtran.c
index b40177eb8..62f151dd6 100644
--- a/src/osmo-bsc/osmo_bsc_sigtran.c
+++ b/src/osmo-bsc/osmo_bsc_sigtran.c
@@ -405,6 +405,17 @@ static void osmo_bsc_sigtran_reset_cb(void *priv)
osmo_bsc_sigtran_tx_reset(msc);
}
+/* Check if a given sccp address fulfills minimum requirements */
+static int test_addr(struct osmo_sccp_addr *addr)
+{
+ if (!(addr->presence & OSMO_SCCP_ADDR_T_SSN))
+ return -EINVAL;
+ if (!(addr->presence & OSMO_SCCP_ADDR_T_PC))
+ return -EINVAL;
+
+ return 0;
+}
+
/* Initalize osmo sigtran backhaul */
int osmo_bsc_sigtran_init(struct llist_head *mscs)
{
@@ -422,12 +433,23 @@ int osmo_bsc_sigtran_init(struct llist_head *mscs)
snprintf(msc_name, sizeof(msc_name), "MSC No.: %u", msc->nr);
LOGP(DMSC, LOGL_NOTICE, "Initalizing SCCP connection to %s\n", msc_name);
+ /* Check if the sccp-address */
+ if (test_addr(&msc->a.g_calling_addr) < 0) {
+ LOGP(DMSC, LOGL_ERROR,
+ "Insufficient local address (calling-address) configuration, check VTY-Config\n");
+ return -EINVAL;
+ }
+ if (test_addr(&msc->a.g_called_addr) < 0) {
+ LOGP(DMSC, LOGL_ERROR,
+ "Insufficient remote address (called-address) configuration, check VTY-Config\n");
+ return -EINVAL;
+ }
+
/* SCCP Protocol stack */
msc->a.sccp =
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, msc->a.g_calling_addr.ssn);
+ msc->a.sccp_user = 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);