aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2021-07-02 16:12:28 +0200
committerAlexander Couzens <lynxis@fe80.eu>2021-07-02 17:38:02 +0200
commitdb7b2ab36bd6fb8ae766abd6e1bdf91d2e1a13c7 (patch)
tree729ee44a9ed4503cc2c51e57850c8352249daa88 /tests
parentd9825c0a2cfeab682f29167b11aaa154b8a36bae (diff)
gprs_ns2: fix crash when changing the MTU
When the MTU changes for any fr device, all NSE will recalculate their MTU. If any NSE is alive, libosmocore will crash. Related: OS#5192 Change-Id: I31ba5cefea7bbb0b74060d6664b42c58815ee2a1
Diffstat (limited to 'tests')
-rw-r--r--tests/gb/gprs_ns2_test.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/gb/gprs_ns2_test.c b/tests/gb/gprs_ns2_test.c
index c53cc6d6..b96e739f 100644
--- a/tests/gb/gprs_ns2_test.c
+++ b/tests/gb/gprs_ns2_test.c
@@ -41,6 +41,7 @@ int bssgp_prim_cb(struct osmo_prim_hdr *oph, void *ctx)
static struct log_info info = {};
static struct osmo_wqueue *unitdata = NULL;
static struct osmo_gprs_ns2_prim last_nse_recovery = {};
+static struct osmo_gprs_ns2_prim last_nse_mtu_change = {};
static int ns_prim_cb(struct osmo_prim_hdr *oph, void *ctx)
{
@@ -54,8 +55,12 @@ static int ns_prim_cb(struct osmo_prim_hdr *oph, void *ctx)
msgb_free(oph->msg);
}
}
- if (oph->primitive == GPRS_NS2_PRIM_STATUS && nsp->u.status.cause == GPRS_NS2_AFF_CAUSE_RECOVERY) {
- last_nse_recovery = *nsp;
+ if (oph->primitive == GPRS_NS2_PRIM_STATUS) {
+ if (nsp->u.status.cause == GPRS_NS2_AFF_CAUSE_RECOVERY) {
+ last_nse_recovery = *nsp;
+ } else if (nsp->u.status.cause == GPRS_NS2_AFF_CAUSE_MTU_CHANGE) {
+ last_nse_mtu_change = *nsp;
+ }
}
return 0;
}
@@ -579,6 +584,10 @@ void test_mtu(void *ctx)
/* 1b NS PDU type, 1b NS SDU control, 2b BVCI */
OSMO_ASSERT(last_nse_recovery.u.status.mtu == 123 - 4);
+ bind[0]->mtu = 100;
+ ns2_nse_update_mtu(nse);
+ OSMO_ASSERT(last_nse_mtu_change.u.status.mtu == 100 - 4);
+
gprs_ns2_free(nsi);
printf("--- Finish unitdata test\n");
}