diff options
-rw-r--r-- | src/gb/gprs_ns.c | 6 | ||||
-rw-r--r-- | tests/gb/gprs_ns_test.c | 18 | ||||
-rw-r--r-- | tests/gb/gprs_ns_test.ok | 84 |
3 files changed, 108 insertions, 0 deletions
diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c index aa43bb8b..a29c9464 100644 --- a/src/gb/gprs_ns.c +++ b/src/gb/gprs_ns.c @@ -615,6 +615,12 @@ static void gprs_ns_timer_cb(void *data) break; case NSVC_TIMER_TNS_RESET: rate_ctr_inc(&nsvc->ctrg->ctr[NS_CTR_LOST_RESET]); + if (!(nsvc->state & NSE_S_RESET)) + LOGP(DNS, LOGL_NOTICE, + "NSEI=%u Reset timed out but RESET flag is not set\n", + nsvc->nsei); + /* Mark NS-VC locally as blocked and dead */ + nsvc->state = NSE_S_BLOCKED | NSE_S_RESET; /* Chapter 7.3: Re-send the RESET */ gprs_ns_tx_reset(nsvc, NS_CAUSE_OM_INTERVENTION); /* Re-start Tns-reset timer */ diff --git a/tests/gb/gprs_ns_test.c b/tests/gb/gprs_ns_test.c index 00b8732e..a742130f 100644 --- a/tests/gb/gprs_ns_test.c +++ b/tests/gb/gprs_ns_test.c @@ -710,6 +710,24 @@ static void test_bss_reset_ack() send_ns_reset_ack(nsi, nse[0], 0xf001, 0x1000); gprs_dump_nsi(nsi); + /* Test crossing RESET and UNBLOCK_ACK */ + + printf("--- RESET (BSS -> SGSN) crossing an UNBLOCK_ACK (SGSN -> BSS) ---\n\n"); + + setup_ns(nsi, nse[0], 0x1001, 0x1000); + nsvc = gprs_nsvc_by_nsvci(nsi, 0x1001); + gprs_nsvc_reset(nsvc, NS_CAUSE_OM_INTERVENTION); + OSMO_ASSERT(nsvc->state & NSE_S_BLOCKED); + OSMO_ASSERT(nsvc->state & NSE_S_RESET); + send_ns_unblock_ack(nsi, nse[0]); + gprs_dump_nsi(nsi); + send_ns_reset_ack(nsi, nse[0], 0x1001, 0x1000); + expire_nsvc_timer(nsvc); + OSMO_ASSERT(nsvc->state & NSE_S_BLOCKED); + OSMO_ASSERT(nsvc->state & NSE_S_RESET); + send_ns_reset_ack(nsi, nse[0], 0x1001, 0x1000); + gprs_dump_nsi(nsi); + gprs_ns_destroy(nsi); nsi = NULL; } diff --git a/tests/gb/gprs_ns_test.ok b/tests/gb/gprs_ns_test.ok index 1e0bf7f8..b0c81e44 100644 --- a/tests/gb/gprs_ns_test.ok +++ b/tests/gb/gprs_ns_test.ok @@ -569,6 +569,90 @@ Current NS-VCIs: NS-VC replaced other count: 2 NS-VC changed NSEI count : 3 +--- RESET (BSS -> SGSN) crossing an UNBLOCK_ACK (SGSN -> BSS) --- + +Setup NS-VC: remote 0x01020304:2222, NSVCI 0x1001(4097), NSEI 0x1000(4096) + +PROCESSING RESET from 0x01020304:2222 +02 00 81 01 01 82 10 01 04 82 10 00 + +==> got signal NS_REPLACED: 0x1001/0.0.0.0:0 -> 0xf001/1.2.3.4:2222 +==> got signal NS_RESET, NS-VC 0x1001/1.2.3.4:2222 +MESSAGE to BSS, msg length 9 +03 01 82 10 01 04 82 10 00 + +MESSAGE to BSS, msg length 1 +0a + +result (RESET) = 9 + +PROCESSING ALIVE from 0x01020304:2222 +0a + +MESSAGE to BSS, msg length 1 +0b + +result (ALIVE) = 1 + +PROCESSING UNBLOCK from 0x01020304:2222 +06 + +==> got signal NS_UNBLOCK, NS-VC 0x1001/1.2.3.4:2222 +MESSAGE to BSS, msg length 1 +07 + +result (UNBLOCK) = 1 + +PROCESSING ALIVE_ACK from 0x01020304:2222 +0b + +result (ALIVE_ACK) = 0 + +MESSAGE to BSS, msg length 12 +02 00 81 01 01 82 10 01 04 82 10 00 + +PROCESSING UNBLOCK_ACK from 0x01020304:2222 +07 + +==> got signal NS_UNBLOCK, NS-VC 0x1001/1.2.3.4:2222 +result (UNBLOCK_ACK) = 0 + +Current NS-VCIs: + VCI 0xf001, NSEI 0x1000, peer 0x00000000:0, blocked + NS-VC Block count : 1 + NS-VC replaced other count: 2 + VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111 + VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222 + NS-VC Block count : 4 + NS-VC replaced other count: 3 + NS-VC changed NSEI count : 4 + +PROCESSING RESET_ACK from 0x01020304:2222 +03 01 82 10 01 04 82 10 00 + +result (RESET_ACK) = 0 + +MESSAGE to BSS, msg length 12 +02 00 81 01 01 82 10 01 04 82 10 00 + +PROCESSING RESET_ACK from 0x01020304:2222 +03 01 82 10 01 04 82 10 00 + +MESSAGE to BSS, msg length 1 +0a + +result (RESET_ACK) = 1 + +Current NS-VCIs: + VCI 0xf001, NSEI 0x1000, peer 0x00000000:0, blocked + NS-VC Block count : 1 + NS-VC replaced other count: 2 + VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111 + VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, blocked + NS-VC Block count : 5 + NS-VC replaced other count: 3 + NS-VC changed NSEI count : 4 + Current NS-VCIs: --- Setup SGSN connection, BSS -> SGSN --- |