pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-bsc/+/38650?usp=email )
Change subject: Use new libosmo-sigtran API osmo_ss7_instance_get_id()
......................................................................
Use new libosmo-sigtran API osmo_ss7_instance_get_id()
Depends: libosmo-sigtran.git Change-IdChange-Id Id7b6f23a1a223fb232238b624eb4f3295790bcb1
Change-Id: Ic0a468de0e8852ddd1ebd99f25a6400475af9a1f
---
M TODO-RELEASE
M src/osmo-bsc/bsc_vty.c
M src/osmo-bsc/lb.c
M src/osmo-bsc/osmo_bsc_sigtran.c
4 files changed, 27 insertions(+), 19 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/50/38650/1
diff --git a/TODO-RELEASE b/TODO-RELEASE
index c073b60..b5cd5cc 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -7,4 +7,4 @@
# If any interfaces have been added since the last public release: c:r:a + 1.
# If any interfaces have been removed or changed since the last public release: c:r:0.
#library what description / commit summary line
-libosmo-sigtran >2.0.1 Use API osmo_ss7_route_get_dest_as()
\ No newline at end of file
+libosmo-sigtran >2.0.1 Use API osmo_ss7_route_get_dest_as(),
osmo_ss7_instance_get_id()
diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index 777807b..98a7792 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -2967,16 +2967,18 @@
struct bsc_msc_data *msc = bsc_msc_data(vty);
const char *bsc_addr_name = argv[0];
struct osmo_ss7_instance *ss7;
+ uint32_t ss7_id;
ss7 = osmo_sccp_addr_by_name(&msc->a.bsc_addr, bsc_addr_name);
if (!ss7) {
vty_out(vty, "Error: No such SCCP addressbook entry: '%s'%s",
bsc_addr_name, VTY_NEWLINE);
return CMD_ERR_INCOMPLETE;
}
+ ss7_id = osmo_ss7_instance_get_id(ss7);
/* Prevent mixing addresses from different CS7/SS7 instances */
if (msc->a.cs7_instance_valid) {
- if (msc->a.cs7_instance != ss7->cfg.id) {
+ if (msc->a.cs7_instance != ss7_id) {
vty_out(vty,
"Error: SCCP addressbook entry from mismatching CS7 instance:
'%s'%s",
bsc_addr_name, VTY_NEWLINE);
@@ -2984,7 +2986,7 @@
}
}
- msc->a.cs7_instance = ss7->cfg.id;
+ msc->a.cs7_instance = ss7_id;
msc->a.cs7_instance_valid = true;
enforce_standard_ssn(vty, &msc->a.bsc_addr);
msc->a.bsc_addr_name = talloc_strdup(msc, bsc_addr_name);
@@ -2999,16 +3001,18 @@
struct bsc_msc_data *msc = bsc_msc_data(vty);
const char *msc_addr_name = argv[0];
struct osmo_ss7_instance *ss7;
+ uint32_t ss7_id;
ss7 = osmo_sccp_addr_by_name(&msc->a.msc_addr, msc_addr_name);
if (!ss7) {
vty_out(vty, "Error: No such SCCP addressbook entry: '%s'%s",
msc_addr_name, VTY_NEWLINE);
return CMD_ERR_INCOMPLETE;
}
+ ss7_id = osmo_ss7_instance_get_id(ss7);
/* Prevent mixing addresses from different CS7/SS7 instances */
if (msc->a.cs7_instance_valid) {
- if (msc->a.cs7_instance != ss7->cfg.id) {
+ if (msc->a.cs7_instance != ss7_id) {
vty_out(vty,
"Error: SCCP addressbook entry from mismatching CS7 instance:
'%s'%s",
msc_addr_name, VTY_NEWLINE);
@@ -3016,7 +3020,7 @@
}
}
- msc->a.cs7_instance = ss7->cfg.id;
+ msc->a.cs7_instance = ss7_id;
msc->a.cs7_instance_valid = true;
enforce_standard_ssn(vty, &msc->a.msc_addr);
msc->a.msc_addr_name = talloc_strdup(msc, msc_addr_name);
diff --git a/src/osmo-bsc/lb.c b/src/osmo-bsc/lb.c
index 6743dba..d4f645a 100644
--- a/src/osmo-bsc/lb.c
+++ b/src/osmo-bsc/lb.c
@@ -618,18 +618,20 @@
bool smlc_set_cs7_instance(struct vty *vty, const char *from_vty_cmd, const char
*from_addr,
struct osmo_ss7_instance *ss7)
{
+ uint32_t ss7_id = osmo_ss7_instance_get_id(ss7);
+
if (bsc_gsmnet->smlc->cs7_instance_valid) {
- if (bsc_gsmnet->smlc->cs7_instance != ss7->cfg.id) {
+ if (bsc_gsmnet->smlc->cs7_instance != ss7_id) {
LOGP(DLCS, LOGL_ERROR,
"%s: expecting address from cs7 instance %u, but '%s' is from
%u\n",
- from_vty_cmd, bsc_gsmnet->smlc->cs7_instance, from_addr, ss7->cfg.id);
+ from_vty_cmd, bsc_gsmnet->smlc->cs7_instance, from_addr, ss7_id);
vty_out(vty, "Error:"
" %s: expecting address from cs7 instance %u, but '%s' is from
%u%s",
- from_vty_cmd, bsc_gsmnet->smlc->cs7_instance, from_addr, ss7->cfg.id,
VTY_NEWLINE);
+ from_vty_cmd, bsc_gsmnet->smlc->cs7_instance, from_addr, ss7_id, VTY_NEWLINE);
return false;
}
} else {
- bsc_gsmnet->smlc->cs7_instance = ss7->cfg.id;
+ bsc_gsmnet->smlc->cs7_instance = ss7_id;
bsc_gsmnet->smlc->cs7_instance_valid = true;
LOGP(DLCS, LOGL_NOTICE, "Lb interface is using cs7 instance %u\n",
bsc_gsmnet->smlc->cs7_instance);
}
diff --git a/src/osmo-bsc/osmo_bsc_sigtran.c b/src/osmo-bsc/osmo_bsc_sigtran.c
index cdc5785..66d38bf 100644
--- a/src/osmo-bsc/osmo_bsc_sigtran.c
+++ b/src/osmo-bsc/osmo_bsc_sigtran.c
@@ -113,8 +113,9 @@
static struct bsc_msc_data *get_msc_by_pc(struct osmo_ss7_instance *cs7, uint32_t pc)
{
struct bsc_msc_data *msc;
+ uint32_t cs7_id = osmo_ss7_instance_get_id(cs7);
llist_for_each_entry(msc, msc_list, entry) {
- if (msc->a.cs7_instance != cs7->cfg.id)
+ if (msc->a.cs7_instance != cs7_id)
continue;
if ((msc->a.msc_addr.presence & OSMO_SCCP_ADDR_T_PC) == 0)
continue;
@@ -618,14 +619,15 @@
char inst_name[32];
enum osmo_ss7_asp_protocol used_proto = OSMO_SS7_ASP_PROT_NONE;
int prev_msc_nr;
+ uint32_t inst_id = osmo_ss7_instance_get_id(inst);
struct osmo_sccp_instance *sccp;
struct bsc_sccp_inst *bsc_sccp;
llist_for_each_entry(msc, msc_list, entry) {
/* An MSC with invalid cs7 instance id defaults to cs7 instance 0 */
- if ((inst->cfg.id != msc->a.cs7_instance)
- && !(inst->cfg.id == 0 && !msc->a.cs7_instance_valid))
+ if ((inst_id != msc->a.cs7_instance)
+ && !(inst_id == 0 && !msc->a.cs7_instance_valid))
continue;
/* This msc runs on this cs7 inst. Check the asp_proto. */
@@ -636,7 +638,7 @@
prev_msc_nr, msc->nr,
osmo_ss7_asp_protocol_name(used_proto),
osmo_ss7_asp_protocol_name(msc->a.asp_proto),
- inst->cfg.id);
+ inst_id);
return -EINVAL;
}
@@ -647,17 +649,17 @@
if (used_proto == OSMO_SS7_ASP_PROT_NONE) {
/* This instance has no MSC associated with it */
- LOGP(DMSC, LOGL_ERROR, "cs7 instance %u has no MSCs configured to run on
it\n", inst->cfg.id);
+ LOGP(DMSC, LOGL_ERROR, "cs7 instance %u has no MSCs configured to run on
it\n", inst_id);
continue;
}
- snprintf(inst_name, sizeof(inst_name), "A-%u-%s", inst->cfg.id,
osmo_ss7_asp_protocol_name(used_proto));
+ snprintf(inst_name, sizeof(inst_name), "A-%u-%s", inst_id,
osmo_ss7_asp_protocol_name(used_proto));
LOGP(DMSC, LOGL_NOTICE, "Initializing SCCP connection for A/%s on cs7 instance
%u\n",
- osmo_ss7_asp_protocol_name(used_proto), inst->cfg.id);
+ osmo_ss7_asp_protocol_name(used_proto), inst_id);
/* SS7 Protocol stack */
default_pc = osmo_ss7_pointcode_parse(NULL, BSC_DEFAULT_PC);
- sccp = osmo_sccp_simple_client_on_ss7_id(tall_bsc_ctx, inst->cfg.id, inst_name,
+ sccp = osmo_sccp_simple_client_on_ss7_id(tall_bsc_ctx, inst_id, inst_name,
default_pc, used_proto,
0, DEFAULT_ASP_LOCAL_IP,
0, DEFAULT_ASP_REMOTE_IP);
@@ -673,8 +675,8 @@
char msc_name[32];
/* Skip MSCs that don't run on this cs7 instance */
- if ((inst->cfg.id != msc->a.cs7_instance)
- && !(inst->cfg.id == 0 && !msc->a.cs7_instance_valid))
+ if ((inst_id != msc->a.cs7_instance)
+ && !(inst_id == 0 && !msc->a.cs7_instance_valid))
continue;
snprintf(msc_name, sizeof(msc_name), "msc-%d", msc->nr);
--
To view, visit
https://gerrit.osmocom.org/c/osmo-bsc/+/38650?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ic0a468de0e8852ddd1ebd99f25a6400475af9a1f
Gerrit-Change-Number: 38650
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>