pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-iuh/+/43593?usp=email )
Change subject: hnb-test: count N(SD) over uplink MM messages
......................................................................
hnb-test: count N(SD) over uplink MM messages
Setting N(SD) on the Authentication Response earlier in this series
fixed that one message. The TMSI Reallocation Complete that follows the
Location Updating Accept still went out with N(SD) = 0, so osmo-msc
dropped it as a duplicate as well and released the Location Update with
a reject when the TMSI reallocation timer expired.
Keep the send sequence number per signalling connection instead of
setting it per message. The Location Updating Request in the
InitialUE-Message is number 0, and every later uplink MM message, the
Identity Response, the Authentication Response and the TMSI
Reallocation Complete, takes the next value, two bits wide as on UTRAN
(3GPP TS 24.007 section 11.2.3.2.3).
This replaces the constant introduced earlier with a counter, so the
hard-coded value in gen_nas_auth_resp() goes away.
Change-Id: Ieceaee806be43a41e7662e8fa8d119e4e663a3d9
Signed-off-by: Andrei Gosman <andrei.gosman(a)gmail.com>
---
M tests/hnb-test.c
M tests/hnb-test.h
2 files changed, 27 insertions(+), 12 deletions(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, approved
laforge: Looks good to me, but someone else must approve
diff --git a/tests/hnb-test.c b/tests/hnb-test.c
index be9f170..86ee5a9 100644
--- a/tests/hnb-test.c
+++ b/tests/hnb-test.c
@@ -191,11 +191,24 @@
return 0;
}
-static struct msgb *gen_nas_id_resp()
+/* Message type octet of an uplink MM message with the send sequence number
+ * N(SD) in bits 7 and 6 (3GPP TS 24.007 section 11.2.3.2.3). The network
+ * drops a message whose N(SD) is not the one it expects as a duplicate,
+ * so every uplink MM message on a connection has to count: the Location
+ * Updating Request in the InitialUE-Message is number 0. */
+static uint8_t mm_msg_type_nsd(struct hnb_test *hnb, uint8_t msg_type)
+{
+ struct hnbtest_chan *chan = hnb->cur_chan ? hnb->cur_chan : hnb->cs.chan;
+ uint8_t n_sd = chan ? chan->n_sd++ : 0;
+
+ return (msg_type & 0x3f) | ((n_sd & 0x03) << 6);
+}
+
+static struct msgb *gen_nas_id_resp(struct hnb_test *hnb)
{
uint8_t id_resp[] = {
GSM48_PDISC_MM,
- GSM48_MT_MM_ID_RESP,
+ mm_msg_type_nsd(hnb, GSM48_MT_MM_ID_RESP),
/* IMEISV */
0x09, /* len */
0x03, /* first digit (0000) + even (0) + id IMEISV (011) */
@@ -206,11 +219,11 @@
return ranap_new_msg_dt(0, id_resp, sizeof(id_resp));
}
-static struct msgb *gen_nas_tmsi_realloc_compl()
+static struct msgb *gen_nas_tmsi_realloc_compl(struct hnb_test *hnb)
{
uint8_t id_resp[] = {
GSM48_PDISC_MM,
- GSM48_MT_MM_TMSI_REALL_COMPL,
+ mm_msg_type_nsd(hnb, GSM48_MT_MM_TMSI_REALL_COMPL),
};
return ranap_new_msg_dt(0, id_resp, sizeof(id_resp));
@@ -219,10 +232,8 @@
/* MM Authentication Response, 3GPP TS 24.008 section 9.2.3. For GSM AKA
* only the four octet SRES is present. For UMTS AKA the first four octets
* of RES go into that field and the rest into the Authentication Response
- * Parameter (extension) IE, as a UE does. The message type octet carries
- * N(SD) = 1: it is the second uplink MM message on the connection, after
- * the Location Updating Request (TS 24.007 section 11.2.3.2.3). */
-static struct msgb *gen_nas_auth_resp(const uint8_t *res, unsigned int res_len)
+ * Parameter (extension) IE, as a UE does. */
+static struct msgb *gen_nas_auth_resp(struct hnb_test *hnb, const uint8_t *res, unsigned int res_len)
{
uint8_t buf[2 + 4 + 2 + 12];
unsigned int len = 0;
@@ -230,7 +241,7 @@
OSMO_ASSERT(res_len >= 4 && res_len <= 16);
buf[len++] = GSM48_PDISC_MM;
- buf[len++] = 0x40 | GSM48_MT_MM_AUTH_RESP;
+ buf[len++] = mm_msg_type_nsd(hnb, GSM48_MT_MM_AUTH_RESP);
memcpy(buf + len, res, 4);
len += 4;
if (res_len > 4) {
@@ -439,7 +450,7 @@
if (res_len < 0)
return res_len;
- return hnb_test_tx_dt(hnb, gen_nas_auth_resp(res, res_len));
+ return hnb_test_tx_dt(hnb, gen_nas_auth_resp(hnb, res, res_len));
}
void hnb_test_tx_iu_release_req(struct hnb_test *hnb)
@@ -473,13 +484,13 @@
switch (msg_type) {
case GSM48_MT_MM_ID_REQ:
- return hnb_test_tx_dt(hnb, gen_nas_id_resp());
+ return hnb_test_tx_dt(hnb, gen_nas_id_resp(hnb));
case GSM48_MT_MM_LOC_UPD_ACCEPT:
if (hnb_test_nas_rx_lu_accept(gh, len, &sent_tmsi))
return -1;
if (sent_tmsi)
- return hnb_test_tx_dt(hnb, gen_nas_tmsi_realloc_compl());
+ return hnb_test_tx_dt(hnb, gen_nas_tmsi_realloc_compl(hnb));
else
return 0;
@@ -965,6 +976,7 @@
chan->imsi = talloc_strdup(chan, argv[1]);
chan->conn_id = conn_id;
conn_id++;
+ chan->n_sd = 1; /* the Location Updating Request below is number 0 */
msg = gen_initue_lu(chan->is_ps, chan->conn_id, chan->imsi);
rua = rua_new_conn(chan->is_ps, chan->conn_id, msg);
diff --git a/tests/hnb-test.h b/tests/hnb-test.h
index 44fba35..b3a0c11 100644
--- a/tests/hnb-test.h
+++ b/tests/hnb-test.h
@@ -43,6 +43,9 @@
int is_ps;
uint32_t conn_id;
char *imsi;
+ /*! N(SD) of the next uplink MM message on this connection,
+ * 3GPP TS 24.007 section 11.2.3.2.3 */
+ uint8_t n_sd;
};
struct hnb_test {
--
To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/43593?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Change-Id: Ieceaee806be43a41e7662e8fa8d119e4e663a3d9
Gerrit-Change-Number: 43593
Gerrit-PatchSet: 1
Gerrit-Owner: andrei.gosman(a)gmail.com <andrei.gosman(a)gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <daniel(a)totalueberwachung.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-iuh/+/43592?usp=email )
Change subject: hnb-test: parse LU Accept IEs after the LAI
......................................................................
hnb-test: parse LU Accept IEs after the LAI
The Location Updating Accept begins with the mandatory Location Area
Identification, a five octet V IE (3GPP TS 24.008 section 9.2.13). The
optional TLV IEs, among them the Mobile Identity carrying a new TMSI,
start after it.
hnb-test handed the whole message body to tlv_parse(), which read the
first LAI octet as an IEI and failed with
OSMO_TLVP_ERR_UNKNOWN_TLV_TYPE. The TMSI Reallocation Complete was
therefore never sent, and osmo-msc, which allocates a TMSI by default,
released the connection with a Location Updating Reject when its timer
expired.
Start the parser after the LAI, and read the identity type from the
Mobile Identity IE instead of the Network Name IE, which is not present
in this message and would have been dereferenced as NULL.
Change-Id: I2e1eb8e1bc3db5f20b04a3161713c8a47847c6dc
Signed-off-by: Andrei Gosman <andrei.gosman(a)gmail.com>
---
M tests/hnb-test.c
1 file changed, 8 insertions(+), 2 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
diff --git a/tests/hnb-test.c b/tests/hnb-test.c
index 6eca9df..be9f170 100644
--- a/tests/hnb-test.c
+++ b/tests/hnb-test.c
@@ -298,14 +298,20 @@
int parse_res;
len -= (const char *)&gh->data[0] - (const char *)gh;
- parse_res = tlv_parse(&tp, &gsm48_mm_att_tlvdef, &gh->data[0], len, 0, 0);
+
+ /* The Location Area Identification is a mandatory V IE of five octets
+ * at the start of the message body (TS 24.008 section 9.2.13); the
+ * TLV parser must start after it, or it takes the first LAI octet for
+ * an unknown IEI and fails. */
+ parse_res = tlv_parse(&tp, &gsm48_mm_att_tlvdef, &gh->data[sizeof(*lai)],
+ len - sizeof(*lai), 0, 0);
if (parse_res <= 0) {
printf("Error parsing Location Update Accept message: %d\n", parse_res);
return -1;
}
if (TLVP_PRESENT(&tp, GSM48_IE_MOBILE_ID)) {
- uint8_t type = TLVP_VAL(&tp, GSM48_IE_NAME_SHORT)[0] & 0x0f;
+ uint8_t type = TLVP_VAL(&tp, GSM48_IE_MOBILE_ID)[0] & 0x0f;
if (type == GSM_MI_TYPE_TMSI)
*sent_tmsi = 1;
else *sent_tmsi = 0;
--
To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/43592?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Change-Id: I2e1eb8e1bc3db5f20b04a3161713c8a47847c6dc
Gerrit-Change-Number: 43592
Gerrit-PatchSet: 1
Gerrit-Owner: andrei.gosman(a)gmail.com <andrei.gosman(a)gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Attention is currently required from: fixeria.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43690?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Verified-1 by Jenkins Builder
Change subject: bts: TC_nr_seq_error: handle occasional func=RR
......................................................................
bts: TC_nr_seq_error: handle occasional func=RR
TC_nr_seq_error() deliberately sends an I frame with a bad N(R) to
trigger a sequence error on the BTS side. In response, the BTS both
raises the sequence error (leading to a DISC once RSL requests link
release) and, independently, sends a routine func=RR ack, since it
considers itself "not busy" with no pending data at that point.
'''
((bts=0,trx=0,ts=1,ss=0)[DCCH][0]) we are not busy and have no pending data, send RR
'''
Whether that RR actually reaches the air depends on how soon the
channel gets its next Tx opportunity relative to the RSL RELEASE
REQ: on TCH/F (FACCH can steal almost any burst) the RR is typically
transmitted well before DISC is even queued, while on other channel
types it is usually superseded by DISC before ever being sent.
So the RR shows up on air intermittently, most reliably on TCH/F.
The test's alt only expects func=DISC, so an unexpected func=RR
stalls the queue and results in a failure "Missing DISC from BTS".
This problem did not manifest with fake_trx.py; the test only started
failing sporadically after migrating to osmo-trx-proxy, likely due
to its Tx queueing scheduling latency.
Change-Id: I49cb6dcfa66208df246f8da7116d9fc8cba1f11e
Related: OS#6638, OS#6672
---
M bts/BTS_Tests_LAPDm.ttcn
1 file changed, 2 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/90/43690/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43690?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I49cb6dcfa66208df246f8da7116d9fc8cba1f11e
Gerrit-Change-Number: 43690
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43690?usp=email )
Change subject: bts: TC_nr_seq_error: handle occasional func=RR
......................................................................
bts: TC_nr_seq_error: handle occasional func=RR
TC_nr_seq_error() deliberately sends an I frame with a bad N(R) to
trigger a sequence error on the BTS side. In response, the BTS both
raises the sequence error (leading to a DISC once RSL requests link
release) and, independently, sends a routine func=RR ack, since it
considers itself "not busy" with no pending data at that point.
'''
((bts=0,trx=0,ts=1,ss=0)[DCCH][0]) we are not busy and have no pending data, send RR
'''
Whether that RR actually reaches the air depends on how soon the
channel gets its next Tx opportunity relative to the RSL RELEASE
REQ: on TCH/F (FACCH can steal almost any burst) the RR is typically
transmitted well before DISC is even queued, while on other channel
types it is usually superseded by DISC before ever being sent.
So the RR shows up on air intermittently, most reliably on TCH/F.
The test's alt only expects func=DISC, so an unexpected func=RR
stalls the queue and results in a failure "Missing DISC from BTS".
This problem did not manifest with fake_trx.py; the test only started
failing sporadically after migrating to osmo-trx-proxy, likely due
to its Tx queueing scheduling latency.
Change-Id: I49cb6dcfa66208df246f8da7116d9fc8cba1f11e
Related: OS#6638, OS#6672
---
M bts/BTS_Tests_LAPDm.ttcn
1 file changed, 2 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/90/43690/1
diff --git a/bts/BTS_Tests_LAPDm.ttcn b/bts/BTS_Tests_LAPDm.ttcn
index fef2383..f091df9 100644
--- a/bts/BTS_Tests_LAPDm.ttcn
+++ b/bts/BTS_Tests_LAPDm.ttcn
@@ -814,6 +814,8 @@
T1.start;
alt{
[] LAPDM.receive(t_PH_DATA(0, false, tr_LAPDm_DISC(sapi, c_r:=cr_MT_CMD, p:=true)));
+ /* prior to func=DISC, the BTS may send a func=RR frame - ignore it */
+ [] LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_RR(sapi, c_r:=cr_MT_RSP, p:=?, nr:=?))) { repeat; }
[] T1.timeout{ setverdict(fail, "Missing DISC from BTS")}
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43690?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I49cb6dcfa66208df246f8da7116d9fc8cba1f11e
Gerrit-Change-Number: 43690
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Attention is currently required from: pespin.
andrei.gosman(a)gmail.com has posted comments on this change by andrei.gosman(a)gmail.com. ( https://gerrit.osmocom.org/c/libosmocore/+/43574?usp=email )
Change subject: core/socket: init_osa: pass family-correct len
......................................................................
Patch Set 1:
(1 comment)
File src/core/socket.c:
https://gerrit.osmocom.org/c/libosmocore/+/43574/comment/f6d0e720_7a3187ed?… :
PS1, Line 603: if (bind(sfd, &local->u.sa, osmo_sockaddr_size(local)) == -1) {
> Context: this patch is […]
Correction to my previous comment in this thread, which is wrong. The union's sockaddr_storage member does represent an AF_UNIX address: sockaddr_un is 106 bytes on Darwin against a 128 byte union, and libosmocore relies on that in osmo_sock_get_name_buf(), which reads the AF_UNIX case back through a struct sockaddr_un *. So AF_UNIX can reach this code path. That comment was an unsent draft published by accident together with my cover message. Please take the cover message on patch set 1 as my answer instead.
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/43574?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: I37cb08a6e1809d51c97e666f980d4c68f8b56933
Gerrit-Change-Number: 43574
Gerrit-PatchSet: 1
Gerrit-Owner: andrei.gosman(a)gmail.com <andrei.gosman(a)gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 21 Sep 2026 18:49:21 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Comment-In-Reply-To: andrei.gosman(a)gmail.com <andrei.gosman(a)gmail.com>