Attention is currently required from: neels.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37077?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: hnbgw: TC_hnb_disconnected_timeout; Osmocom_CTRL_Functions
......................................................................
hnbgw: TC_hnb_disconnected_timeout; Osmocom_CTRL_Functions
Test the new timer hnbgw X35: discard all hnb_persistent state after a
given timeout.
While a hnb_persistent is present, its rate_ctrs and stat_items remain
present. When it is discarded, these vanish again. Use this to verify
that discarding and re-registering a hnb_persistent works.
Teach the CTRL functions that retrieve rate counters to return counters
of -1 when a requested object is not present, instead of erroring and
stopping the test. Like this we can expect absence of an object.
Set X35 to five seconds, drop the Iuh link, wait and verify that the
rate counter group for the hnb_persistent is gone.
Then reconnect and disconnect again, to provoke errors like
use-after-free.
Depends: osmo-hnbgw Ic819d7cbc03fb39e98c204b70d016c5170dc6307
Related: SYS#6773
Change-Id: Ibec009203d38f65714561b7c28edbdbd8b34e704
---
M hnbgw/HNBGW_Tests.ttcn
M library/Osmocom_CTRL_Functions.ttcn
2 files changed, 171 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/77/37077/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37077?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ibec009203d38f65714561b7c28edbdbd8b34e704
Gerrit-Change-Number: 37077
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: newpatchset
neels has abandoned this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/36888?usp=email )
Change subject: change back dispatch ordering in map_rua_init_action()
......................................................................
Abandoned
this other patch avoids all described use-after-free situations: https://gerrit.osmocom.org/c/osmo-hnbgw/+/37147
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/36888?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: Ie277c46d153bc12dc28a914c241392cdf5ec0aa4
Gerrit-Change-Number: 36888
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: abandon
neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/36141?usp=email )
Change subject: improve HNBAP error logging
......................................................................
improve HNBAP error logging
We have a situation where HNBAP is not answered by osmo-hnbgw, and the
log is all silent. Add logging to a lot more of the possible HNBAP
failure paths to find out what is wrong.
Related: SYS#6810
Change-Id: I17d2809f59087d32e7c11a3ada1d3fadf6f0b660
---
M src/osmo-hnbgw/hnbgw.c
M src/osmo-hnbgw/hnbgw_hnbap.c
2 files changed, 33 insertions(+), 4 deletions(-)
Approvals:
neels: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/src/osmo-hnbgw/hnbgw.c b/src/osmo-hnbgw/hnbgw.c
index 6f74d04..43fcaca 100644
--- a/src/osmo-hnbgw/hnbgw.c
+++ b/src/osmo-hnbgw/hnbgw.c
@@ -155,8 +155,7 @@
struct ue_context *ue;
ue = talloc_zero(g_hnbgw, struct ue_context);
- if (!ue)
- return NULL;
+ OSMO_ASSERT(ue);
ue->hnb = hnb;
if (imsi)
diff --git a/src/osmo-hnbgw/hnbgw_hnbap.c b/src/osmo-hnbgw/hnbgw_hnbap.c
index b220918..f860173 100644
--- a/src/osmo-hnbgw/hnbgw_hnbap.c
+++ b/src/osmo-hnbgw/hnbgw_hnbap.c
@@ -194,6 +194,9 @@
rc = hnbap_encode_ueregisteraccepties(&accept_out, &accept);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_OCTET_STRING, &accept.uE_Identity.choice.iMSI);
if (rc < 0) {
+ LOGHNB(ue->hnb, DHNBAP, LOGL_ERROR,
+ "Failed to encode HNBAP UE Register Accept message for UE IMSI-%s TMSI-0x%08x\n",
+ ue->imsi, ue->tmsi);
return rc;
}
@@ -204,7 +207,12 @@
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_HNBAP_UERegisterAccept, &accept_out);
- return hnbgw_hnbap_tx(ue->hnb, msg);
+ rc = hnbgw_hnbap_tx(ue->hnb, msg);
+ if (rc)
+ LOGHNB(ue->hnb, DHNBAP, LOGL_ERROR,
+ "Failed to enqueue HNBAP UE Register Accept message for UE IMSI-%s TMSI-0x%08x\n",
+ ue->imsi, ue->tmsi);
+ return rc;
}
static int hnbgw_tx_ue_register_rej(struct hnb_context *hnb, HNBAP_UE_Identity_t *ue_id, const struct HNBAP_Cause *cause)
@@ -426,6 +434,7 @@
}
if (rc < 0) {
+ LOGHNB(hnb, DHNBAP, LOGL_ERROR, "Failed to encode HNBAP UE Register Accept for TMSI 0x%08x\n", tmsi);
/* Encoding failed. Nothing in 'accept_out'. */
/* If we allocated the UE context but the UE REGISTER fails, get rid of it again: there will likely
* never be a UE DE-REGISTER for this UE from the HNB, and the ue_context would linger forever. */
@@ -441,6 +450,8 @@
&accept_out);
rc = hnbgw_hnbap_tx(hnb, msg);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_HNBAP_UERegisterAccept, &accept_out);
+ if (rc)
+ LOGHNB(hnb, DHNBAP, LOGL_ERROR, "Failed to transmit HNBAP UE Register Accept for TMSI 0x%08x\n", tmsi);
return rc;
}
@@ -642,14 +653,19 @@
ue = ue_context_by_imsi(imsi);
if (!ue)
ue = ue_allocated = ue_context_alloc(ctx, imsi, 0);
+ else
+ LOGHNB(ctx, DHNBAP, LOGL_DEBUG, "UE context for IMSI %s already exists\n", imsi);
/* Send UERegisterAccept */
rc = hnbgw_tx_ue_register_acc(ue);
if (rc < 0) {
+ LOGHNB(ctx, DHNBAP, LOGL_ERROR, "Failed to transmit HNBAP UE Register Accept for IMSI %s\n", imsi);
/* If we allocated the UE context but the UE REGISTER fails, get rid of it again: there will likely
* never be a UE DE-REGISTER for this UE from the HNB, and the ue_context would linger forever. */
- if (ue_allocated)
+ if (ue_allocated) {
ue_context_free(ue_allocated);
+ LOGHNB(ctx, DHNBAP, LOGL_INFO, "Freed UE context for IMSI %s\n", imsi);
+ }
}
free_and_return_rc:
hnbap_free_ueregisterrequesties(&ies);
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/36141?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I17d2809f59087d32e7c11a3ada1d3fadf6f0b660
Gerrit-Change-Number: 36141
Gerrit-PatchSet: 4
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: merged
Attention is currently required from: dexter.
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/36141?usp=email )
Change subject: improve HNBAP error logging
......................................................................
Patch Set 3:
(1 comment)
Patchset:
PS3:
i'm giving this the benefit of the doubt, because it is so trivial
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/36141?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I17d2809f59087d32e7c11a3ada1d3fadf6f0b660
Gerrit-Change-Number: 36141
Gerrit-PatchSet: 3
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: dexter <pmaier(a)sysmocom.de>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 11 Jun 2024 00:40:38 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Jenkins Builder has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/37188?usp=email )
Change subject: nft-kpi: remove X34 drifting: adjust delay by elapsed time
......................................................................
Patch Set 1:
(1 comment)
File src/osmo-hnbgw/nft_kpi.c:
Robot Comment from checkpatch (run ID jenkins-gerrit-lint-16677):
https://gerrit.osmocom.org/c/osmo-hnbgw/+/37188/comment/86626ffa_5787dfd3
PS1, Line 729: LOGP(DNFT, LOGL_DEBUG, "nft-kpi: scheduling timer: period is %ld.%06ld s, next occurence in %ld.%06ld s\n",
'occurence' may be misspelled - perhaps 'occurrence'?
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/37188?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I04f572890c04a48bb19c59f613a492ef96624baa
Gerrit-Change-Number: 37188
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-CC: Jenkins Builder
Gerrit-Comment-Date: Tue, 11 Jun 2024 00:38:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/37187?usp=email )
Change subject: nft-kpi: log errors of counter retrieval
......................................................................
nft-kpi: log errors of counter retrieval
Make sure errors of getting counters from nft are logged.
Some context: we'll try again each X34 period, hence this is only a
problem when the error persists.
For example, when the get-counters thread is faster than the maintenance
thread can even create the nft table initially, this error will show.
We could add a definite check whether the maintenance thread has created
the tables yet, and wait for that event. But this complexity is not
really needed: it is fine to just fail getting counters once or twice.
Related: SYS#6773
Change-Id: I84340482e4a5bfcac158a21c9378a9511fa5ea10
---
M src/osmo-hnbgw/nft_kpi.c
1 file changed, 30 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/87/37187/1
diff --git a/src/osmo-hnbgw/nft_kpi.c b/src/osmo-hnbgw/nft_kpi.c
index 5f2359b..4fa932f 100644
--- a/src/osmo-hnbgw/nft_kpi.c
+++ b/src/osmo-hnbgw/nft_kpi.c
@@ -990,7 +990,14 @@
break;
case NFT_THREAD_GET_COUNTERS:
- main_thread_handle_get_counters_resp(req);
+ if (req->rc) {
+ /* Maybe we requested counters before the table was created by the maintenance thread. If so,
+ * it's not harmful and we can just try again next time. */
+ LOGP(DNFT, LOGL_ERROR, "Retrieving counters from nftables failed. Trying again (timer X34).\n");
+ } else {
+ main_thread_handle_get_counters_resp(req);
+ }
+ /* Schedule the next counter retrieval. */
nft_kpi_get_counters_schedule();
break;
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/37187?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I84340482e4a5bfcac158a21c9378a9511fa5ea10
Gerrit-Change-Number: 37187
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: newchange
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/37188?usp=email )
Change subject: nft-kpi: remove X34 drifting: adjust delay by elapsed time
......................................................................
nft-kpi: remove X34 drifting: adjust delay by elapsed time
Change-Id: I04f572890c04a48bb19c59f613a492ef96624baa
---
M include/osmocom/hnbgw/hnbgw.h
M src/osmo-hnbgw/nft_kpi.c
2 files changed, 48 insertions(+), 6 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/88/37188/1
diff --git a/include/osmocom/hnbgw/hnbgw.h b/include/osmocom/hnbgw/hnbgw.h
index 36358b1..a647abd 100644
--- a/include/osmocom/hnbgw/hnbgw.h
+++ b/include/osmocom/hnbgw/hnbgw.h
@@ -499,6 +499,7 @@
struct {
bool active;
struct osmo_timer_list get_counters_timer;
+ struct timespec next_timer;
} nft_kpi;
};
diff --git a/src/osmo-hnbgw/nft_kpi.c b/src/osmo-hnbgw/nft_kpi.c
index 4fa932f..aff981f 100644
--- a/src/osmo-hnbgw/nft_kpi.c
+++ b/src/osmo-hnbgw/nft_kpi.c
@@ -690,15 +690,47 @@
/* main thread */
static void nft_kpi_get_counters_schedule(void)
{
- unsigned long period_s;
+ struct timespec now;
+ struct timespec period;
+ struct timespec diff;
+ struct timespec *next = &g_hnbgw->nft_kpi.next_timer;
unsigned long period_us = osmo_tdef_get(hnbgw_T_defs, -34, OSMO_TDEF_US, 1000000);
- if (period_us < 1)
- period_us = 1;
- period_s = period_us / 1000000;
- period_us %= 1000000;
+ period.tv_sec = period_us / 1000000;
+ period.tv_nsec = (period_us % 1000000) * 1000;
+
+ /* Try to keep the period of getting counters close to the configured period, i.e. don't drift by the time it
+ * takes to read counters. */
+ osmo_clock_gettime(CLOCK_MONOTONIC, &now);
+
+ if (!next->tv_sec && !next->tv_nsec) {
+ /* Not yet initialized. Schedule to get counters one 'period' from 'now':
+ * Set 'next' to 'now', and the period is added by timespecadd() below.
+ * (We could retrieve counters immediately -- but at startup counters are then queried even before the
+ * nft table was created by the maintenance thread. That is not harmful, but it causes an ugly error
+ * message in the logs. So rather wait one period.)
+ */
+ *next = now;
+ }
+ timespecadd(next, &period, next);
+ if (timespeccmp(next, &now, <)) {
+ /* The time that has elapsed since last scheduling counter retrieval is already more than the configured
+ * period. Continue counting the time period from 'now', and ask for counters right now. */
+ timespecsub(&now, next, &diff);
+ LOGP(DNFT, LOGL_NOTICE, "nft-kpi: retrieving counters took %ld.%06ld s longer"
+ " than the timeout configured in timer hnbgw X34.\n", diff.tv_sec, diff.tv_nsec / 1000);
+ *next = now;
+ nft_kpi_get_counters_cb(NULL);
+ return;
+ }
+
+ /* next > now, wait for the remaining time. */
+ timespecsub(next, &now, &diff);
+ LOGP(DNFT, LOGL_DEBUG, "nft-kpi: scheduling timer: period is %ld.%06ld s, next occurence in %ld.%06ld s\n",
+ period.tv_sec, period.tv_nsec / 1000,
+ diff.tv_sec, diff.tv_nsec / 1000);
osmo_timer_setup(&g_hnbgw->nft_kpi.get_counters_timer, nft_kpi_get_counters_cb, NULL);
- osmo_timer_schedule(&g_hnbgw->nft_kpi.get_counters_timer, period_s, period_us);
+ osmo_timer_schedule(&g_hnbgw->nft_kpi.get_counters_timer, diff.tv_sec, diff.tv_nsec / 1000);
}
/* from main(), initialize all worker threads and other nft state. */
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/37188?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I04f572890c04a48bb19c59f613a492ef96624baa
Gerrit-Change-Number: 37188
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: newchange