pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/40003?usp=email )
Change subject: ipa: Try picking unused asp_id in AS to use as SLS
......................................................................
ipa: Try picking unused asp_id in AS to use as SLS
Initially (b93e1d01205cdd7bd7a65e15945f664f31fb4bcb), incoming traffic
from IPA sockets was tagged with SLS using the LSB of the socket file
descriptor. that did however not achieve sufficient entropy in real
world use cases.
Later on (2c9ba16c2c0210a189c72064eafad5ef336254cd), SLS tagging was
changed to pseudo-random generation.
Still it has been found too that it may create bad entropy under certain
condtions, with eg. havig only 2 incoming ASPs and both ending up with
the same asp_id/SLS, which won't allow for proper load sharing towards
other peers.
This commit changes the previous method by delaying SLS assignment
decision of the socket until the ASP becomes assigned to an AS
(basically during IPA handshake, when we receive IPA IDENTITY RESPONSE
with the Unit-Name, or when we receive the IPA IDENTITY ACK for it).
It is fine delaying SLS assignment to that point, since it's impossible
to receive any userplane data before that handhsake ocurrs.
Once the ASP is assigned to the AS (IPA ASPs can only be part of one
AS), we lookup the other ASPs in the AS to try to allocate an unused
4-bit asp_id which will end up being used as SLS.
Related: SYS#6543
Related: SYS#6802
Change-Id: I723eac25e59002630dca87a738c8eb7c62edec75
---
M src/osmo_ss7_asp.c
M src/osmo_ss7_xua_srv.c
M src/xua_asp_fsm.c
3 files changed, 40 insertions(+), 12 deletions(-)
Approvals:
fixeria: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
osmith: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/src/osmo_ss7_asp.c b/src/osmo_ss7_asp.c
index f785264..7e444b4 100644
--- a/src/osmo_ss7_asp.c
+++ b/src/osmo_ss7_asp.c
@@ -979,12 +979,6 @@
if (asp->cfg.trans_proto == IPPROTO_SCTP) {
rc = ss7_asp_apply_peer_primary_address(asp);
rc = ss7_asp_apply_primary_address(asp);
- } else {
- if (asp->cfg.proto == OSMO_SS7_ASP_PROT_IPA) {
- /* we use the lower 4 bits of the asp_id field as SLS;
- * let's initialize it here from a pseudo-random value */
- asp->asp_id = rand() & 0xf;
- }
}
if (asp->lm && asp->lm->prim_cb) {
diff --git a/src/osmo_ss7_xua_srv.c b/src/osmo_ss7_xua_srv.c
index 35e360f..52a3508 100644
--- a/src/osmo_ss7_xua_srv.c
+++ b/src/osmo_ss7_xua_srv.c
@@ -180,12 +180,6 @@
if (asp->cfg.trans_proto == IPPROTO_SCTP) {
rc = ss7_asp_apply_peer_primary_address(asp);
rc = ss7_asp_apply_primary_address(asp);
- } else {
- if (asp->cfg.proto == OSMO_SS7_ASP_PROT_IPA) {
- /* we use the lower 4 bits of the asp_id field as SLS;
- * let's initialize it here from a pseudo-random value */
- asp->asp_id = rand() & 0xf;
- }
}
/* send M-SCTP_ESTABLISH.ind to Layer Manager */
diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c
index cd60df2..93c6d4d 100644
--- a/src/xua_asp_fsm.c
+++ b/src/xua_asp_fsm.c
@@ -1104,6 +1104,36 @@
}
}
+/* Assign a 4 bit asp_id (as unqiue as possible) which will be used as SLS for incoming IPA PDUs.*/
+static void _ipa_asp_pick_unused_asp_id_as_sls(struct osmo_ss7_asp *asp, const struct osmo_ss7_as *as)
+{
+ for (unsigned int asp_id = 0; asp_id <= 0x0f; asp_id++) {
+ bool used = false;
+ for (unsigned i = 0; i < ARRAY_SIZE(as->cfg.asps); i++) {
+ if (!as->cfg.asps[i])
+ continue;
+ if (as->cfg.asps[i] == asp)
+ continue;
+ if (!as->cfg.asps[i]->asp_id_present)
+ continue;
+ if (as->cfg.asps[i]->asp_id == asp_id) {
+ used = true;
+ break;
+ }
+ }
+ if (used)
+ continue;
+ /* Found an unused asp_id, use it: */
+ asp->asp_id = asp_id;
+ asp->asp_id_present = true;
+ LOGPASP(asp, DLSS7, LOGL_DEBUG, "Assigned unsued asp_id = %u to be used as SLS\n", asp_id);
+ return;
+ }
+ LOGPASP(asp, DLSS7, LOGL_INFO, "All asp_ids in IPA AS picked, unique SLS not possible, picking random one\n");
+ asp->asp_id = rand() & 0x0f;
+ asp->asp_id_present = true;
+}
+
static void ipa_asp_allstate(struct osmo_fsm_inst *fi, uint32_t event, void *data)
{
struct ipa_asp_fsm_priv *iafp = fi->priv;
@@ -1130,6 +1160,12 @@
case XUA_ASP_E_AS_ASSIGNED:
as = data;
osmo_talloc_replace_string(iafp->ipa_unit, &iafp->ipa_unit->unit_name, as->cfg.name);
+ /* In IPA, asp_id is not really used on the wire, and we
+ * actually use internally the lower 4 bits of the field to
+ * fill in a potentailly unique SLS to apply to PDUs received from the IPA socket.
+ * Now that AS is known, try picking an unused asp_id inside the AS.
+ * we use the lower 4 bits of the asp_id field as SLS; */
+ _ipa_asp_pick_unused_asp_id_as_sls(iafp->asp, as);
/* Now that the AS is known, start the client side: */
if (iafp->role == OSMO_SS7_ASP_ROLE_ASP && fi->state == IPA_ASP_S_DOWN) {
LOGPFSML(fi, LOGL_NOTICE, "Bringing up ASP now once it has been assigned to an AS\n");
@@ -1274,10 +1310,13 @@
if (as) {
unit_name = as->cfg.name;
+ /* Allocacate potentially unique asp_id within AS since AS is already known: */
+ _ipa_asp_pick_unused_asp_id_as_sls(asp, as);
} else if (asp->dyn_allocated) {
LOGPFSML(fi, LOGL_INFO, "Dynamic ASP is not assigned to any AS, "
"using ASP name instead of AS name as ipa_unit_name\n");
unit_name = asp->cfg.name;
+ /* asp->asp_id will be assigned together with AS unit_name during XUA_ASP_E_AS_ASSIGNED. */
} else {
/* ASP in client mode will be brought up when this ASP is added
* to an AS, see XUA_ASP_E_AS_ASSIGNED. */
@@ -1286,6 +1325,7 @@
can_start = false;
}
unit_name = asp->cfg.name;
+ /* asp->asp_id will be assigned together with AS unit_name during XUA_ASP_E_AS_ASSIGNED. */
}
iafp->role = role;
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/40003?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: I723eac25e59002630dca87a738c8eb7c62edec75
Gerrit-Change-Number: 40003
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Attention is currently required from: daniel, laforge.
pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/40003?usp=email )
Change subject: ipa: Try picking unused asp_id in AS to use as SLS
......................................................................
Patch Set 3: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/40003?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: I723eac25e59002630dca87a738c8eb7c62edec75
Gerrit-Change-Number: 40003
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: daniel <dwillmann(a)sysmocom.de>
Gerrit-Comment-Date: Sat, 12 Apr 2025 22:01:09 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
ahuemer has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/40014?usp=email )
Change subject: Abort configure run on big endian hosts
......................................................................
Abort configure run on big endian hosts
Change-Id: I9bf16113acbbc1e100fd928446a91b927d3c6cbc
---
M configure.ac
1 file changed, 5 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/14/40014/1
diff --git a/configure.ac b/configure.ac
index 7863624..4647770 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,6 +66,11 @@
AC_SUBST(LTLDFLAGS_OSMOCORE)
AC_SUBST(LTLDFLAGS_OSMOCTRL)
+AC_C_BIGENDIAN(
+ [AC_MSG_ERROR([Unfortunately, big endian hosts are currently not supported. Not due to dev policy but lack of maintainer bandwidth. Contributions welcome.])],
+ [],
+ [AC_MSG_WARN([Byte order could not be determined. Strange.])])
+
dnl checks for header files
AC_HEADER_STDC
AC_CHECK_HEADERS(execinfo.h poll.h sys/select.h sys/socket.h sys/signalfd.h sys/eventfd.h sys/timerfd.h syslog.h ctype.h netinet/tcp.h netinet/in.h)
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/40014?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I9bf16113acbbc1e100fd928446a91b927d3c6cbc
Gerrit-Change-Number: 40014
Gerrit-PatchSet: 1
Gerrit-Owner: ahuemer <alexander.huemer(a)xx.vu>
Attention is currently required from: laforge.
Hello Jenkins Builder, laforge,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/libosmo-sigtran/+/40011?usp=email
to look at the new patch set (#4).
Change subject: Tx multiple Routing Contexts in NOTIFY on ASPs serving multiple AS
......................................................................
Tx multiple Routing Contexts in NOTIFY on ASPs serving multiple AS
Routing Context IE in NOTIFY msg should contain n X 32-bit integers, one
for each Routing Context (AS) this ASP is serving.
This fixes only 1 AS being announced during NOTIFY if the ASP was
configured to server more than one AS.
Change-Id: I646301ec3d08ef98f227cf4d19da1039e40cedd2
---
M include/osmocom/sigtran/sigtran_sap.h
M src/m3ua.c
M src/osmo_ss7_asp.c
M src/ss7_asp.h
M src/xua_as_fsm.c
M src/xua_msg.c
M src/xua_msg.h
7 files changed, 87 insertions(+), 16 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/11/40011/4
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/40011?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: I646301ec3d08ef98f227cf4d19da1039e40cedd2
Gerrit-Change-Number: 40011
Gerrit-PatchSet: 4
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/40013?usp=email )
Change subject: asp: Rework s/get_all_rctx_for_asp/ss7_asp_get_all_rctx_be/g
......................................................................
asp: Rework s/get_all_rctx_for_asp/ss7_asp_get_all_rctx_be/g
This function will gain other users in other files in follow-up patches.
While at it, constify and reorder params.
Change-Id: Ic3a1c0bd663fe33ab14828e30e057a8beaa84c3f
---
M src/osmo_ss7_asp.c
M src/ss7_asp.h
M src/xua_snm.c
3 files changed, 30 insertions(+), 27 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/13/40013/1
diff --git a/src/osmo_ss7_asp.c b/src/osmo_ss7_asp.c
index bb3c2dd..c054369 100644
--- a/src/osmo_ss7_asp.c
+++ b/src/osmo_ss7_asp.c
@@ -1300,3 +1300,25 @@
osmo_ss7_asp_restart(asp);
}
+
+/* Obtain all routing contexts (in network byte order) that exist within the given ASP */
+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)
+{
+ unsigned int count = 0;
+ struct osmo_ss7_as *as;
+
+ llist_for_each_entry(as, &asp->inst->as_list, list) {
+ if (as == excl_as)
+ continue;
+ if (!osmo_ss7_as_has_asp(as, asp))
+ continue;
+ if (as->cfg.routing_key.context == 0)
+ continue;
+ if (count >= rctx_size)
+ break;
+ rctx[count] = htonl(as->cfg.routing_key.context);
+ count++;
+ }
+ return count;
+}
diff --git a/src/ss7_asp.h b/src/ss7_asp.h
index 7a001e0..bdde5bd 100644
--- a/src/ss7_asp.h
+++ b/src/ss7_asp.h
@@ -128,5 +128,8 @@
void ss7_asp_restart_after_reconfigure(struct osmo_ss7_asp *asp);
void osmo_ss7_asp_remove_default_lm(struct osmo_ss7_asp *asp);
+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);
+
#define LOGPASP(asp, subsys, level, fmt, args ...) \
_LOGSS7((asp)->inst, subsys, level, "ASP(%s) " fmt, (asp)->cfg.name, ## args)
diff --git a/src/xua_snm.c b/src/xua_snm.c
index edb1210..3dd988f 100644
--- a/src/xua_snm.c
+++ b/src/xua_snm.c
@@ -66,28 +66,6 @@
return out;
}
-/* obtain all routing contexts (in network byte order) that exist within the given ASP */
-static unsigned int get_all_rctx_for_asp(uint32_t *rctx, unsigned int rctx_size,
- struct osmo_ss7_asp *asp, struct osmo_ss7_as *excl_as)
-{
- unsigned int count = 0;
- struct osmo_ss7_as *as;
-
- llist_for_each_entry(as, &asp->inst->as_list, list) {
- if (as == excl_as)
- continue;
- if (!osmo_ss7_as_has_asp(as, asp))
- continue;
- if (as->cfg.routing_key.context == 0)
- continue;
- if (count >= rctx_size)
- break;
- rctx[count] = htonl(as->cfg.routing_key.context);
- count++;
- }
- return count;
-}
-
static void xua_tx_snm_available(struct osmo_ss7_asp *asp, const uint32_t *rctx, unsigned int num_rctx,
const uint32_t *aff_pc, unsigned int num_aff_pc,
const char *info_str, bool available)
@@ -192,7 +170,7 @@
if (asp->cfg.role != OSMO_SS7_ASP_ROLE_SG)
continue;
- num_rctx = get_all_rctx_for_asp(rctx, ARRAY_SIZE(rctx), asp, as);
+ num_rctx = ss7_asp_get_all_rctx_be(asp, rctx, ARRAY_SIZE(rctx), as);
/* this can happen if the given ASP is only in the AS that reports the change,
* which shall be excluded */
if (num_rctx == 0)
@@ -238,7 +216,7 @@
if (asp->cfg.proto != OSMO_SS7_ASP_PROT_SUA)
continue;
- num_rctx = get_all_rctx_for_asp(rctx, ARRAY_SIZE(rctx), asp, as);
+ num_rctx = ss7_asp_get_all_rctx_be(asp, rctx, ARRAY_SIZE(rctx), as);
/* this can happen if the given ASP is only in the AS that reports the change,
* which shall be excluded */
if (num_rctx == 0)
@@ -269,7 +247,7 @@
if (asp->cfg.role != OSMO_SS7_ASP_ROLE_SG)
continue;
- num_rctx = get_all_rctx_for_asp(rctx, ARRAY_SIZE(rctx), asp, as);
+ num_rctx = ss7_asp_get_all_rctx_be(asp, rctx, ARRAY_SIZE(rctx), as);
/* this can happen if the given ASP is only in the AS that reports the change,
* which shall be excluded */
if (num_rctx == 0)
@@ -299,7 +277,7 @@
if (asp->cfg.role != OSMO_SS7_ASP_ROLE_SG)
continue;
- num_rctx = get_all_rctx_for_asp(rctx, ARRAY_SIZE(rctx), asp, as);
+ num_rctx = ss7_asp_get_all_rctx_be(asp, rctx, ARRAY_SIZE(rctx), as);
/* this can happen if the given ASP is only in the AS that reports the change,
* which shall be excluded */
if (num_rctx == 0)
@@ -326,7 +304,7 @@
aff_pc = (const uint32_t *) ie_aff_pc->dat;
num_aff_pc = ie_aff_pc->len / sizeof(uint32_t);
- num_rctx = get_all_rctx_for_asp(rctx, ARRAY_SIZE(rctx), asp, NULL);
+ num_rctx = ss7_asp_get_all_rctx_be(asp, rctx, ARRAY_SIZE(rctx), NULL);
LOGPASP(asp, log_ss, LOGL_INFO, "Rx DAUD(%s) for %s\n", info_str ? info_str : "",
format_affected_pcs_c(xua, asp->inst, ie_aff_pc));
--
To view, visit https://gerrit.osmocom.org/c/libosmo-sigtran/+/40013?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: Ic3a1c0bd663fe33ab14828e30e057a8beaa84c3f
Gerrit-Change-Number: 40013
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>