daniel has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/41509?usp=email )
Change subject: Avoid removing ASP from all AS during osmo_ss7_as_del_asp() ......................................................................
Avoid removing ASP from all AS during osmo_ss7_as_del_asp()
The osmo_ss7_as_del_asp() -> tcap_asp_down() is weird. In practice it won't hurt because in IPA we only have 1 ASP per AS, per conceptually is wrong. In osmo_ss7_as_del_asp(), you remove ASP from AS. But there you call asp_down(), which actually removes the ASP from *all* its AS. So that asp_down() needs to be split and then inside osmo_ss7_as_del_asp() only remove the ASP from that specific AS.
Change-Id: I37093f5a2fae17a6ef117ac880436bb813bcb2b1 --- M src/ss7_as.c M src/ss7_as_loadshare_tcap.c M src/ss7_as_loadshare_tcap.h 3 files changed, 10 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/09/41509/1
diff --git a/src/ss7_as.c b/src/ss7_as.c index 5bca3f9..f15d6a5 100644 --- a/src/ss7_as.c +++ b/src/ss7_as.c @@ -228,7 +228,7 @@ }
#ifdef WITH_TCAP_LOADSHARING - tcap_asp_down(asp); + tcap_as_del_asp(as, asp); #endif /* WITH_TCAP_LOADSHARING */
for (i = 0; i < ARRAY_SIZE(as->cfg.asps); i++) { diff --git a/src/ss7_as_loadshare_tcap.c b/src/ss7_as_loadshare_tcap.c index ffff526..bdbfcea 100644 --- a/src/ss7_as_loadshare_tcap.c +++ b/src/ss7_as_loadshare_tcap.c @@ -932,6 +932,13 @@ } }
+void tcap_as_del_asp(struct osmo_ss7_as *as, struct osmo_ss7_asp *asp) +{ + _tcap_range_asp_down(as, asp); + if (as->tcap.contains_pc || as->tcap.contains_ssn) + tcap_range_as_update_pc_ssn(as); +} + /** Called when the ASP is going down or free'd * * @param[in] asp the asp which is going to be destroyed @@ -949,10 +956,7 @@ llist_for_each_entry(as, &inst->as_list, list) { if (!osmo_ss7_as_has_asp(as, asp)) continue; - - _tcap_range_asp_down(as, asp); - if (as->tcap.contains_pc || as->tcap.contains_ssn) - tcap_range_as_update_pc_ssn(as); + tcap_as_del_asp(as, asp); } }
diff --git a/src/ss7_as_loadshare_tcap.h b/src/ss7_as_loadshare_tcap.h index abba5b7..a939c82 100644 --- a/src/ss7_as_loadshare_tcap.h +++ b/src/ss7_as_loadshare_tcap.h @@ -36,6 +36,7 @@ int ss7_as_select_asp_loadshare_tcap(struct osmo_ss7_asp **asp, struct osmo_ss7_as *as, const struct xua_msg *xua);
/* When the ASP got removed */ +void tcap_as_del_asp(struct osmo_ss7_as *as, struct osmo_ss7_asp *asp); void tcap_asp_down(struct osmo_ss7_asp *asp);
void tcap_enable(struct osmo_ss7_as *as);