From d40d19d014fa34aa08ccdce3442e1c79db908477 Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Fri, 11 Aug 2017 11:51:46 +0200 Subject: sccp: check for valid point code in osmo_sccp_simple_client() The point-code is not checked in the beginning, only the ASP checks the point code at a very late stage and fails in case an invalid point-code is detected. Remove the check in the ASP creation. Add a new check after the SS7 initalization that checks the point-code. If none is set, the default point-code will be used. Change-Id: I334d90e769bd9952f67c51b12a945f22bd268fa8 --- src/sccp_user.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/sccp_user.c b/src/sccp_user.c index 4e28aa0..387061c 100644 --- a/src/sccp_user.c +++ b/src/sccp_user.c @@ -342,6 +342,16 @@ osmo_sccp_simple_client_on_ss7_id(void *ctx, uint32_t ss7_id, const char *name, ss7->cfg.primary_pc = default_pc; ss7_created = true; } + + /* In case no valid point-code has been configured via the VTY, we + * will fall back to the default pointcode. */ + if (!osmo_ss7_pc_is_valid(ss7->cfg.primary_pc)) { + LOGP(DLSCCP, LOGL_ERROR, + "SS7 instance %u: no primary point-code set, using default point-code\n", + ss7->cfg.id); + ss7->cfg.primary_pc = default_pc; + } + LOGP(DLSCCP, LOGL_NOTICE, "%s: Using SS7 instance %u, pc:%s\n", name, ss7->cfg.id, osmo_ss7_pointcode_print(ss7, ss7->cfg.primary_pc)); @@ -364,12 +374,6 @@ osmo_sccp_simple_client_on_ss7_id(void *ctx, uint32_t ss7_id, const char *name, if (!as) goto out_ss7; as_created = true; - - if (!osmo_ss7_pc_is_valid(ss7->cfg.primary_pc)) { - LOGP(DLSCCP, LOGL_ERROR, "SS7 instance %u: no primary point-code set\n", - ss7->cfg.id); - goto out_ss7; - } as->cfg.routing_key.pc = ss7->cfg.primary_pc; } LOGP(DLSCCP, LOGL_NOTICE, "%s: Using AS instance %s\n", name, -- cgit v1.2.3