aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2013-10-24 12:48:56 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-10-24 18:02:38 +0200
commit64cb9246346ed991fceb4f749b15daf7177b201c (patch)
tree3a402fd7dcca7b50646df48a2c26e654d048e09d /openbsc
parent72b401f33df215173aa9b3a6f8237115a3d5f0b5 (diff)
gbproxy: Fix handling of NSEI changes
The gbproxy looses NSEI changes on BVC_RESET and then tries to send later messages to the wrong (not longer existing) destination. This patch fixes this by updating the peer's nsei field on BVC_RESET. Ticket: OW#874 Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/gprs/gb_proxy.c9
-rw-r--r--openbsc/tests/gbproxy/gbproxy_test.ok65
2 files changed, 40 insertions, 34 deletions
diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c
index f008b3ee9..f9001586f 100644
--- a/openbsc/src/gprs/gb_proxy.c
+++ b/openbsc/src/gprs/gb_proxy.c
@@ -183,10 +183,10 @@ static int check_peer_nsei(struct gbprox_peer *peer, uint16_t nsei)
"BVCI=%u via NSEI=%u (expected NSEI=%u)\n",
peer->bvci, nsei, peer->nsei);
rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_INV_NSEI]);
- return 1;
+ return 0;
}
- return 0;
+ return 1;
}
static struct gbprox_peer *peer_alloc(uint16_t bvci)
@@ -432,7 +432,10 @@ static int gbprox_rx_sig_from_bss(struct msgb *msg, uint16_t nsei,
from_peer = peer_alloc(bvci);
from_peer->nsei = nsei;
}
- check_peer_nsei(from_peer, nsei);
+
+ if (!check_peer_nsei(from_peer, nsei))
+ from_peer->nsei = nsei;
+
if (TLVP_PRESENT(&tp, BSSGP_IE_CELL_ID)) {
struct gprs_ra_id raid;
/* We have a Cell Identifier present in this
diff --git a/openbsc/tests/gbproxy/gbproxy_test.ok b/openbsc/tests/gbproxy/gbproxy_test.ok
index b21f58ad8..0942ca3b2 100644
--- a/openbsc/tests/gbproxy/gbproxy_test.ok
+++ b/openbsc/tests/gbproxy/gbproxy_test.ok
@@ -747,7 +747,7 @@ Peers:
NSEI 4096, BVCI 4114, not blocked, RAC 10-32-16464-96
NSEI 8192, BVCI 8194, not blocked, RAC 10-32-16464-96
NSEI mismatch : 1
- NSEI 4096, BVCI 4098, not blocked, RAC 10-32-16464-96
+ NSEI 8192, BVCI 4098, not blocked, RAC 10-32-16464-96
NSEI mismatch : 1
Gbproxy global:
PROCESSING BVC_RESET_ACK from 0x05060708:32000
@@ -759,7 +759,7 @@ CALLBACK, event 0, msg length 5, bvci 0x0000
NS UNITDATA MESSAGE to BSS, BVCI 0x0000, msg length 5
23 04 82 10 02
-MESSAGE to BSS at 0x01020304:1111, msg length 9
+MESSAGE to BSS at 0x01020304:3333, msg length 9
00 00 00 00 23 04 82 10 02
result (BVC_RESET_ACK) = 9
@@ -1101,13 +1101,15 @@ CALLBACK, event 0, msg length 5, bvci 0x0000
NS UNITDATA MESSAGE to BSS, BVCI 0x0000, msg length 5
23 04 82 10 02
-result (BVC_RESET_ACK) = -22
+MESSAGE to BSS at 0x01020304:1111, msg length 9
+00 00 00 00 23 04 82 10 02
+
+result (BVC_RESET_ACK) = 9
Peers:
NSEI 4096, BVCI 8194, not blocked, RAC 10-32-16464-96
- NSEI 4096, BVCI 4098, not blocked, RAC 10-32-16464-96
+ NSEI 8192, BVCI 4098, not blocked, RAC 10-32-16464-96
NSEI mismatch : 1
- NS Transmission error : 1
--- Setup BVCI 3 ---
Setup BSSGP: remote 0x01020304:1111, BVCI 0x3002(12290)
@@ -1143,9 +1145,8 @@ result (BVC_RESET_ACK) = 9
Peers:
NSEI 8192, BVCI 12290, not blocked, RAC 10-32-16464-96
NSEI 4096, BVCI 8194, not blocked, RAC 10-32-16464-96
- NSEI 4096, BVCI 4098, not blocked, RAC 10-32-16464-96
+ NSEI 8192, BVCI 4098, not blocked, RAC 10-32-16464-96
NSEI mismatch : 1
- NS Transmission error : 1
--- Send message from BSS 1 to SGSN and back, BVCI 1 ---
PROCESSING UNITDATA from 0x01020304:1111
@@ -1171,7 +1172,10 @@ CALLBACK, event 0, msg length 0, bvci 0x1002
NS UNITDATA MESSAGE to BSS, BVCI 0x1002, msg length 0
-result (UNITDATA) = -22
+MESSAGE to BSS at 0x01020304:1111, msg length 4
+00 00 10 02
+
+result (UNITDATA) = 4
--- Send message from BSS 1 to SGSN and back, BVCI 2 (should fail) ---
@@ -1193,9 +1197,8 @@ Peers:
NSEI 8192, BVCI 12290, not blocked, RAC 10-32-16464-96
NSEI 4096, BVCI 8194, not blocked, RAC 10-32-16464-96
NSEI mismatch : 1
- NSEI 4096, BVCI 4098, not blocked, RAC 10-32-16464-96
- NSEI mismatch : 2
- NS Transmission error : 2
+ NSEI 8192, BVCI 4098, not blocked, RAC 10-32-16464-96
+ NSEI mismatch : 1
PROCESSING UNITDATA from 0x05060708:32000
00 00 20 02
@@ -1212,9 +1215,8 @@ Peers:
NSEI 4096, BVCI 8194, not blocked, RAC 10-32-16464-96
NSEI mismatch : 1
NS Transmission error : 1
- NSEI 4096, BVCI 4098, not blocked, RAC 10-32-16464-96
- NSEI mismatch : 2
- NS Transmission error : 2
+ NSEI 8192, BVCI 4098, not blocked, RAC 10-32-16464-96
+ NSEI mismatch : 1
--- Send message from BSS 1 to SGSN and back, BVCI 3 ---
PROCESSING UNITDATA from 0x01020304:1111
@@ -1322,16 +1324,18 @@ CALLBACK, event 0, msg length 5, bvci 0x0000
NS UNITDATA MESSAGE to BSS, BVCI 0x0000, msg length 5
23 04 82 10 02
-result (BVC_RESET_ACK) = -22
+MESSAGE to BSS at 0x01020304:1111, msg length 9
+00 00 00 00 23 04 82 10 02
+
+result (BVC_RESET_ACK) = 9
Peers:
NSEI 8192, BVCI 12290, not blocked, RAC 10-32-16464-96
NSEI 4096, BVCI 8194, not blocked, RAC 10-32-16464-96
NSEI mismatch : 1
NS Transmission error : 1
- NSEI 4096, BVCI 4098, not blocked, RAC 10-32-16464-96
- NSEI mismatch : 3
- NS Transmission error : 3
+ NSEI 8192, BVCI 4098, not blocked, RAC 10-32-16464-96
+ NSEI mismatch : 1
--- Setup BVCI 4 ---
Setup BSSGP: remote 0x01020304:1111, BVCI 0x4002(16386)
@@ -1370,9 +1374,8 @@ Peers:
NSEI 4096, BVCI 8194, not blocked, RAC 10-32-16464-96
NSEI mismatch : 1
NS Transmission error : 1
- NSEI 4096, BVCI 4098, not blocked, RAC 10-32-16464-96
- NSEI mismatch : 3
- NS Transmission error : 3
+ NSEI 8192, BVCI 4098, not blocked, RAC 10-32-16464-96
+ NSEI mismatch : 1
--- Send message from BSS 1 to SGSN and back, BVCI 1 ---
PROCESSING UNITDATA from 0x01020304:1111
@@ -1398,7 +1401,10 @@ CALLBACK, event 0, msg length 0, bvci 0x1002
NS UNITDATA MESSAGE to BSS, BVCI 0x1002, msg length 0
-result (UNITDATA) = -22
+MESSAGE to BSS at 0x01020304:1111, msg length 4
+00 00 10 02
+
+result (UNITDATA) = 4
--- Send message from BSS 1 to SGSN and back, BVCI 2 (should fail) ---
@@ -1422,9 +1428,8 @@ Peers:
NSEI 4096, BVCI 8194, not blocked, RAC 10-32-16464-96
NSEI mismatch : 2
NS Transmission error : 1
- NSEI 4096, BVCI 4098, not blocked, RAC 10-32-16464-96
- NSEI mismatch : 4
- NS Transmission error : 4
+ NSEI 8192, BVCI 4098, not blocked, RAC 10-32-16464-96
+ NSEI mismatch : 1
PROCESSING UNITDATA from 0x05060708:32000
00 00 20 02
@@ -1442,9 +1447,8 @@ Peers:
NSEI 4096, BVCI 8194, not blocked, RAC 10-32-16464-96
NSEI mismatch : 2
NS Transmission error : 2
- NSEI 4096, BVCI 4098, not blocked, RAC 10-32-16464-96
- NSEI mismatch : 4
- NS Transmission error : 4
+ NSEI 8192, BVCI 4098, not blocked, RAC 10-32-16464-96
+ NSEI mismatch : 1
--- Send message from BSS 1 to SGSN and back, BVCI 3 ---
PROCESSING UNITDATA from 0x01020304:1111
@@ -1512,8 +1516,7 @@ Peers:
NSEI 4096, BVCI 8194, not blocked, RAC 10-32-16464-96
NSEI mismatch : 2
NS Transmission error : 2
- NSEI 4096, BVCI 4098, not blocked, RAC 10-32-16464-96
- NSEI mismatch : 4
- NS Transmission error : 4
+ NSEI 8192, BVCI 4098, not blocked, RAC 10-32-16464-96
+ NSEI mismatch : 1
===== GbProxy test END