gb: Fix gprs_ns_rx_reset to not create NS-VC duplicates
Under special circumstances (see below) receiving a NS-RESET leads to
duplicated NS-VC entries.
This happens when the source port of a NS-VC changes to a new one
that has already been used by another NS-VC.
This patch changes gprs_ns_rx_reset() to check for this case and to
use the existing NS-VC object. The NS-VC object that was associated
with the source address before is detached from this source but kept
in the NS-VC list so that it can be reattached when a correspondent
NS-RESET is received later on. Meanwhile it will have a cleared link
layer address which will not match a real link info.
A new counter NS_CTR_REPLACED is incremented each time when the NS-VC
object is replacing another one. A new signal S_NS_REPLACED is added
which gets dispatched in this case, too.
Another new counter NS_CTR_NSEI_CHG is incremented each time when the
NSEI of a NS-VC object (with fixed NSVCI) changes.
Ticket: OW#874
Sponsored-by: On-Waves ehf
diff --git a/tests/gb/gprs_ns_test.ok b/tests/gb/gprs_ns_test.ok
index 01b1bc9..7be84ef 100644
--- a/tests/gb/gprs_ns_test.ok
+++ b/tests/gb/gprs_ns_test.ok
@@ -91,12 +91,14 @@
Current NS-VCIs:
VCI 0x3344, NSEI 0x1122, peer 0x01020304:3333
VCI 0x1122, NSEI 0x3344, peer 0x01020304:4444
+ NS-VC changed NSEI : 1
--- Peer port 3333, RESET, VCI is changed back ---
PROCESSING RESET from 0x01020304:3333
02 00 81 01 01 82 11 22 04 82 11 22
+==> got signal NS_REPLACED: 0x1122/1.2.3.4:4444 -> 0x3344/1.2.3.4:3333
==> got signal NS_RESET, NS-VC 0x1122/1.2.3.4:3333
RESPONSE, msg length 9
03 01 82 11 22 04 82 11 22
@@ -107,8 +109,10 @@
result (RESET) = 9
Current NS-VCIs:
+ VCI 0x3344, NSEI 0x1122, peer 0x00000000:0
VCI 0x1122, NSEI 0x1122, peer 0x01020304:3333
- VCI 0x1122, NSEI 0x3344, peer 0x01020304:4444
+ NS-VC replaced other count: 1
+ NS-VC changed NSEI : 2
--- Peer port 4444, RESET, NSEI is changed back ---
@@ -125,8 +129,10 @@
result (RESET) = 9
Current NS-VCIs:
- VCI 0x1122, NSEI 0x1122, peer 0x01020304:3333
+ VCI 0x3344, NSEI 0x1122, peer 0x00000000:0
VCI 0x1122, NSEI 0x1122, peer 0x01020304:4444
+ NS-VC replaced other count: 1
+ NS-VC changed NSEI : 2
===== NS protocol test END