lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

March 2026

  • 1 participants
  • 1933 discussions
[L] Change in libosmo-sigtran[master]: Move xUA<->LM SAP logic to its own file
by pespin 31 Mar '26

31 Mar '26
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/42561?usp=email ) Change subject: Move xUA<->LM SAP logic to its own file ...................................................................... Move xUA<->LM SAP logic to its own file Right now it's difficult to gasp what's implemented of the SAP since it was scattered around several places. Put all the SAP forwarding logic into its own file so it's easy to follow and extend (eg. adding new helper functions, etc.) Change-Id: I93d74dd7f6ea8f2e60a8bc41be15362e433e8962 --- M src/Makefile.am M src/m3ua.c M src/ss7_asp.c M src/ss7_xua_srv.c M src/xua_asp_fsm.c M src/xua_default_lm_fsm.c M src/xua_internal.h A src/xua_lm_sap.c A src/xua_lm_sap.h M src/xua_rkm.c 10 files changed, 206 insertions(+), 98 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/61/42561/1 diff --git a/src/Makefile.am b/src/Makefile.am index 2ef226f..d8b42f9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -30,6 +30,7 @@ tcap_trans_tracking.h \ xua_asp_fsm.h \ xua_as_fsm.h \ + xua_lm_sap.h \ xua_internal.h \ xua_msg.h \ xua_types.h \ @@ -92,6 +93,7 @@ xua_asp_fsm.c \ xua_as_fsm.c \ xua_default_lm_fsm.c \ + xua_lm_sap.c \ xua_msg.c \ xua_rkm.c \ xua_shared.c \ diff --git a/src/m3ua.c b/src/m3ua.c index d982eeb..2dd8dfb 100644 --- a/src/m3ua.c +++ b/src/m3ua.c @@ -49,6 +49,7 @@ #include "ss7_asp.h" #include "ss7_internal.h" #include "xua_msg.h" +#include "xua_lm_sap.h" #define M3UA_MSGB_SIZE 1500 @@ -700,8 +701,7 @@ xua_msg_dump(xua, &xua_dialect_m3ua)); /* report this to layer manager */ - prim = xua_xlm_prim_alloc(OSMO_XLM_PRIM_M_ERROR, PRIM_OP_INDICATION); - prim->u.error.code = err_code; + prim = xua_xlm_prim_alloc_m_error_ind(err_code); xua_asp_send_xlm_prim(asp, prim); /* NEVER return != 0 here, as we cannot respont to an ERR @@ -724,9 +724,8 @@ ntfy.info_string ? ntfy.info_string : ""); /* report this to layer manager */ - prim = xua_xlm_prim_alloc(OSMO_XLM_PRIM_M_NOTIFY, PRIM_OP_INDICATION); - prim->u.notify = ntfy; - xua_asp_send_xlm_prim(asp,prim); + prim = xua_xlm_prim_alloc_m_notify_ind(&ntfy); + xua_asp_send_xlm_prim(asp, prim); if (ntfy.info_string) talloc_free(ntfy.info_string); diff --git a/src/ss7_asp.c b/src/ss7_asp.c index 23a9b66..b33187c 100644 --- a/src/ss7_asp.c +++ b/src/ss7_asp.c @@ -59,6 +59,7 @@ #include "ss7_xua_srv.h" #include "xua_asp_fsm.h" #include "xua_as_fsm.h" +#include "xua_lm_sap.h" static int _setsockopt_peer_primary_addr(int fd, const struct osmo_sockaddr *saddr) { @@ -1655,30 +1656,3 @@ } return true; } - -/* process a primitive from the xUA Layer Manager (LM) */ -int osmo_xlm_sap_down(struct osmo_ss7_asp *asp, struct osmo_prim_hdr *oph) -{ - struct osmo_xlm_prim *prim = (struct osmo_xlm_prim *) oph; - - LOGPASP(asp, DLSS7, LOGL_DEBUG, "Received XUA Layer Manager Primitive: %s)\n", - osmo_xlm_prim_name(&prim->oph)); - - switch (OSMO_PRIM_HDR(&prim->oph)) { - case OSMO_PRIM(OSMO_XLM_PRIM_M_RK_REG, PRIM_OP_REQUEST): - /* Layer Manager asks us to send a Routing Key Reg Request */ - xua_rkm_send_reg_req(asp, &prim->u.rk_reg.key, prim->u.rk_reg.traf_mode); - break; - case OSMO_PRIM(OSMO_XLM_PRIM_M_RK_DEREG, PRIM_OP_REQUEST): - /* Layer Manager asks us to send a Routing Key De-Reg Request */ - xua_rkm_send_dereg_req(asp, prim->u.rk_dereg.route_ctx); - break; - default: - LOGPASP(asp, DLSS7, LOGL_ERROR, "Unknown XUA Layer Manager Primitive: %s\n", - osmo_xlm_prim_name(&prim->oph)); - break; - } - - msgb_free(prim->oph.msg); - return 0; -} diff --git a/src/ss7_xua_srv.c b/src/ss7_xua_srv.c index 11e0d0b..0d095ee 100644 --- a/src/ss7_xua_srv.c +++ b/src/ss7_xua_srv.c @@ -55,6 +55,7 @@ #include "ss7_internal.h" #include "xua_asp_fsm.h" #include "xua_as_fsm.h" +#include "xua_lm_sap.h" #include "ss7_xua_srv.h" /*********************************************************************** diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c index e9d682a..72cb40e 100644 --- a/src/xua_asp_fsm.c +++ b/src/xua_asp_fsm.c @@ -36,6 +36,7 @@ #include "sccp_internal.h" #include "xua_asp_fsm.h" #include "xua_as_fsm.h" +#include "xua_lm_sap.h" #include "xua_internal.h" #ifdef WITH_TCAP_LOADSHARING @@ -103,46 +104,6 @@ } t_beat; }; -struct osmo_xlm_prim *xua_xlm_prim_alloc(enum osmo_xlm_prim_type prim_type, - enum osmo_prim_operation op) -{ - struct osmo_xlm_prim *prim; - struct msgb *msg = msgb_alloc_headroom(2048+128, 128, "xua_asp-xlm msgb"); - if (!msg) - return NULL; - - prim = (struct osmo_xlm_prim *) msgb_put(msg, sizeof(*prim)); - osmo_prim_init(&prim->oph, XUA_SAP_LM, prim_type, op, msg); - - return prim; -} - -/* Send a XUA LM Primitive to the XUA Layer Manager (LM) */ -void xua_asp_send_xlm_prim(struct osmo_ss7_asp *asp, struct osmo_xlm_prim *prim) -{ - const struct osmo_xua_layer_manager *lm = asp->lm; - - if (lm && lm->prim_cb) - lm->prim_cb(&prim->oph, asp); - else { - LOGPFSML(asp->fi, LOGL_DEBUG, "No Layer Manager, dropping %s\n", - osmo_xlm_prim_name(&prim->oph)); - } - - msgb_free(prim->oph.msg); -} - -/* wrapper around send_xlm_prim for primitives without data */ -void xua_asp_send_xlm_prim_simple(struct osmo_ss7_asp *asp, - enum osmo_xlm_prim_type prim_type, - enum osmo_prim_operation op) -{ - struct osmo_xlm_prim *prim = xua_xlm_prim_alloc(prim_type, op); - if (!prim) - return; - xua_asp_send_xlm_prim(asp, prim); -} - static void send_xlm_prim_simple(struct osmo_fsm_inst *fi, enum osmo_xlm_prim_type prim_type, enum osmo_prim_operation op) diff --git a/src/xua_default_lm_fsm.c b/src/xua_default_lm_fsm.c index d526f74..9a3cb69 100644 --- a/src/xua_default_lm_fsm.c +++ b/src/xua_default_lm_fsm.c @@ -37,6 +37,7 @@ #include "xua_internal.h" #include "xua_asp_fsm.h" +#include "xua_lm_sap.h" #include "ss7_as.h" #include "ss7_asp.h" #include "ss7_xua_srv.h" @@ -178,12 +179,9 @@ { struct ss7_as_asp_assoc *assoc; llist_for_each_entry(assoc, &asp->assoc_as_list, asp_entry) { - struct osmo_ss7_as *as = assoc->as; struct osmo_xlm_prim *prim; - prim = xua_xlm_prim_alloc(OSMO_XLM_PRIM_M_RK_REG, PRIM_OP_REQUEST); - OSMO_ASSERT(prim); - prim->u.rk_reg.key = as->cfg.routing_key; - prim->u.rk_reg.traf_mode = as->cfg.mode; + prim = xua_xlm_prim_alloc_m_rk_reg_req(&assoc->as->cfg.routing_key, + assoc->as->cfg.mode); osmo_xlm_sap_down(asp, &prim->oph); } } diff --git a/src/xua_internal.h b/src/xua_internal.h index c8ae79f..3857a72 100644 --- a/src/xua_internal.h +++ b/src/xua_internal.h @@ -103,14 +103,6 @@ const struct xua_msg *xua); int m3ua_rx_rkm(struct osmo_ss7_asp *asp, struct xua_msg *xua); -struct osmo_xlm_prim *xua_xlm_prim_alloc(enum osmo_xlm_prim_type prim_type, - enum osmo_prim_operation op); - -void xua_asp_send_xlm_prim(struct osmo_ss7_asp *asp, struct osmo_xlm_prim *prim); -void xua_asp_send_xlm_prim_simple(struct osmo_ss7_asp *asp, - enum osmo_xlm_prim_type prim_type, - enum osmo_prim_operation op); - void xua_snm_pc_available(struct osmo_ss7_as *as, const uint32_t *aff_pc, unsigned int num_aff_pc, const char *info_str, bool available); diff --git a/src/xua_lm_sap.c b/src/xua_lm_sap.c new file mode 100644 index 0000000..9eb1c60 --- /dev/null +++ b/src/xua_lm_sap.c @@ -0,0 +1,161 @@ +/* M3UA/SUA <-> XUA Layer Manager SAP, RFC466 1.6.3 & RFC3868 1.6.3 */ +/* (C) 2017-2021 by Harald Welte <laforge(a)gnumonks.org> + * All Rights Reserved + * + * SPDX-License-Identifier: GPL-2.0+ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/* The idea of this default Layer Manager is as follows: + * - we wait until a SCTP connection is established + * - we issue the ASP-UP request and wait for the ASP being in UP state + * - we wait if we receive a M-NOTIFY indication about any AS in this ASP + * - if that's not received, we use RKM to register a routing context + * for our locally configured ASP and expect a positive registration + * result as well as a NOTIFY indication about AS-ACTIVE afterwards. + */ + +#include <errno.h> + +#include <osmocom/core/logging.h> +#include <osmocom/core/msgb.h> +#include <osmocom/core/prim.h> +#include <osmocom/sigtran/osmo_ss7.h> +#include <osmocom/sigtran/sigtran_sap.h> + +#include "xua_internal.h" +#include "ss7_asp.h" + + +struct osmo_xlm_prim *xua_xlm_prim_alloc(enum osmo_xlm_prim_type prim_type, + enum osmo_prim_operation op) +{ + struct osmo_xlm_prim *prim; + struct msgb *msg = msgb_alloc_headroom(2048+128, 128, "xua_asp-xlm msgb"); + if (!msg) + return NULL; + + prim = (struct osmo_xlm_prim *) msgb_put(msg, sizeof(*prim)); + osmo_prim_init(&prim->oph, XUA_SAP_LM, prim_type, op, msg); + + return prim; +} + +/* M-RK_REG request */ +struct osmo_xlm_prim *xua_xlm_prim_alloc_m_rk_reg_req(const struct osmo_ss7_routing_key *rkey, + enum osmo_ss7_as_traffic_mode mode) +{ + struct osmo_xlm_prim *prim; + prim = xua_xlm_prim_alloc(OSMO_XLM_PRIM_M_RK_REG, PRIM_OP_REQUEST); + OSMO_ASSERT(prim); + prim->u.rk_reg.key = *rkey; + prim->u.rk_reg.traf_mode = mode; + return prim; +} + +/* M-RK_REG confirm */ +struct osmo_xlm_prim *xua_xlm_prim_alloc_m_rk_reg_cfm(const struct osmo_ss7_routing_key *rkey, uint32_t status) +{ + struct osmo_xlm_prim *prim; + prim = xua_xlm_prim_alloc(OSMO_XLM_PRIM_M_RK_REG, PRIM_OP_CONFIRM); + OSMO_ASSERT(prim); + prim->u.rk_reg.key = *rkey; + prim->u.rk_reg.status = status; + return prim; +} + +/* M-RK_DEREG confirm */ +struct osmo_xlm_prim *xua_xlm_prim_alloc_m_rk_dereg_cfm(uint32_t route_ctx, uint32_t status) +{ + struct osmo_xlm_prim *prim; + prim = xua_xlm_prim_alloc(OSMO_XLM_PRIM_M_RK_DEREG, PRIM_OP_CONFIRM); + OSMO_ASSERT(prim); + prim->u.rk_dereg.route_ctx = route_ctx; + prim->u.rk_dereg.status = status; + return prim; +} + +/* M-ERROR indication */ +struct osmo_xlm_prim *xua_xlm_prim_alloc_m_error_ind(uint32_t err_code) +{ + struct osmo_xlm_prim *prim; + prim = xua_xlm_prim_alloc(OSMO_XLM_PRIM_M_ERROR, PRIM_OP_INDICATION); + OSMO_ASSERT(prim); + prim->u.error.code = err_code; + return prim; +} + +/* M-NOTIFY indication */ +struct osmo_xlm_prim *xua_xlm_prim_alloc_m_notify_ind(const struct osmo_xlm_prim_notify *ntfy) +{ + struct osmo_xlm_prim *prim; + prim = xua_xlm_prim_alloc(OSMO_XLM_PRIM_M_NOTIFY, PRIM_OP_INDICATION); + OSMO_ASSERT(prim); + prim->u.notify = *ntfy; + return prim; +} + +/* Send a XUA LM Primitive from M3UA/SUA to the XUA Layer Manager (LM) */ +void xua_asp_send_xlm_prim(struct osmo_ss7_asp *asp, struct osmo_xlm_prim *prim) +{ + const struct osmo_xua_layer_manager *lm = asp->lm; + + if (lm && lm->prim_cb) + lm->prim_cb(&prim->oph, asp); + else { + LOGPFSML(asp->fi, LOGL_DEBUG, "No Layer Manager, dropping %s\n", + osmo_xlm_prim_name(&prim->oph)); + } + + msgb_free(prim->oph.msg); +} + +/* wrapper around send_xlm_prim for primitives without data */ +void xua_asp_send_xlm_prim_simple(struct osmo_ss7_asp *asp, + enum osmo_xlm_prim_type prim_type, + enum osmo_prim_operation op) +{ + struct osmo_xlm_prim *prim = xua_xlm_prim_alloc(prim_type, op); + if (!prim) + return; + xua_asp_send_xlm_prim(asp, prim); +} + +/* process a primitive from the xUA Layer Manager (LM) to M3UA/SUA */ +int osmo_xlm_sap_down(struct osmo_ss7_asp *asp, struct osmo_prim_hdr *oph) +{ + struct osmo_xlm_prim *prim = (struct osmo_xlm_prim *) oph; + + LOGPASP(asp, DLSS7, LOGL_DEBUG, "Received XUA Layer Manager Primitive: %s)\n", + osmo_xlm_prim_name(&prim->oph)); + + switch (OSMO_PRIM_HDR(&prim->oph)) { + case OSMO_PRIM(OSMO_XLM_PRIM_M_RK_REG, PRIM_OP_REQUEST): + /* Layer Manager asks us to send a Routing Key Reg Request */ + xua_rkm_send_reg_req(asp, &prim->u.rk_reg.key, prim->u.rk_reg.traf_mode); + break; + case OSMO_PRIM(OSMO_XLM_PRIM_M_RK_DEREG, PRIM_OP_REQUEST): + /* Layer Manager asks us to send a Routing Key De-Reg Request */ + xua_rkm_send_dereg_req(asp, prim->u.rk_dereg.route_ctx); + break; + default: + LOGPASP(asp, DLSS7, LOGL_ERROR, "Unknown XUA Layer Manager Primitive: %s\n", + osmo_xlm_prim_name(&prim->oph)); + break; + } + + msgb_free(prim->oph.msg); + return 0; +} diff --git a/src/xua_lm_sap.h b/src/xua_lm_sap.h new file mode 100644 index 0000000..3609eb2 --- /dev/null +++ b/src/xua_lm_sap.h @@ -0,0 +1,24 @@ +/* M3UA/SUA <-> XUA Layer Manager SAP, RFC466 1.6.3 & RFC3868 1.6.3 */ +#pragma once + +#include <unistd.h> +#include <stdint.h> + +#include <osmocom/core/tdef.h> +#include <osmocom/sigtran/osmo_ss7.h> +#include <osmocom/sigtran/sigtran_sap.h> + +struct osmo_xlm_prim *xua_xlm_prim_alloc(enum osmo_xlm_prim_type prim_type, + enum osmo_prim_operation op); +struct osmo_xlm_prim *xua_xlm_prim_alloc_m_rk_reg_req(const struct osmo_ss7_routing_key *rkey, + enum osmo_ss7_as_traffic_mode mode); +struct osmo_xlm_prim *xua_xlm_prim_alloc_m_rk_reg_cfm(const struct osmo_ss7_routing_key *rkey, + uint32_t status); +struct osmo_xlm_prim *xua_xlm_prim_alloc_m_rk_dereg_cfm(uint32_t route_ctx, uint32_t status); +struct osmo_xlm_prim *xua_xlm_prim_alloc_m_error_ind(uint32_t err_code); +struct osmo_xlm_prim *xua_xlm_prim_alloc_m_notify_ind(const struct osmo_xlm_prim_notify *ntfy); + +void xua_asp_send_xlm_prim(struct osmo_ss7_asp *asp, struct osmo_xlm_prim *prim); +void xua_asp_send_xlm_prim_simple(struct osmo_ss7_asp *asp, + enum osmo_xlm_prim_type prim_type, + enum osmo_prim_operation op); diff --git a/src/xua_rkm.c b/src/xua_rkm.c index f3136e4..2e7c227 100644 --- a/src/xua_rkm.c +++ b/src/xua_rkm.c @@ -36,6 +36,7 @@ #include "xua_internal.h" #include "xua_as_fsm.h" #include "xua_asp_fsm.h" +#include "xua_lm_sap.h" const struct value_string m3ua_rkm_reg_status_vals[] = { { M3UA_RKM_REG_SUCCESS, "SUCCESS" }, @@ -465,6 +466,7 @@ static int handle_rkey_reg_resp(struct osmo_ss7_asp *asp, struct xua_msg *inner) { struct osmo_xlm_prim *oxp; + struct osmo_ss7_routing_key rkey; if (!xua_msg_find_tag(inner, M3UA_IEI_LOC_RKEY_ID) || !xua_msg_find_tag(inner, M3UA_IEI_REG_STATUS) || @@ -474,13 +476,11 @@ return -1; } - oxp = xua_xlm_prim_alloc(OSMO_XLM_PRIM_M_RK_REG, PRIM_OP_CONFIRM); - if (!oxp) - return -1; - - oxp->u.rk_reg.key.l_rk_id = xua_msg_get_u32(inner, M3UA_IEI_LOC_RKEY_ID); - oxp->u.rk_reg.key.context = xua_msg_get_u32(inner, M3UA_IEI_ROUTE_CTX); - oxp->u.rk_reg.status = xua_msg_get_u32(inner, M3UA_IEI_REG_STATUS); + rkey = (struct osmo_ss7_routing_key){ + .l_rk_id = xua_msg_get_u32(inner, M3UA_IEI_LOC_RKEY_ID), + .context = xua_msg_get_u32(inner, M3UA_IEI_ROUTE_CTX), + }; + oxp = xua_xlm_prim_alloc_m_rk_reg_cfm(&rkey, xua_msg_get_u32(inner, M3UA_IEI_REG_STATUS)); LOGPASP(asp, DLSS7, LOGL_INFO, "Received RKM REG RES rctx=%u status=%s\n", oxp->u.rk_reg.key.context, @@ -528,12 +528,8 @@ return -1; } - oxp = xua_xlm_prim_alloc(OSMO_XLM_PRIM_M_RK_DEREG, PRIM_OP_CONFIRM); - if (!oxp) - return -1; - - oxp->u.rk_dereg.route_ctx = xua_msg_get_u32(inner, M3UA_IEI_ROUTE_CTX); - oxp->u.rk_dereg.status = xua_msg_get_u32(inner, M3UA_IEI_DEREG_STATUS); + oxp = xua_xlm_prim_alloc_m_rk_dereg_cfm(xua_msg_get_u32(inner, M3UA_IEI_ROUTE_CTX), + xua_msg_get_u32(inner, M3UA_IEI_DEREG_STATUS)); LOGPASP(asp, DLSS7, LOGL_INFO, "Received RKM DEREG RES rctx=%u status=%s\n", oxp->u.rk_reg.key.context, -- To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/42561?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: I93d74dd7f6ea8f2e60a8bc41be15362e433e8962 Gerrit-Change-Number: 42561 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de>
1 0
0 0
[S] Change in libosmo-sigtran[master]: m3ua: m3ua_gen_error_msg(): include Routing Context IE in cause Inval...
by pespin 31 Mar '26

