aboutsummaryrefslogtreecommitdiffstats
path: root/src/sccp_scrc.c
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-07-26 17:31:53 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-08-09 13:54:44 +0200
commitb352ca030d8870930493f36e2b3702760ff4b44a (patch)
tree2fb212147568c0070a474712d1a19d228e50d729 /src/sccp_scrc.c
parentb711e1450444c5882a8d9a941094183484fa47db (diff)
ensure valid primary_pc in osmo_ss7_instance
Initialize osmo_ss7_instance.cfg.primary_pc = OSMO_SS7_PC_INVALID. Adjust all code paths using primary_pc to ensure it is indeed valid. Rationale: It looks like we are going to use the primary point-code of an SS7 instance to derive a local SCCP address, e.g. for osmo-bsc and osmo-hnbgw. cs7-instance 1 point-code 1.2.3 ! sets osmo_ss7_instance.primary_pc = 1.2.3 sccp-address msc point-code 0.0.1 routing-indicator PC hnb iucs remote-addr msc ! derives cs7 instance 1 and local pc 1.2.3 If 'point-code 1.2.3' is omitted, this becomes '0.0.0' without the user noticing, and this happens for each client that omits it. I would like to barf when no local PC is set. Change-Id: I7f0f0c89b7335d9da24161bfac8234be214ca00c
Diffstat (limited to 'src/sccp_scrc.c')
-rw-r--r--src/sccp_scrc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/sccp_scrc.c b/src/sccp_scrc.c
index e44201a..2afd696 100644
--- a/src/sccp_scrc.c
+++ b/src/sccp_scrc.c
@@ -91,8 +91,14 @@ static int sua2sccp_tx_m3ua(struct osmo_sccp_instance *inst,
param = &omp->u.transfer;
if (sua->mtp.opc)
param->opc = sua->mtp.opc;
- else
+ else {
+ if (!osmo_ss7_pc_is_valid(s7i->cfg.primary_pc)) {
+ LOGP(DLSCCP, LOGL_ERROR, "SS7 instance %u: no primary point-code set\n",
+ s7i->cfg.id);
+ return -1;
+ }
param->opc = s7i->cfg.primary_pc;
+ }
param->dpc = remote_pc;
param->sls = sua->mtp.sls;
param->sio = MTP_SIO(MTP_SI_SCCP, s7i->cfg.network_indicator);