summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2013-10-17 13:58:35 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-10-17 14:45:27 +0200
commitbf0219654b09b6d8f3bc2c9f4d48c065b47f2983 (patch)
treece9cfc9a2f63c4a5cacfbfec1be874f0099c2ba7
parent0d4e949e229a649ffd0503d8e930dba8be7dd34d (diff)
gb: Fix gprs_active_nsvc_by_nsei()
The state matching condition is inverted. This is corrected by this fix. Sponsored-by: On-Waves ehf
-rw-r--r--src/gb/gprs_ns.c4
-rw-r--r--tests/gb/gprs_ns_test.ok20
2 files changed, 12 insertions, 12 deletions
diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c
index bdc7ae3c..6a35ad35 100644
--- a/src/gb/gprs_ns.c
+++ b/src/gb/gprs_ns.c
@@ -158,8 +158,8 @@ static struct gprs_nsvc *gprs_active_nsvc_by_nsei(struct gprs_ns_inst *nsi,
struct gprs_nsvc *nsvc;
llist_for_each_entry(nsvc, &nsi->gprs_nsvcs, list) {
if (nsvc->nsei == nsei) {
- if (nsvc->state & NSE_S_BLOCKED ||
- !(nsvc->state & NSE_S_ALIVE))
+ if (!(nsvc->state & NSE_S_BLOCKED) &&
+ nsvc->state & NSE_S_ALIVE)
return nsvc;
}
}
diff --git a/tests/gb/gprs_ns_test.ok b/tests/gb/gprs_ns_test.ok
index 5dc1e92a..424d6819 100644
--- a/tests/gb/gprs_ns_test.ok
+++ b/tests/gb/gprs_ns_test.ok
@@ -167,10 +167,7 @@ SENDING BSSGP RESET to NSEI 0x0100, BVCI 0x0000
NS UNITDATA MESSAGE to SGSN, BVCI 0x0000, msg length 18
22 04 82 4a 2e 07 81 08 08 88 10 20 30 40 50 60 10 00
-MESSAGE to SGSN, msg length 22
-00 00 00 00 22 04 82 4a 2e 07 81 08 08 88 10 20 30 40 50 60 10 00
-
-result (BSSGP RESET) = 22
+result (BSSGP RESET) = -16
--- Make connection to SGSN alive ---
@@ -200,10 +197,7 @@ SENDING BSSGP RESET to NSEI 0x0100, BVCI 0x0000
NS UNITDATA MESSAGE to SGSN, BVCI 0x0000, msg length 18
22 04 82 4a 2e 07 81 08 08 88 10 20 30 40 50 60 10 00
-MESSAGE to SGSN, msg length 22
-00 00 00 00 22 04 82 4a 2e 07 81 08 08 88 10 20 30 40 50 60 10 00
-
-result (BSSGP RESET) = 22
+result (BSSGP RESET) = -16
--- Unblock connection to SGSN ---
@@ -231,7 +225,10 @@ SENDING BSSGP RESET to NSEI 0x0100, BVCI 0x0000
NS UNITDATA MESSAGE to SGSN, BVCI 0x0000, msg length 18
22 04 82 4a 2e 07 81 08 08 88 10 20 30 40 50 60 10 00
-result (BSSGP RESET) = -16
+MESSAGE to SGSN, msg length 22
+00 00 00 00 22 04 82 4a 2e 07 81 08 08 88 10 20 30 40 50 60 10 00
+
+result (BSSGP RESET) = 22
--- Send empty message with BVCI to SGSN ---
@@ -239,7 +236,10 @@ SENDING [empty] to NSEI 0x0100, BVCI 0x0102
NS UNITDATA MESSAGE to SGSN, BVCI 0x0102, msg length 0
-result ([empty]) = -16
+MESSAGE to SGSN, msg length 4
+00 00 01 02
+
+result ([empty]) = 4
===== NS protocol test END