31 Mar '26
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/b016ab14_aebf4… : PS2, Line 18: originated > that's a typo, I think I meant "identified" :) Done -- 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:38:31 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: laforge <laforge(a)osmocom.org> Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
1 0
0 0
[S] Change in libosmo-sigtran[master]: m3ua: m3ua_gen_error_msg(): include Routing Context IE in cause Inval...
by pespin 31 Mar '26

31 Mar '26
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>
1 0
0 0
[S] Change in libosmo-sigtran[master]: osmo_ss7_find_free_{rctx,l_rk_id}(): Make more robust to wrap-around
by pespin 31 Mar '26

31 Mar '26
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/42534?usp=email ) Change subject: osmo_ss7_find_free_{rctx,l_rk_id}(): Make more robust to wrap-around ...................................................................... osmo_ss7_find_free_{rctx,l_rk_id}(): Make more robust to wrap-around Previous versions of those functions would end up broken over time after ~2^32 were allocated, turning the program into an unusuable stte. Change-Id: Ie10f4048d0af384dc84c79e6fc441c8537649d55 --- M src/ss7_instance.c 1 file changed, 24 insertions(+), 8 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/ss7_instance.c b/src/ss7_instance.c index 4aadc65..05f6be8 100644 --- a/src/ss7_instance.c +++ b/src/ss7_instance.c @@ -240,25 +240,41 @@ return false; } +/* Next RCTX, skipping special value "0" meaning no context. */ +static inline uint32_t rctx_inc(uint32_t rctx) +{ + return (rctx == UINT32_MAX) ? 1 : rctx + 1; +} + int osmo_ss7_find_free_rctx(struct osmo_ss7_instance *inst) { - int32_t rctx; + uint32_t rctx = next_rctx; - for (rctx = next_rctx; rctx; rctx = ++next_rctx) { - if (!osmo_ss7_as_find_by_rctx(inst, next_rctx)) + OSMO_ASSERT(next_rctx != 0); + + do { + if (!osmo_ss7_as_find_by_rctx(inst, rctx)) { + next_rctx = rctx_inc(rctx); return rctx; - } + } + rctx = rctx_inc(rctx); + } while (rctx != next_rctx); + return -1; } uint32_t ss7_find_free_l_rk_id(struct osmo_ss7_instance *inst) { - uint32_t l_rk_id; + uint32_t l_rk_id = next_l_rk_id; - for (l_rk_id = next_l_rk_id; next_l_rk_id; l_rk_id = ++next_l_rk_id) { - if (!osmo_ss7_as_find_by_l_rk_id(inst, next_l_rk_id)) + do { + if (!osmo_ss7_as_find_by_l_rk_id(inst, l_rk_id)) { + next_l_rk_id = l_rk_id + 1; return l_rk_id; - } + } + l_rk_id++; + } while (l_rk_id != next_l_rk_id); + return -1; } -- To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/42534?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: Ie10f4048d0af384dc84c79e6fc441c8537649d55 Gerrit-Change-Number: 42534 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>
1 0
0 0
[S] Change in libosmo-sigtran[master]: xua: Split traffic mode readonly validation from internal state update
by pespin 31 Mar '26

