aboutsummaryrefslogtreecommitdiffstats
path: root/src/sccp_user.c
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2017-08-11 11:51:46 +0200
committerPhilipp Maier <pmaier@sysmocom.de>2017-08-11 11:54:12 +0200
commitd40d19d014fa34aa08ccdce3442e1c79db908477 (patch)
tree4fdaa129466ecaa62f4ce8dcdcd9948032930bde /src/sccp_user.c
parenteafa10dd17ea1090d6e712e286b065a74c2baecb (diff)
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
Diffstat (limited to 'src/sccp_user.c')
-rw-r--r--src/sccp_user.c16
1 files 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,