Attention is currently required from: laforge.
pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/42536?usp=email )
Change subject: m3ua: m3ua_gen_error_msg(): include Routing Context IE in cause Invalid Routing Context
......................................................................
Patch Set 2:
(1 comment)
Commit Message:
https://gerrit.osmocom.org/c/libosmo-sigtran/+/42536/comment/eae49cab_44c2a… :
PS2, Line 18: originated
> I don't think you can use "originated" this way in English. […]
that's a typo, I think I meant "identified" :)
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/42536?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: If821109701e315d17f5334c680670ea6c7bce3bd
Gerrit-Change-Number: 42536
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Tue, 31 Mar 2026 13:36:41 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/42530?usp=email )
Change subject: xua_asp_fsm: XUA_ASP_E_ASPTM_ASPAC: Validate RCTX AS is associated to ASP
......................................................................
xua_asp_fsm: XUA_ASP_E_ASPTM_ASPAC: Validate RCTX AS is associated to ASP
Previously we only validated that a local AS was configured for the
provided routing context, but we didn't validate that the AS was actually
associated to the requesting ASP.
Change-Id: Idcd51b9bbe38064ed03d076a76279384a3927334
---
M src/ss7_asp.c
M src/ss7_asp.h
M src/xua_asp_fsm.c
M tests/ss7/ss7_test.c
4 files changed, 21 insertions(+), 1 deletion(-)
Approvals:
osmith: Looks good to me, but someone else must approve
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
diff --git a/src/ss7_asp.c b/src/ss7_asp.c
index f83de19..ba3b95c 100644
--- a/src/ss7_asp.c
+++ b/src/ss7_asp.c
@@ -1578,6 +1578,21 @@
return _ss7_asp_get_all_rctx(asp, rctx, rctx_size, excl_as, false);
}
+/*! \brief Find Application Server associated to ASP by given routing context
+ * \param[in] asp Application Server Process through which to send
+ * \param[in] rctx Routing Context
+ * \returns pointer to Application Server on success; NULL otherwise */
+struct osmo_ss7_as *ss7_asp_find_as_by_rctx(const struct osmo_ss7_asp *asp, uint32_t rctx)
+{
+ struct ss7_as_asp_assoc *assoc;
+
+ llist_for_each_entry(assoc, &asp->assoc_as_list, asp_entry) {
+ if (assoc->as->cfg.routing_key.context == rctx)
+ return assoc->as;
+ }
+ return NULL;
+}
+
/* Get first AS in the ASP, or NULL if no AS associated.
* This is useful for instance in IPA code, where we assume only up to 1 AS is configured per ASP. */
struct osmo_ss7_as *ss7_asp_get_first_as(const struct osmo_ss7_asp *asp)
diff --git a/src/ss7_asp.h b/src/ss7_asp.h
index 834f910..6b8e974 100644
--- a/src/ss7_asp.h
+++ b/src/ss7_asp.h
@@ -198,6 +198,7 @@
const struct osmo_ss7_as *excl_as);
unsigned int ss7_asp_get_all_rctx_be(const struct osmo_ss7_asp *asp, uint32_t *rctx, unsigned int rctx_size,
const struct osmo_ss7_as *excl_as);
+struct osmo_ss7_as *ss7_asp_find_as_by_rctx(const struct osmo_ss7_asp *asp, uint32_t rctx);
struct osmo_ss7_as *ss7_asp_get_first_as(const struct osmo_ss7_asp *asp);
int ss7_asp_determine_traf_mode(const struct osmo_ss7_asp *asp);
diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c
index 5cb28fc..d627795 100644
--- a/src/xua_asp_fsm.c
+++ b/src/xua_asp_fsm.c
@@ -704,7 +704,7 @@
if ((part = xua_msg_find_tag(xua_in, M3UA_IEI_ROUTE_CTX))) {
for (i = 0; i < part->len / sizeof(uint32_t); i++) {
uint32_t rctx = osmo_load32be(&part->dat[i * sizeof(uint32_t)]);
- as = osmo_ss7_as_find_by_rctx(asp->inst, rctx);
+ as = ss7_asp_find_as_by_rctx(asp, rctx);
if (!as) {
LOGPFSML(fi, LOGL_NOTICE,
"ASPAC: Couldn't find any AS with rctx=%u. Check your config!\n",
diff --git a/tests/ss7/ss7_test.c b/tests/ss7/ss7_test.c
index 977f1f4..aec886f 100644
--- a/tests/ss7/ss7_test.c
+++ b/tests/ss7/ss7_test.c
@@ -289,7 +289,11 @@
OSMO_ASSERT(asp);
OSMO_ASSERT(osmo_ss7_as_has_asp(as, asp) == false);
+ OSMO_ASSERT(ss7_asp_find_as_by_rctx(asp, as->cfg.routing_key.context) == NULL);
+
OSMO_ASSERT(osmo_ss7_as_add_asp(as, "asp1") == 0);
+ OSMO_ASSERT(osmo_ss7_as_has_asp(as, asp) == true);
+ OSMO_ASSERT(ss7_asp_find_as_by_rctx(asp, as->cfg.routing_key.context) == as);
osmo_ss7_asp_restart(asp);
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/42530?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: Idcd51b9bbe38064ed03d076a76279384a3927334
Gerrit-Change-Number: 42530
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/42532?usp=email )
Change subject: xua_find_as_for_asp(): Optimize lookup
......................................................................
xua_find_as_for_asp(): Optimize lookup
Instead of looking up on all AS configured in an instance, look up on
the subset associated to the ASP we are looking up for.
Since we are also not looking a 2nd pass to then validate if ASP and
returned AS is related, in worst case this would split lookup complexity
by half.
Change-Id: If85ad27ad5e55be0c22e2716fa7329409a7b85b5
---
M src/xua_shared.c
1 file changed, 4 insertions(+), 11 deletions(-)
Approvals:
laforge: Looks good to me, but someone else must approve
osmith: Looks good to me, but someone else must approve
Jenkins Builder: Verified
pespin: Looks good to me, approved
diff --git a/src/xua_shared.c b/src/xua_shared.c
index 0fa94c4..51cbbf2 100644
--- a/src/xua_shared.c
+++ b/src/xua_shared.c
@@ -58,21 +58,14 @@
*as = NULL;
if (rctx_ie) {
- uint32_t rctx = xua_msg_part_get_u32(rctx_ie);
/* Use routing context IE to look up the AS for which the
* message was received. */
- *as = osmo_ss7_as_find_by_rctx(asp->inst, rctx);
+ uint32_t rctx = xua_msg_part_get_u32(rctx_ie);
+ *as = ss7_asp_find_as_by_rctx(asp, rctx);
if (!*as) {
- LOGPASP(asp, log_ss, LOGL_ERROR, "%s(): invalid routing context: %u\n",
- __func__, rctx);
- return M3UA_ERR_INVAL_ROUT_CTX;
- }
-
- /* Verify that this ASP is part of the AS. */
- if (!osmo_ss7_as_has_asp(*as, asp)) {
LOGPASP(asp, log_ss, LOGL_ERROR,
- "%s(): This Application Server Process is not part of the AS %s "
- "resolved by routing context %u\n", __func__, (*as)->cfg.name, rctx);
+ "%s(): This Application Server Process is not serving any AS with routing context: %u\n",
+ __func__, rctx);
return M3UA_ERR_NO_CONFGD_AS_FOR_ASP;
}
} else {
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/42532?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: If85ad27ad5e55be0c22e2716fa7329409a7b85b5
Gerrit-Change-Number: 42532
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/42533?usp=email )
Change subject: handle_rkey_dereg(): Optimize lookup
......................................................................
handle_rkey_dereg(): Optimize lookup
Instead of looking up on all AS configured in an instance, look up on
the subset associated to the ASP we are looking up for.
Since we are also not looking a 2nd pass to then validate if ASP and
returned AS is related, in worst case this would split lookup complexity
by half.
Change-Id: I56ac5caef9bcded9dd08ca532a413af94070a1bd
---
M src/xua_rkm.c
1 file changed, 1 insertion(+), 7 deletions(-)
Approvals:
pespin: Looks good to me, approved
laforge: Looks good to me, but someone else must approve
Jenkins Builder: Verified
osmith: Looks good to me, but someone else must approve
diff --git a/src/xua_rkm.c b/src/xua_rkm.c
index e9972b3..f3136e4 100644
--- a/src/xua_rkm.c
+++ b/src/xua_rkm.c
@@ -401,7 +401,7 @@
struct osmo_ss7_as *as;
struct osmo_ss7_route *rt;
- as = osmo_ss7_as_find_by_rctx(inst, rctx);
+ as = ss7_asp_find_as_by_rctx(asp, rctx);
if (!as) {
msgb_append_dereg_res(resp, M3UA_RKM_DEREG_ERR_INVAL_RCTX, 0);
return -1;
@@ -413,12 +413,6 @@
return -1;
}
- /* Reject if ASP is not even part of AS */
- if (!osmo_ss7_as_has_asp(as, asp)) {
- msgb_append_dereg_res(resp, M3UA_RKM_DEREG_ERR_INVAL_RCTX, 0);
- return -1;
- }
-
/* Reject if ASP is still active */
if (asp->fi->state == XUA_ASP_S_ACTIVE) {
msgb_append_dereg_res(resp, M3UA_RKM_DEREG_ERR_ASP_ACTIVE, 0);
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/42533?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I56ac5caef9bcded9dd08ca532a413af94070a1bd
Gerrit-Change-Number: 42533
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/42531?usp=email )
Change subject: xua_rkm: handle_rkey_reg(): Skip AS ilookup of known free RCTX
......................................................................
xua_rkm: handle_rkey_reg(): Skip AS ilookup of known free RCTX
There's no need to attempt a look up for an AS with a RCTX we just
ensured is not yet allocated to any AS.
Change-Id: I40719527c527db58244972a797c4287107306532
---
M src/xua_rkm.c
1 file changed, 12 insertions(+), 11 deletions(-)
Approvals:
pespin: Looks good to me, approved
laforge: Looks good to me, but someone else must approve
osmith: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/src/xua_rkm.c b/src/xua_rkm.c
index d6dfa51..e9972b3 100644
--- a/src/xua_rkm.c
+++ b/src/xua_rkm.c
@@ -171,7 +171,7 @@
{
uint32_t rk_id, rctx, _tmode, dpc;
enum osmo_ss7_as_traffic_mode tmode;
- struct osmo_ss7_as *as;
+ struct osmo_ss7_as *as = NULL;
struct ss7_as_asp_assoc *assoc;
struct osmo_ss7_route *rt;
char namebuf[32];
@@ -211,14 +211,6 @@
return -1;
}
- /* if the ASP did not include a routing context number, allocate
- * one locally (will be part of response) */
- if (!rctx)
- rctx = osmo_ss7_find_free_rctx(asp->inst);
-
- LOGPASP(asp, DLSS7, LOGL_INFO, "RKM: Registering routing key %u for DPC %s\n",
- rctx, osmo_ss7_pointcode_print(asp->inst, dpc));
-
/* We have two cases here:
* a) pre-configured routing context on both ASP and SG (or IPSP peers):
* We will find the AS based on the RCTX send by the client, check if
@@ -231,8 +223,17 @@
* all AS/RK in situations where the peers are trusted.
*/
- /* check if there is already an AS for this routing key */
- as = osmo_ss7_as_find_by_rctx(asp->inst, rctx);
+ if (rctx) {
+ /* check if there is already an AS for this routing key */
+ as = osmo_ss7_as_find_by_rctx(asp->inst, rctx);
+ } else {
+ /* if the ASP did not include a routing context number, allocate
+ * one locally (will be part of response) */
+ rctx = osmo_ss7_find_free_rctx(asp->inst);
+ }
+
+ LOGPASP(asp, DLSS7, LOGL_INFO, "RKM: Registering routing key %u for DPC %s\n",
+ rctx, osmo_ss7_pointcode_print(asp->inst, dpc));
if (!as && !asp->inst->cfg.permit_dyn_rkm_alloc) {
/* not permitted to create dynamic RKM entries */
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/42531?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I40719527c527db58244972a797c4287107306532
Gerrit-Change-Number: 42531
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>