31 Mar '26
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/42529?usp=email ) Change subject: xua: Split traffic mode readonly validation from internal state update ...................................................................... xua: Split traffic mode readonly validation from internal state update First validate the whole message, then once evyerthing is fine, act on the message updating internal state. Change-Id: I05ba891e774ebe341229b968c92e0383b6899bd6 --- M src/xua_asp_fsm.c M src/xua_rkm.c 2 files changed, 31 insertions(+), 16 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve pespin: Looks good to me, approved diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c index 913f0e8..5cb28fc 100644 --- a/src/xua_asp_fsm.c +++ b/src/xua_asp_fsm.c @@ -641,6 +641,7 @@ struct xua_asp_fsm_priv *xafp = fi->priv; struct osmo_ss7_asp *asp = xafp->asp; struct osmo_ss7_as *as; + struct ss7_as_asp_assoc *assoc; struct xua_msg_part *asp_id_ie; struct xua_msg *xua_in; uint32_t traf_mode = 0; @@ -715,8 +716,16 @@ } if (traf_mode) { /* if the peer has specified a traffic mode at all */ + /* First validate peer not trying to establish an incompatible traffic mode: */ + llist_for_each_entry(assoc, &asp->assoc_as_list, asp_entry) { + if (!osmo_ss7_as_tmode_compatible_xua(assoc->as, traf_mode)) { + peer_send_error(fi, M3UA_ERR_UNSUPP_TRAF_MOD_TYP); + return; + } + } + + /* Update traffic mode in all AS associated with the ASP: */ enum osmo_ss7_as_traffic_mode tmode = osmo_ss7_tmode_from_xua(traf_mode); - struct ss7_as_asp_assoc *assoc; llist_for_each_entry(assoc, &asp->assoc_as_list, asp_entry) { as = assoc->as; if (!as->cfg.mode_set_by_peer && !as->cfg.mode_set_by_vty) { @@ -724,9 +733,6 @@ LOGPAS(as, DLSS7, LOGL_INFO, "ASPAC: Traffic mode set dynamically by peer to %s\n", osmo_ss7_as_traffic_mode_name(as->cfg.mode)); - } else if (!osmo_ss7_as_tmode_compatible_xua(as, traf_mode)) { - peer_send_error(fi, M3UA_ERR_UNSUPP_TRAF_MOD_TYP); - return; } as->cfg.mode_set_by_peer = true; } diff --git a/src/xua_rkm.c b/src/xua_rkm.c index 22bcafe..d6dfa51 100644 --- a/src/xua_rkm.c +++ b/src/xua_rkm.c @@ -172,6 +172,7 @@ uint32_t rk_id, rctx, _tmode, dpc; enum osmo_ss7_as_traffic_mode tmode; struct osmo_ss7_as *as; + struct ss7_as_asp_assoc *assoc; struct osmo_ss7_route *rt; char namebuf[32]; bool as_already_in_array; @@ -264,19 +265,27 @@ } if (_tmode) { /* if the peer has specified a traffic mode at all */ tmode = osmo_ss7_tmode_from_xua(_tmode); - if (!as->cfg.mode_set_by_peer && !as->cfg.mode_set_by_vty) { - as->cfg.mode = tmode; - LOGPAS(as, DLSS7, LOGL_INFO, - "RKM: Traffic mode set dynamically by peer to %s\n", - osmo_ss7_as_traffic_mode_name(as->cfg.mode)); - /* verify if existing AS has same traffic-mode as new request (if any) */ - } else if (!osmo_ss7_as_tmode_compatible_xua(as, _tmode)) { - LOGPASP(asp, DLSS7, LOGL_NOTICE, "RKM: Non-matching Traffic Mode %s\n", - osmo_ss7_as_traffic_mode_name(tmode)); - msgb_append_reg_res(resp, rk_id, M3UA_RKM_REG_ERR_UNSUPP_TRAF_MODE, 0); - return -1; + /* First validate peer not trying to establish an incompatible traffic mode: */ + llist_for_each_entry(assoc, &asp->assoc_as_list, asp_entry) { + if (!osmo_ss7_as_tmode_compatible_xua(assoc->as, _tmode)) { + LOGPASP(asp, DLSS7, LOGL_NOTICE, "RKM: Non-matching Traffic Mode %s\n", + osmo_ss7_as_traffic_mode_name(tmode)); + msgb_append_reg_res(resp, rk_id, M3UA_RKM_REG_ERR_UNSUPP_TRAF_MODE, 0); + return -1; + } } - as->cfg.mode_set_by_peer = true; + + /* Update traffic mode in all AS associated with the ASP: */ + llist_for_each_entry(assoc, &asp->assoc_as_list, asp_entry) { + as = assoc->as; + if (!as->cfg.mode_set_by_peer && !as->cfg.mode_set_by_vty) { + as->cfg.mode = tmode; + LOGPAS(as, DLSS7, LOGL_INFO, + "RKM: Traffic mode set dynamically by peer to %s\n", + osmo_ss7_as_traffic_mode_name(as->cfg.mode)); + } + as->cfg.mode_set_by_peer = true; + } } } else { /* Create an AS for this routing key */ -- To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/42529?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: I05ba891e774ebe341229b968c92e0383b6899bd6 Gerrit-Change-Number: 42529 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>
1 0
0 0
[M] Change in libosmo-sigtran[master]: asp: Configure block and shutdown adm state independently
by pespin 31 Mar '26

31 Mar '26
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/42528?usp=email ) Change subject: asp: Configure block and shutdown adm state independently ...................................................................... asp: Configure block and shutdown adm state independently The block/no block and shutdown/no shutdown commands tweak independent states; adapt the code to what's presented to the user. This simplifies handling of both states, since the user may want eg. have it blocked and shutdown, and then "no shutdown" it but make sure it stays blocked so no race condition happens. Related: OS#6752 Change-Id: I3ab81a4f6f6b72015c5068d5a27128642622cf99 --- M include/osmocom/sigtran/osmo_ss7.h M src/ss7_asp.c M src/ss7_asp.h M src/ss7_asp_vty.c M src/ss7_xua_srv.c 5 files changed, 22 insertions(+), 45 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified pespin: Looks good to me, approved osmith: Looks good to me, but someone else must approve diff --git a/include/osmocom/sigtran/osmo_ss7.h b/include/osmocom/sigtran/osmo_ss7.h index 162994e..074027f 100644 --- a/include/osmocom/sigtran/osmo_ss7.h +++ b/include/osmocom/sigtran/osmo_ss7.h @@ -240,16 +240,6 @@ * SS7 Application Server Processes ***********************************************************************/ -enum osmo_ss7_asp_admin_state { - /*! no SCTP association with peer */ - OSMO_SS7_ASP_ADM_S_SHUTDOWN, - /*! SCP association, but reject ASP-ACTIVE */ - OSMO_SS7_ASP_ADM_S_BLOCKED, - /*! in normal operation */ - OSMO_SS7_ASP_ADM_S_ENABLED, -}; -extern const struct value_string osmo_ss7_asp_admin_state_names[]; - enum osmo_ss7_asp_role { OSMO_SS7_ASP_ROLE_ASP, OSMO_SS7_ASP_ROLE_SG, diff --git a/src/ss7_asp.c b/src/ss7_asp.c index 40433d0..f83de19 100644 --- a/src/ss7_asp.c +++ b/src/ss7_asp.c @@ -149,13 +149,6 @@ { 0, NULL } }; -const struct value_string osmo_ss7_asp_admin_state_names[] = { - { OSMO_SS7_ASP_ADM_S_SHUTDOWN, "SHUTDOWN" }, - { OSMO_SS7_ASP_ADM_S_BLOCKED, "BLOCKED" }, - { OSMO_SS7_ASP_ADM_S_ENABLED, "ENABLED" }, - { 0, NULL } -}; - const struct value_string osmo_ss7_asp_role_names[] = { { OSMO_SS7_ASP_ROLE_ASP, "ASP" }, { OSMO_SS7_ASP_ROLE_SG, "SG" }, @@ -744,7 +737,7 @@ asp->inst = inst; INIT_LLIST_HEAD(&asp->assoc_as_list); /* ASP in "no shutdown" state by default: */ - asp->cfg.adm_state = OSMO_SS7_ASP_ADM_S_ENABLED; + asp->cfg.adm_state.shutdown = false; ss7_asp_peer_init(&asp->cfg.remote); asp->cfg.remote.port = remote_port; ss7_asp_peer_init(&asp->cfg.local); @@ -938,9 +931,8 @@ return rc; OSMO_ASSERT(asp->fi); - if (asp->cfg.adm_state == OSMO_SS7_ASP_ADM_S_SHUTDOWN) { - LOGPASP(asp, DLSS7, LOGL_NOTICE, "Skipping start for ASP in administrative state %s\n", - get_value_string(osmo_ss7_asp_admin_state_names, OSMO_SS7_ASP_ADM_S_SHUTDOWN)); + if (asp->cfg.adm_state.shutdown) { + LOGPASP(asp, DLSS7, LOGL_NOTICE, "Skipping start for ASP in administrative state 'shutdown'\n"); return 0; } @@ -1256,7 +1248,7 @@ struct osmo_ss7_asp *asp = osmo_stream_cli_get_data(cli); LOGPASP(asp, DLSS7, LOGL_NOTICE, "Closing and reconnecting ASP\n"); xua_cli_close(cli); - if (asp->cfg.adm_state != OSMO_SS7_ASP_ADM_S_SHUTDOWN) + if (!asp->cfg.adm_state.shutdown) osmo_stream_cli_reconnect(cli); return 0; } diff --git a/src/ss7_asp.h b/src/ss7_asp.h index 7bce2d4..834f910 100644 --- a/src/ss7_asp.h +++ b/src/ss7_asp.h @@ -112,7 +112,12 @@ char *name; char *description; enum osmo_ss7_asp_protocol proto; - enum osmo_ss7_asp_admin_state adm_state; + struct { + /*! no SCTP association with peer */ + bool shutdown:1; + /*! SCP association, but reject ASP-ACTIVE */ + bool blocked:1; + } adm_state; bool is_server; enum osmo_ss7_asp_role role; bool role_set_by_vty; diff --git a/src/ss7_asp_vty.c b/src/ss7_asp_vty.c index f13cb60..3cae016 100644 --- a/src/ss7_asp_vty.c +++ b/src/ss7_asp_vty.c @@ -717,12 +717,11 @@ { struct osmo_ss7_asp *asp = vty->index; - LOGPASP(asp, DLSS7, LOGL_NOTICE, "Applying Adm State change: %s -> %s\n", - get_value_string(osmo_ss7_asp_admin_state_names, asp->cfg.adm_state), - get_value_string(osmo_ss7_asp_admin_state_names, OSMO_SS7_ASP_ADM_S_SHUTDOWN)); + LOGPASP(asp, DLSS7, LOGL_NOTICE, "Applying Adm State change: '%sshutdown' -> 'shutdown'\n", + asp->cfg.adm_state.shutdown ? "" : "no "); asp->cfg.explicit_shutdown_state_by_vty_since_node_enter = true; - asp->cfg.adm_state = OSMO_SS7_ASP_ADM_S_SHUTDOWN; + asp->cfg.adm_state.shutdown = true; ss7_asp_restart_after_reconfigure(asp); return CMD_SUCCESS; } @@ -734,12 +733,11 @@ { struct osmo_ss7_asp *asp = vty->index; - LOGPASP(asp, DLSS7, LOGL_NOTICE, "Applying Adm State change: %s -> %s\n", - get_value_string(osmo_ss7_asp_admin_state_names, asp->cfg.adm_state), - get_value_string(osmo_ss7_asp_admin_state_names, OSMO_SS7_ASP_ADM_S_ENABLED)); + LOGPASP(asp, DLSS7, LOGL_NOTICE, "Applying Adm State change: '%sshutdown' -> 'no shutdown'\n", + asp->cfg.adm_state.shutdown ? "" : "no "); asp->cfg.explicit_shutdown_state_by_vty_since_node_enter = true; - asp->cfg.adm_state = OSMO_SS7_ASP_ADM_S_ENABLED; + asp->cfg.adm_state.shutdown = false; ss7_asp_restart_after_reconfigure(asp); return CMD_SUCCESS; } @@ -1406,18 +1404,10 @@ write_asp_timers_xua(vty, " ", asp); write_asp_timers_lm(vty, " ", asp); - switch (asp->cfg.adm_state) { - case OSMO_SS7_ASP_ADM_S_SHUTDOWN: - vty_out(vty, " shutdown%s", VTY_NEWLINE); - break; - case OSMO_SS7_ASP_ADM_S_BLOCKED: + if (asp->cfg.adm_state.blocked) vty_out(vty, " block%s", VTY_NEWLINE); - break; - case OSMO_SS7_ASP_ADM_S_ENABLED: - /* Default, no need to print: */ - vty_out(vty, " no shutdown%s", VTY_NEWLINE); - break; - } + + vty_out(vty, " %sshutdown%s", asp->cfg.adm_state.shutdown ? "" : "no ", VTY_NEWLINE); } int ss7_vty_node_asp_go_parent(struct vty *vty) diff --git a/src/ss7_xua_srv.c b/src/ss7_xua_srv.c index deb1808..11e0d0b 100644 --- a/src/ss7_xua_srv.c +++ b/src/ss7_xua_srv.c @@ -85,10 +85,10 @@ talloc_free(sock_name); return 0; } - if (asp->cfg.adm_state == OSMO_SS7_ASP_ADM_S_SHUTDOWN) { + if (asp->cfg.adm_state.shutdown) { LOGPASP(asp, DLSS7, LOGL_NOTICE, - "Reject incoming new connection from %s for ASP in adm state %s\n", - sock_name, get_value_string(osmo_ss7_asp_admin_state_names, asp->cfg.adm_state)); + "Reject incoming new connection from %s for ASP in adm state 'shutdown'\n", + sock_name); close(fd); talloc_free(sock_name); return 0; -- To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/42528?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: I3ab81a4f6f6b72015c5068d5a27128642622cf99 Gerrit-Change-Number: 42528 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>
1 0
0 0
[S] Change in libosmo-sigtran[master]: xua_asp_fsm: XUA_ASP_E_ASPTM_ASPAC: Validate RCTX AS is associated to...
by pespin 31 Mar '26

31 Mar '26
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>
1 0
0 0
[S] Change in libosmo-sigtran[master]: xua_find_as_for_asp(): Optimize lookup
by pespin 31 Mar '26

31 Mar '26
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>
1 0
0 0
[XS] Change in libosmo-sigtran[master]: handle_rkey_dereg(): Optimize lookup
by pespin 31 Mar '26

31 Mar '26
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>
1 0
0 0
[S] Change in libosmo-sigtran[master]: xua_rkm: handle_rkey_reg(): Skip AS ilookup of known free RCTX
by pespin 31 Mar '26

31 Mar '26
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>
1 0
0 0
  • ← Newer
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • ...
  • 194
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.