Attention is currently required from: pespin.
daniel has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/41511?usp=email )
Change subject: ss7_as_vty: Forbid configuring RKM-dynamically allocated AS
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/41511?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: Ia0c3ce39337de3a10ff0215ccec72c65fab13029
Gerrit-Change-Number: 41511
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 25 Nov 2025 19:41:05 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/41512?usp=email )
Change subject: Destroy rkm_dyn_allocated AS automatically when becoming out of ASPs
......................................................................
Destroy rkm_dyn_allocated AS automatically when becoming out of ASPs
This allows merging the freeing of AS inside the ASP/AS FSMs.
Change-Id: I743af584cd77924654d22ccf5d36d4479ba3b7f5
---
M src/ss7_as.c
M src/ss7_asp.c
M src/xua_asp_fsm.c
M src/xua_rkm.c
4 files changed, 40 insertions(+), 23 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/12/41512/1
diff --git a/src/ss7_as.c b/src/ss7_as.c
index cd6d66a..440385a 100644
--- a/src/ss7_as.c
+++ b/src/ss7_as.c
@@ -193,10 +193,13 @@
/*! \brief Delete given ASP from given AS
* \param[in] as Application Server from which \ref asp is deleted
* \param[in] asp Application Server Process to delete from \ref as
- * \returns 0 on success; negative in case of error */
+ * \returns 0 on success; negative in case of error
+ *
+ * \ref as may be freed during the function call. */
int ss7_as_del_asp(struct osmo_ss7_as *as, struct osmo_ss7_asp *asp)
{
unsigned int i;
+ bool found = false;
LOGPAS(as, DLSS7, LOGL_INFO, "Removing ASP %s from AS\n", asp->cfg.name);
@@ -211,11 +214,20 @@
for (i = 0; i < ARRAY_SIZE(as->cfg.asps); i++) {
if (as->cfg.asps[i] == asp) {
as->cfg.asps[i] = NULL;
- return 0;
+ found = true;
+ break;
}
}
- return -EINVAL;
+ /* RKM-dynamically allocated AS: If there are no other ASPs, destroy the AS.
+ * RFC 4666 4.4.2: "If a Deregistration results in no more ASPs in an
+ * Application Server, an SG MAY delete the Routing Key data."
+ */
+ if (as->rkm_dyn_allocated && osmo_ss7_as_count_asp(as) == 0)
+ osmo_ss7_as_destroy(as);
+
+
+ return found ? 0 : -EINVAL;
}
/*! \brief Delete given ASP from given AS
diff --git a/src/ss7_asp.c b/src/ss7_asp.c
index 377d9e4..076d91f 100644
--- a/src/ss7_asp.c
+++ b/src/ss7_asp.c
@@ -745,7 +745,7 @@
void osmo_ss7_asp_destroy(struct osmo_ss7_asp *asp)
{
- struct osmo_ss7_as *as;
+ struct osmo_ss7_as *as, *as2;
OSMO_ASSERT(ss7_initialized);
LOGPASP(asp, DLSS7, LOGL_INFO, "Destroying ASP\n");
@@ -757,8 +757,9 @@
if (asp->fi)
osmo_fsm_inst_term(asp->fi, OSMO_FSM_TERM_REQUEST, NULL);
- /* unlink from all ASs we are part of */
- llist_for_each_entry(as, &asp->inst->as_list, list)
+ /* Unlink from all ASs we are part of.
+ * Some RKM-dynamically allocated ASs may be freed as a result from this: */
+ llist_for_each_entry_safe(as, as2, &asp->inst->as_list, list)
ss7_as_del_asp(as, asp);
/* unlink from ss7_instance */
@@ -1351,9 +1352,6 @@
/* notify ASP FSM and everyone else */
osmo_fsm_inst_dispatch(asp->fi, XUA_ASP_E_SCTP_COMM_DOWN_IND, NULL);
- /* delete any RKM-dynamically allocated ASs for this ASP */
- xua_rkm_cleanup_dyn_as_for_asp(asp);
-
/* send M-SCTP_RELEASE.ind to Layer Manager */
xua_asp_send_xlm_prim_simple(asp, OSMO_XLM_PRIM_M_SCTP_RELEASE, PRIM_OP_INDICATION);
diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c
index 17071c3..d10420f 100644
--- a/src/xua_asp_fsm.c
+++ b/src/xua_asp_fsm.c
@@ -514,6 +514,13 @@
struct osmo_ss7_asp *asp = xafp->asp;
xua_t_beat_stop(fi);
dispatch_to_all_as(fi, XUA_ASPAS_ASP_DOWN_IND, asp);
+ /* RFC 4666 4.4.2: "An ASP SHOULD deregister from all Application Servers of which it is a
+ * member before attempting to move to the ASP-Down state [...]
+ * If a Deregistration results in no more ASPs in an Application Server, an SG MAY delete
+ * the Routing Key data."
+ * In case it didn't deregsitrer explicitly, make sure to implicitly deregister it:
+ */
+ xua_rkm_cleanup_dyn_as_for_asp(asp);
}
static void xua_asp_fsm_down(struct osmo_fsm_inst *fi, uint32_t event, void *data)
@@ -1101,6 +1108,13 @@
struct osmo_ss7_asp *asp = xafp->asp;
ipa_t_beat_stop(fi);
dispatch_to_all_as(fi, XUA_ASPAS_ASP_DOWN_IND, asp);
+ /* RFC 4666 4.4.2: "An ASP SHOULD deregister from all Application Servers of which it is a
+ * member before attempting to move to the ASP-Down state [...]
+ * If a Deregistration results in no more ASPs in an Application Server, an SG MAY delete
+ * the Routing Key data."
+ * In case it didn't deregsitrer explicitly, make sure to implicitly deregister it:
+ */
+ xua_rkm_cleanup_dyn_as_for_asp(asp);
}
static void ipa_asp_fsm_down(struct osmo_fsm_inst *fi, uint32_t event, void *data)
diff --git a/src/xua_rkm.c b/src/xua_rkm.c
index d88fda7..c68eb99 100644
--- a/src/xua_rkm.c
+++ b/src/xua_rkm.c
@@ -422,15 +422,11 @@
LOGPASP(asp, DLSS7, LOGL_INFO, "RKM: De-Registering rctx %u for DPC %s\n",
rctx, osmo_ss7_pointcode_print(inst, as->cfg.routing_key.pc));
- /* remove ASP from AS */
- ss7_as_del_asp(as, asp);
- /* FIXME: Rather than spoofing teh ASP-DOWN.ind to the AS here,
- * we should refuse RKM DEREG if the ASP is still ACTIVE */
- osmo_fsm_inst_dispatch(as->fi, XUA_ASPAS_ASP_DOWN_IND, asp);
-
- /* Release the associated route and destroy the dynamically allocated AS */
+ /* Release the associated route */
ss7_route_destroy(rt);
- osmo_ss7_as_destroy(as);
+ /* Dissassociate the ASP from the dynamically allocated AS AS.
+ * The AS may be freed if it is serving no more ASPs. */
+ ss7_as_del_asp(as, asp);
/* report success */
msgb_append_dereg_res(resp, M3UA_RKM_DEREG_SUCCESS, rctx);
@@ -635,13 +631,10 @@
struct osmo_ss7_as *as, *as2;
llist_for_each_entry_safe(as, as2, &inst->as_list, list) {
- if (!osmo_ss7_as_has_asp(as, asp))
- continue;
if (!as->rkm_dyn_allocated)
continue;
-
- /* If there are no other ASPs, destroy the AS: */
- if (osmo_ss7_as_count_asp(as) == 1)
- osmo_ss7_as_destroy(as);
+ if (!osmo_ss7_as_has_asp(as, asp))
+ continue;
+ ss7_as_del_asp(as, asp);
}
}
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/41512?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I743af584cd77924654d22ccf5d36d4479ba3b7f5
Gerrit-Change-Number: 41512
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Attention is currently required from: laforge, lynxis lazus, pespin.
daniel has uploaded a new patch set (#11) to the change originally created by lynxis lazus. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/41309?usp=email )
The following approvals got outdated and were removed:
Verified-1 by Jenkins Builder
Change subject: Add TCAP based loadsharing/routing
......................................................................
Add TCAP based loadsharing/routing
TCAP based loadsharing will share the load based on the TCAP oTID and
dTID.
Because TCAP are session based, a TCAP session based tracking is implemented,
to allow following traffic to forwarded to the same ASP.
This TCAP session tracking is similar to IP connection tracking.
ASPs within an AS can use the new IPA TCAP ROUTING protocol to register
for specific TCAP ranges.
TCAP sessions initiated by a peer (traffic towards such loadsharing AS/ASP),
will use the oTID of the `TCAP Begin` to loadshare and select a ASP.
Further if the TCAP session was initiated by a `loadshared` ASP, the oTID
will be added to the session tracking.
Co-authored-by: Harald Welte <laforge(a)osmocom.org>
Co-authored-by: Daniel Willmann <dwillmann(a)sysmocom.de>
Related: SYS#5423
Change-Id: Ibcb48aa0e515ad346f59ddd84b24c6e2c026144d
---
M configure.ac
M src/Makefile.am
M src/ipa.c
M src/ss7_as.c
M src/ss7_as.h
A src/ss7_as_loadshare_tcap.c
A src/ss7_as_loadshare_tcap.h
M src/ss7_as_vty.c
M src/ss7_asp.c
M src/ss7_asp.h
A src/tcap_transaction_tracking.c
A src/tcap_transaction_tracking.h
M tests/Makefile.am
A tests/tcap/Makefile.am
A tests/tcap/tcap_transaction_tracking_test.c
A tests/tcap/tcap_transaction_tracking_test.ok
M tests/testsuite.at
M tests/vty/Makefile.am
M tests/vty/osmo_stp_test.vty
A tests/vty/osmo_stp_test_tcap.vty
20 files changed, 2,190 insertions(+), 6 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/09/41309/11
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/41309?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: Ibcb48aa0e515ad346f59ddd84b24c6e2c026144d
Gerrit-Change-Number: 41309
Gerrit-PatchSet: 11
Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: daniel <dwillmann(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu>
Attention is currently required from: daniel, lynxis lazus.
daniel has uploaded a new patch set (#11) to the change originally created by lynxis lazus. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/41311?usp=email )
The following approvals got outdated and were removed:
Verified-1 by Jenkins Builder
Change subject: Add VTY command to list TCAP ranges for an AS
......................................................................
Add VTY command to list TCAP ranges for an AS
Show the list of all tcap ranges and ASP for an AS:
OsmoSTP# show cs7 instance 0 as name as-ipa-loadshare-0 tcap-ranges
Tid Min Tid Max SSN PC ASP Name
------- ------- --- ------------- ------------
300 599 0 (no PC) asp-ipa-loadshare-0-1
0 299 0 (no PC) asp-ipa-loadshare-0-0
Show the tcap range and ASP for specific TCAP Id:
OsmoSTP# show cs7 instance 0 as name as-ipa-loadshare-0 tcap-ranges tid 15
Tid Min Tid Max SSN PC ASP Name
------- ------- --- ------------- ------------
0 299 0 (no PC) asp-ipa-loadshare-0-0
Related: SYS#5423
Change-Id: I8026248d9897aadab5bf13a425269ec1e948dfdf
---
M src/Makefile.am
A src/ss7_as_loadshare_tcap_vty.c
A src/ss7_as_loadshare_tcap_vty.h
M src/ss7_vty.c
M tests/vty/osmo_stp_test.vty
5 files changed, 151 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/11/41311/11
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/41311?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I8026248d9897aadab5bf13a425269ec1e948dfdf
Gerrit-Change-Number: 41311
Gerrit-PatchSet: 11
Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: daniel <dwillmann(a)sysmocom.de>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: daniel <dwillmann(a)sysmocom.de>
Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu>
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);
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/41509?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I37093f5a2fae17a6ef117ac880436bb813bcb2b1
Gerrit-Change-Number: 41509
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <dwillmann(a)sysmocom.de>
Gerrit-CC: pespin <pespin(a)sysmocom.de>