Attention is currently required from: Hoernchen, laforge, pespin.
pespin has posted comments on this change by laforge. ( https://gerrit.osmocom.org/c/libosmocore/+/37874?usp=email )
Change subject: core/socket.c: Fix socket binding on IPv4-only hosts
......................................................................
Patch Set 1:
(1 comment)
Commit Message:
https://gerrit.osmocom.org/c/libosmocore/+/37874/comment/35b14eda_3bdccc24?… :
PS1, Line 19: > valid as a configured address. *This flag is useful on, for example,
so does that mean that if I have a system with no net card, then getaddrinfo() will fail to provide a localhost address?
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/37874?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I5690a25af98089e3a8a092cb91dfc969720abdc0
Gerrit-Change-Number: 37874
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 20 Aug 2024 09:42:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/37874?usp=email )
Change subject: core/socket.c: Fix socket binding on IPv4-only hosts
......................................................................
core/socket.c: Fix socket binding on IPv4-only hosts
Let's add the AI_ADDRCONFIG flag to prevent getaddrinfo() from returning
IPv6 addresses on sytems that have no IPv6.
From the manpage:
> If hints.ai_flags includes the AI_ADDRCONFIG flag, then IPv4
> addresses are returned in the list pointed to by res only if the local
> system has at least one IPv4 address configured, and IPv6 addresses are
> returned only if the local system has at least one IPv6 address
> configured. The loopback address is not considered for this case as
> valid as a configured address. *This flag is useful on, for example,
> IPv4-only systems, to ensure that getaddrinfo() does not return IPv6
> socket addresses that would always fail in connect(2) or bind(2).*
Change-Id: I5690a25af98089e3a8a092cb91dfc969720abdc0
Closes: OS#7074
---
M src/core/socket.c
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/74/37874/1
diff --git a/src/core/socket.c b/src/core/socket.c
index 97708a7..7d10e7b 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -66,6 +66,7 @@
snprintf(portbuf, sizeof(portbuf), "%u", port);
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = family;
+ hints.ai_flsgs = AI_ADDRCONFIG;
if (type == SOCK_RAW) {
/* Workaround for glibc, that returns EAI_SERVICE (-8) if
* SOCK_RAW and IPPROTO_GRE is used.
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/37874?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: I5690a25af98089e3a8a092cb91dfc969720abdc0
Gerrit-Change-Number: 37874
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/37873?usp=email )
Change subject: llc: Mark old/current tlli as all 1's when unassigning LLME
......................................................................
llc: Mark old/current tlli as all 1's when unassigning LLME
TS 44.064 section 8.3.3 (and other sections) talk about special
unassigned value of "all 1's", but I couldn't find any reference to a
"all 0's" specific value/meaning.
In practice in the code this may not be super important since those
values may not ve checked due to the FSM state, but in any case they are
initially set to all 1's, so it makes total sense to re-set them to the
same unassigned value instead of a randomly chosen all 0's value.
This is a port of osmo-sgsn.git 35c178e84d25a216a5c2d9bd1320d072e36937fa.
Change-Id: I9db198a31963db015e887e33baf3c32b46e2b11a
---
M src/llc/llc_llgmm.c
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-gprs refs/changes/73/37873/1
diff --git a/src/llc/llc_llgmm.c b/src/llc/llc_llgmm.c
index 27150cc..125923a 100644
--- a/src/llc/llc_llgmm.c
+++ b/src/llc/llc_llgmm.c
@@ -212,7 +212,7 @@
gprs_llc_llme_submit_prim_ll_assign_ind(old_tlli, new_tlli);
} else if (old_tlli != TLLI_UNASSIGNED && new_tlli == TLLI_UNASSIGNED) {
/* TLLI Unassignment 8.3.3) */
- llme->tlli = llme->old_tlli = 0;
+ llme->tlli = llme->old_tlli = TLLI_UNASSIGNED;
llme->state = OSMO_GPRS_LLC_LLMS_ASSIGNED;
for (i = 0; i < ARRAY_SIZE(llme->lle); i++) {
struct gprs_llc_lle *l = &llme->lle[i];
--
To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/37873?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: I9db198a31963db015e887e33baf3c32b46e2b11a
Gerrit-Change-Number: 37873
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/37871?usp=email )
Change subject: llc: Mark old/current tlli as all 1's when unassigning LLME
......................................................................
llc: Mark old/current tlli as all 1's when unassigning LLME
TS 44.064 section 8.3.3 (and other sections) talk about special
unassigned value of "all 1's", but I couldn't find any reference to a
"all 0's" specific value/meaning.
In practice in the code this may not be super important since those
values may not ve checked due to the FSM state, but in any case they are
initially set to all 1's, so it makes total sense to re-set them to the
same unassigned value instead of a randomly chosen all 0's value.
Change-Id: I660c8d0ef08b34f8cb74fd51b5c59e5628d687ae
---
M src/sgsn/gprs_llc.c
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
fixeria: Looks good to me, but someone else must approve
lynxis lazus: Looks good to me, approved
diff --git a/src/sgsn/gprs_llc.c b/src/sgsn/gprs_llc.c
index 6f56385..82e876d 100644
--- a/src/sgsn/gprs_llc.c
+++ b/src/sgsn/gprs_llc.c
@@ -1112,7 +1112,7 @@
llme->state = GPRS_LLMS_ASSIGNED;
} else if (old_tlli != TLLI_UNASSIGNED && new_tlli == TLLI_UNASSIGNED) {
/* TLLI Unassignment 8.3.3) */
- llme->tlli = llme->old_tlli = 0;
+ llme->tlli = llme->old_tlli = TLLI_UNASSIGNED;
llme->state = GPRS_LLMS_UNASSIGNED;
for (i = 0; i < ARRAY_SIZE(llme->lle); i++) {
struct gprs_llc_lle *l = &llme->lle[i];
--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/37871?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I660c8d0ef08b34f8cb74fd51b5c59e5628d687ae
Gerrit-Change-Number: 37871
Gerrit-PatchSet: 1
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: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/37870?usp=email )
Change subject: Fix double free during RAU with unexpected Old RAI
......................................................................
Fix double free during RAU with unexpected Old RAI
If an MS which had an MMCTX at the SGSN sent RAU update with an
unexpected Old RA field, the RAU was rejected and LLME (LLC layer)
unassigned (freed), because no MMCTX was found matching the wrong old
RA.
However, an MMCTX may actually exist pointing to that LLME, and hence
when the LLME is freed, it stayed unnoticed with a dangling pointer to
the freed LLME in ctx->gb.llme.
Let's try to harder to avoid this kind of bugs which make osmo-sgsn
crash.
Once we properly split the code into separate independent layers (LLC,
MMCTX, etc.) each holding their own structs, this kind of bugs shouldn't
happen anymore.
Related: OS#6441
Change-Id: I5a4328c6e945b85dd815215724feecadba59c435
---
M include/osmocom/sgsn/mmctx.h
M src/sgsn/gprs_gmm.c
M src/sgsn/mmctx.c
3 files changed, 31 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
fixeria: Looks good to me, but someone else must approve
lynxis lazus: Looks good to me, approved
diff --git a/include/osmocom/sgsn/mmctx.h b/include/osmocom/sgsn/mmctx.h
index c19f599..5e4662f 100644
--- a/include/osmocom/sgsn/mmctx.h
+++ b/include/osmocom/sgsn/mmctx.h
@@ -257,6 +257,7 @@
struct sgsn_mm_ctx *sgsn_mm_ctx_by_ptmsi(uint32_t tmsi);
struct sgsn_mm_ctx *sgsn_mm_ctx_by_imsi(const char *imsi);
struct sgsn_mm_ctx *sgsn_mm_ctx_by_ue_ctx(const void *uectx);
+struct sgsn_mm_ctx *sgsn_mm_ctx_by_llme(const struct gprs_llc_llme *llme);
/* look-up by matching TLLI and P-TMSI (think twice before using this) */
struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli_and_ptmsi(uint32_t tlli,
diff --git a/src/sgsn/gprs_gmm.c b/src/sgsn/gprs_gmm.c
index ab8b7ef..911d42d 100644
--- a/src/sgsn/gprs_gmm.c
+++ b/src/sgsn/gprs_gmm.c
@@ -1748,6 +1748,21 @@
* in the MS */
LOGGBP(llme, DMM, LOGL_NOTICE, "LLC XID RESET\n");
gprs_llgmm_reset_oldmsg(msg, GPRS_SAPI_GMM, llme);
+
+ /* The RAU didn't come from expected TLLI+RAI, so it's for sure bad and should be rejected.
+ * In any case, before unassigning (freeing) the LLME during the REJECT below, make sure
+ * beforehand that if there's an mmctx relating to that llme it is also freed.
+ * Otherwise it would be kept pointining at a dangling freed llme object.
+ */
+ mmctx = sgsn_mm_ctx_by_llme(llme);
+ if (mmctx) {
+ char old_ra_id_name[32];
+ osmo_rai_name_buf(old_ra_id_name, sizeof(old_ra_id_name), &old_ra_id);
+ LOGMMCTXP(LOGL_NOTICE, mmctx,
+ "Rx RA Update Request with unexpected TLLI=%08x Old RA=%s (expected Old RA: %s)!\n",
+ msgb_tlli(msg), old_ra_id_name, osmo_rai_name(&mmctx->ra));
+ /* mmctx will be released (and its llme un assigned) after REJECT below. */
+ }
}
/* The MS has to perform GPRS attach */
/* Device is still IMSI attached for CS but initiate GPRS ATTACH,
diff --git a/src/sgsn/mmctx.c b/src/sgsn/mmctx.c
index 0e93092..459f6cf 100644
--- a/src/sgsn/mmctx.c
+++ b/src/sgsn/mmctx.c
@@ -105,6 +105,21 @@
return NULL;
}
+
+/* look-up an SGSN MM context based on Gb LLME context (struct gprs_llc_llme)*/
+struct sgsn_mm_ctx *sgsn_mm_ctx_by_llme(const struct gprs_llc_llme *llme)
+{
+ struct sgsn_mm_ctx *ctx;
+
+ llist_for_each_entry (ctx, &sgsn->mm_list, list) {
+ if (ctx->ran_type == MM_CTX_T_GERAN_Gb
+ && llme == ctx->gb.llme)
+ return ctx;
+ }
+
+ return NULL;
+}
+
/* look-up a SGSN MM context based on TLLI + RAI */
struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli(uint32_t tlli,
const struct gprs_ra_id *raid)
--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/37870?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I5a4328c6e945b85dd815215724feecadba59c435
Gerrit-Change-Number: 37870
Gerrit-PatchSet: 1
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: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37862?usp=email )
(
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: sgsn: Fix running with testenv.py podman setup
......................................................................
sgsn: Fix running with testenv.py podman setup
The initial testenv.py setup introduced in osmo-ttcn3-hacks.git
6baec93cb85fa8a0051e9aacd0178e90adbfdadc lacked some recent updates to
the ttcn3 testsuite setup where a second IP address is added to the
container in order to distinguish between RNC and CN in GTPU.
Change-Id: Ia0af52f8b7d61c15bdf2b6152fae27dd003d00e8
---
M sgsn/SGSN_Tests.cfg
M sgsn/osmo-stp.cfg
2 files changed, 2 insertions(+), 2 deletions(-)
Approvals:
fixeria: Looks good to me, approved
Jenkins Builder: Verified
lynxis lazus: Looks good to me, but someone else must approve
diff --git a/sgsn/SGSN_Tests.cfg b/sgsn/SGSN_Tests.cfg
index 4f92ac2..365d4cd 100644
--- a/sgsn/SGSN_Tests.cfg
+++ b/sgsn/SGSN_Tests.cfg
@@ -55,7 +55,7 @@
}
SGSN_Tests.mp_ranap_cfg := {
{
- sctp_addr := { 23908, "127.0.0.103", 2905, "127.0.0.200" }
+ sctp_addr := { 23908, "127.0.0.104", 2905, "127.0.0.200" }
}
}
SGSN_Tests.mp_hlr_ip := "127.0.0.103"
diff --git a/sgsn/osmo-stp.cfg b/sgsn/osmo-stp.cfg
index 23c4e8f..e79c298 100644
--- a/sgsn/osmo-stp.cfg
+++ b/sgsn/osmo-stp.cfg
@@ -39,7 +39,7 @@
xua rkm routing-key-allocation dynamic-permitted
asp virt-rnc0-0 23908 2905 m3ua
local-ip 127.0.0.200
- remote-ip 127.0.0.103
+ remote-ip 127.0.0.104
role sg
sctp-role server
as virt-rnc0 m3ua
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37862?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ia0af52f8b7d61c15bdf2b6152fae27dd003d00e8
Gerrit-Change-Number: 37862
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>