diff options
author | Philipp Maier <pmaier@sysmocom.de> | 2017-06-30 16:04:13 +0200 |
---|---|---|
committer | Philipp Maier <pmaier@sysmocom.de> | 2017-06-30 16:04:13 +0200 |
commit | 5ee15066de7b6b24820653ad5e2de04f60f55e00 (patch) | |
tree | fdc4796cf9f590b63a275fdcadabfa8990a0c3b8 | |
parent | 6b62babe5848981bd41db7377646ee390b7b953d (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
-rw-r--r-- | openbsc/src/osmo-bsc/osmo_bsc_sigtran.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_sigtran.c b/openbsc/src/osmo-bsc/osmo_bsc_sigtran.c index b40177eb8..62f151dd6 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_sigtran.c +++ b/openbsc/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); |