diff options
-rw-r--r-- | include/osmocom/gprs/gprs_ns.h | 4 | ||||
-rw-r--r-- | src/gb/gprs_ns_vty.c | 8 | ||||
-rw-r--r-- | tests/gb/gprs_ns_test.c | 7 | ||||
-rw-r--r-- | tests/gb/gprs_ns_test.ok | 120 |
4 files changed, 72 insertions, 67 deletions
diff --git a/include/osmocom/gprs/gprs_ns.h b/include/osmocom/gprs/gprs_ns.h index d4aef824..2d2f86ed 100644 --- a/include/osmocom/gprs/gprs_ns.h +++ b/include/osmocom/gprs/gprs_ns.h @@ -43,6 +43,10 @@ enum ns_timeout { #define NSE_S_ALIVE 0x0002 #define NSE_S_RESET 0x0004 +#define NS_DESC_B(st) ((st) & NSE_S_BLOCKED ? "BLOCKED" : "UNBLOCKED") +#define NS_DESC_A(st) ((st) & NSE_S_ALIVE ? "ALIVE" : "DEAD") +#define NS_DESC_R(st) ((st) & NSE_S_RESET ? "RESET" : "UNRESET") + /*! Osmocom NS link layer types */ enum gprs_ns_ll { GPRS_NS_LL_UDP, /*!< NS/UDP/IP */ diff --git a/src/gb/gprs_ns_vty.c b/src/gb/gprs_ns_vty.c index 3b1a6987..317a6a10 100644 --- a/src/gb/gprs_ns_vty.c +++ b/src/gb/gprs_ns_vty.c @@ -160,11 +160,11 @@ static void dump_nse(struct vty *vty, struct gprs_nsvc *nsvc, int stats) { vty_out(vty, "NSEI %5u, NS-VC %5u, %5s %9s, Remote: %-4s, %5s %9s", nsvc->nsei, nsvc->nsvci, - nsvc->state & NSE_S_ALIVE ? "ALIVE" : "DEAD", - nsvc->state & NSE_S_BLOCKED ? "BLOCKED" : "UNBLOCKED", + NS_DESC_A(nsvc->state), + NS_DESC_B(nsvc->state), nsvc->remote_end_is_sgsn ? "SGSN" : "BSS", - nsvc->remote_state & NSE_S_ALIVE ? "ALIVE" : "DEAD", - nsvc->remote_state & NSE_S_BLOCKED ? "BLOCKED" : "UNBLOCKED"); + NS_DESC_A(nsvc->remote_state), + NS_DESC_B(nsvc->remote_state)); if (nsvc->ll == GPRS_NS_LL_UDP || nsvc->ll == GPRS_NS_LL_FR_GRE) vty_out(vty, ", %s %15s:%u", nsvc->ll == GPRS_NS_LL_UDP ? "UDP " : "FR-GRE", diff --git a/tests/gb/gprs_ns_test.c b/tests/gb/gprs_ns_test.c index 456d8e3f..0bbf9432 100644 --- a/tests/gb/gprs_ns_test.c +++ b/tests/gb/gprs_ns_test.c @@ -390,11 +390,12 @@ static void gprs_dump_nsi(struct gprs_ns_inst *nsi) printf("Current NS-VCIs:\n"); llist_for_each_entry(nsvc, &nsi->gprs_nsvcs, list) { struct sockaddr_in *peer = &(nsvc->ip.bts_addr); - printf(" VCI 0x%04x, NSEI 0x%04x, peer 0x%08x:%d%s%s%s\n", + printf(" VCI 0x%04x, NSEI 0x%04x, peer 0x%08x:%d, %s, %s, %s%s\n", nsvc->nsvci, nsvc->nsei, ntohl(peer->sin_addr.s_addr), ntohs(peer->sin_port), - nsvc->state & NSE_S_BLOCKED ? ", blocked" : "", - nsvc->state & NSE_S_ALIVE ? "" : ", dead", + NS_DESC_A(nsvc->state), + NS_DESC_B(nsvc->state), + NS_DESC_R(nsvc->state), nsvc->nsvci_is_valid ? "" : ", invalid VCI" ); dump_rate_ctr_group(stdout, " ", nsvc->ctrg); diff --git a/tests/gb/gprs_ns_test.ok b/tests/gb/gprs_ns_test.ok index b0c81e44..669e1824 100644 --- a/tests/gb/gprs_ns_test.ok +++ b/tests/gb/gprs_ns_test.ok @@ -14,7 +14,7 @@ MESSAGE to BSS, msg length 1 result (RESET) = 9 Current NS-VCIs: - VCI 0x1001, NSEI 0x1000, peer 0x01020304:1111, blocked + VCI 0x1001, NSEI 0x1000, peer 0x01020304:1111, ALIVE, BLOCKED, UNRESET --- Delete nsvc object (round 0)--- @@ -35,7 +35,7 @@ MESSAGE to BSS, msg length 1 result (RESET) = 9 Current NS-VCIs: - VCI 0x1001, NSEI 0x1000, peer 0x01020304:1111, blocked + VCI 0x1001, NSEI 0x1000, peer 0x01020304:1111, ALIVE, BLOCKED, UNRESET --- Delete nsvc object (round 1)--- @@ -56,7 +56,7 @@ MESSAGE to BSS, msg length 1 result (RESET) = 9 Current NS-VCIs: - VCI 0x1001, NSEI 0x1000, peer 0x01020304:1111, blocked + VCI 0x1001, NSEI 0x1000, peer 0x01020304:1111, ALIVE, BLOCKED, UNRESET --- Delete nsvc object (round 2)--- @@ -77,7 +77,7 @@ MESSAGE to BSS, msg length 1 result (RESET) = 9 Current NS-VCIs: - VCI 0x1001, NSEI 0x1000, peer 0x01020304:1111, blocked + VCI 0x1001, NSEI 0x1000, peer 0x01020304:1111, ALIVE, BLOCKED, UNRESET --- Delete nsvc object (round 3)--- @@ -145,7 +145,7 @@ PROCESSING ALIVE_ACK from 0x01020304:1111 result (ALIVE_ACK) = 0 Current NS-VCIs: - VCI 0x1122, NSEI 0x1122, peer 0x01020304:1111 + VCI 0x1122, NSEI 0x1122, peer 0x01020304:1111, ALIVE, UNBLOCKED, UNRESET PROCESSING BSSGP RESET from 0x01020304:1111 00 00 00 00 22 04 82 4a 2e 07 81 08 08 88 10 20 30 40 50 60 10 00 @@ -170,7 +170,7 @@ MESSAGE to BSS, msg length 1 result (RESET) = 9 Current NS-VCIs: - VCI 0x1122, NSEI 0x1122, peer 0x01020304:2222, blocked + VCI 0x1122, NSEI 0x1122, peer 0x01020304:2222, ALIVE, BLOCKED, UNRESET --- Peer port changes, RESET, VCI changes --- @@ -187,8 +187,8 @@ MESSAGE to BSS, msg length 1 result (RESET) = 9 Current NS-VCIs: - VCI 0x3344, NSEI 0x1122, peer 0x01020304:3333, blocked - VCI 0x1122, NSEI 0x1122, peer 0x01020304:2222, blocked + VCI 0x3344, NSEI 0x1122, peer 0x01020304:3333, ALIVE, BLOCKED, UNRESET + VCI 0x1122, NSEI 0x1122, peer 0x01020304:2222, ALIVE, BLOCKED, UNRESET --- Peer port changes, RESET, NSEI changes --- @@ -205,8 +205,8 @@ MESSAGE to BSS, msg length 1 result (RESET) = 9 Current NS-VCIs: - VCI 0x3344, NSEI 0x1122, peer 0x01020304:3333, blocked - VCI 0x1122, NSEI 0x3344, peer 0x01020304:4444, blocked + VCI 0x3344, NSEI 0x1122, peer 0x01020304:3333, ALIVE, BLOCKED, UNRESET + VCI 0x1122, NSEI 0x3344, peer 0x01020304:4444, ALIVE, BLOCKED, UNRESET NS-VC changed NSEI count : 1 --- Peer port 3333, RESET, VCI is changed back --- @@ -225,8 +225,8 @@ MESSAGE to BSS, msg length 1 result (RESET) = 9 Current NS-VCIs: - VCI 0x3344, NSEI 0x1122, peer 0x00000000:0, blocked - VCI 0x1122, NSEI 0x1122, peer 0x01020304:3333, blocked + VCI 0x3344, NSEI 0x1122, peer 0x00000000:0, ALIVE, BLOCKED, UNRESET + VCI 0x1122, NSEI 0x1122, peer 0x01020304:3333, ALIVE, BLOCKED, UNRESET NS-VC replaced other count: 1 NS-VC changed NSEI count : 2 @@ -245,8 +245,8 @@ MESSAGE to BSS, msg length 1 result (RESET) = 9 Current NS-VCIs: - VCI 0x3344, NSEI 0x1122, peer 0x00000000:0, blocked - VCI 0x1122, NSEI 0x1122, peer 0x01020304:4444, blocked + VCI 0x3344, NSEI 0x1122, peer 0x00000000:0, ALIVE, BLOCKED, UNRESET + VCI 0x1122, NSEI 0x1122, peer 0x01020304:4444, ALIVE, BLOCKED, UNRESET NS-VC replaced other count: 1 NS-VC changed NSEI count : 2 @@ -289,7 +289,7 @@ PROCESSING ALIVE_ACK from 0x01020304:1111 result (ALIVE_ACK) = 0 Current NS-VCIs: - VCI 0x1001, NSEI 0x1000, peer 0x01020304:1111 + VCI 0x1001, NSEI 0x1000, peer 0x01020304:1111, ALIVE, UNBLOCKED, UNRESET --- Setup VC 2 BSS -> SGSN --- @@ -330,8 +330,8 @@ PROCESSING ALIVE_ACK from 0x01020304:2222 result (ALIVE_ACK) = 0 Current NS-VCIs: - VCI 0x2001, NSEI 0x2000, peer 0x01020304:2222 - VCI 0x1001, NSEI 0x1000, peer 0x01020304:1111 + VCI 0x2001, NSEI 0x2000, peer 0x01020304:2222, ALIVE, UNBLOCKED, UNRESET + VCI 0x1001, NSEI 0x1000, peer 0x01020304:1111, ALIVE, UNBLOCKED, UNRESET --- Setup VC 1 SGSN -> BSS --- @@ -347,8 +347,8 @@ MESSAGE to BSS, msg length 1 result (RESET_ACK) = 1 Current NS-VCIs: - VCI 0x2001, NSEI 0x2000, peer 0x01020304:2222 - VCI 0x1001, NSEI 0x1000, peer 0x01020304:1111, blocked + VCI 0x2001, NSEI 0x2000, peer 0x01020304:2222, ALIVE, UNBLOCKED, UNRESET + VCI 0x1001, NSEI 0x1000, peer 0x01020304:1111, ALIVE, BLOCKED, UNRESET NS-VC Block count : 1 --- Exchange NSEI 1 + 2 links --- @@ -368,8 +368,8 @@ MESSAGE to BSS, msg length 1 result (RESET_ACK) = 1 Current NS-VCIs: - VCI 0x2001, NSEI 0x2000, peer 0x00000000:0, blocked, dead - VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, blocked + VCI 0x2001, NSEI 0x2000, peer 0x00000000:0, DEAD, BLOCKED, RESET + VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, ALIVE, BLOCKED, UNRESET NS-VC Block count : 2 NS-VC replaced other count: 1 @@ -389,8 +389,8 @@ MESSAGE to BSS, msg length 1 result (RESET_ACK) = 1 Current NS-VCIs: - VCI 0x2001, NSEI 0x2000, peer 0x00000000:0, blocked, dead - VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, blocked + VCI 0x2001, NSEI 0x2000, peer 0x00000000:0, DEAD, BLOCKED, RESET + VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, ALIVE, BLOCKED, UNRESET NS-VC Block count : 3 NS-VC replaced other count: 1 @@ -433,8 +433,8 @@ PROCESSING ALIVE_ACK from 0x01020304:1111 result (ALIVE_ACK) = 0 Current NS-VCIs: - VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111 - VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, blocked + VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111, ALIVE, UNBLOCKED, UNRESET + VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, ALIVE, BLOCKED, UNRESET NS-VC Block count : 3 NS-VC replaced other count: 1 @@ -453,8 +453,8 @@ MESSAGE to BSS, msg length 1 result (RESET) = 9 Current NS-VCIs: - VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111 - VCI 0x1001, NSEI 0xf000, peer 0x01020304:2222, blocked + VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111, ALIVE, UNBLOCKED, UNRESET + VCI 0x1001, NSEI 0xf000, peer 0x01020304:2222, ALIVE, BLOCKED, UNRESET NS-VC Block count : 3 NS-VC replaced other count: 1 NS-VC changed NSEI count : 1 @@ -475,10 +475,10 @@ MESSAGE to BSS, msg length 1 result (RESET) = 9 Current NS-VCIs: - VCI 0xf001, NSEI 0x1000, peer 0x01020304:2222, blocked + VCI 0xf001, NSEI 0x1000, peer 0x01020304:2222, ALIVE, BLOCKED, UNRESET NS-VC replaced other count: 1 - VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111 - VCI 0x1001, NSEI 0xf000, peer 0x00000000:0, blocked + VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111, ALIVE, UNBLOCKED, UNRESET + VCI 0x1001, NSEI 0xf000, peer 0x00000000:0, ALIVE, BLOCKED, UNRESET NS-VC Block count : 3 NS-VC replaced other count: 1 NS-VC changed NSEI count : 1 @@ -499,10 +499,10 @@ MESSAGE to BSS, msg length 1 result (RESET) = 9 Current NS-VCIs: - VCI 0xf001, NSEI 0x1000, peer 0x00000000:0, blocked + VCI 0xf001, NSEI 0x1000, peer 0x00000000:0, ALIVE, BLOCKED, UNRESET NS-VC replaced other count: 1 - VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111 - VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, blocked + VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111, ALIVE, UNBLOCKED, UNRESET + VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, ALIVE, BLOCKED, UNRESET NS-VC Block count : 3 NS-VC replaced other count: 2 NS-VC changed NSEI count : 2 @@ -515,10 +515,10 @@ PROCESSING RESET_ACK from 0x01020304:2222 result (RESET_ACK) = 0 Current NS-VCIs: - VCI 0xf001, NSEI 0x1000, peer 0x00000000:0, blocked + VCI 0xf001, NSEI 0x1000, peer 0x00000000:0, ALIVE, BLOCKED, UNRESET NS-VC replaced other count: 1 - VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111 - VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, blocked + VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111, ALIVE, UNBLOCKED, UNRESET + VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, ALIVE, BLOCKED, UNRESET NS-VC Block count : 3 NS-VC replaced other count: 2 NS-VC changed NSEI count : 2 @@ -537,10 +537,10 @@ MESSAGE to BSS, msg length 1 result (RESET_ACK) = 1 Current NS-VCIs: - VCI 0xf001, NSEI 0x1000, peer 0x00000000:0, blocked + VCI 0xf001, NSEI 0x1000, peer 0x00000000:0, ALIVE, BLOCKED, UNRESET NS-VC replaced other count: 1 - VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111 - VCI 0x1001, NSEI 0xf000, peer 0x01020304:2222, blocked + VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111, ALIVE, UNBLOCKED, UNRESET + VCI 0x1001, NSEI 0xf000, peer 0x01020304:2222, ALIVE, BLOCKED, UNRESET NS-VC Block count : 4 NS-VC replaced other count: 2 NS-VC changed NSEI count : 3 @@ -560,11 +560,11 @@ MESSAGE to BSS, msg length 1 result (RESET_ACK) = 1 Current NS-VCIs: - VCI 0xf001, NSEI 0x1000, peer 0x01020304:2222, blocked + VCI 0xf001, NSEI 0x1000, peer 0x01020304:2222, ALIVE, BLOCKED, UNRESET NS-VC Block count : 1 NS-VC replaced other count: 2 - VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111 - VCI 0x1001, NSEI 0xf000, peer 0x00000000:0, blocked, dead + VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111, ALIVE, UNBLOCKED, UNRESET + VCI 0x1001, NSEI 0xf000, peer 0x00000000:0, DEAD, BLOCKED, RESET NS-VC Block count : 4 NS-VC replaced other count: 2 NS-VC changed NSEI count : 3 @@ -618,11 +618,11 @@ PROCESSING UNBLOCK_ACK from 0x01020304:2222 result (UNBLOCK_ACK) = 0 Current NS-VCIs: - VCI 0xf001, NSEI 0x1000, peer 0x00000000:0, blocked + VCI 0xf001, NSEI 0x1000, peer 0x00000000:0, ALIVE, BLOCKED, UNRESET 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 + VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111, ALIVE, UNBLOCKED, UNRESET + VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, ALIVE, UNBLOCKED, UNRESET NS-VC Block count : 4 NS-VC replaced other count: 3 NS-VC changed NSEI count : 4 @@ -644,11 +644,11 @@ MESSAGE to BSS, msg length 1 result (RESET_ACK) = 1 Current NS-VCIs: - VCI 0xf001, NSEI 0x1000, peer 0x00000000:0, blocked + VCI 0xf001, NSEI 0x1000, peer 0x00000000:0, ALIVE, BLOCKED, UNRESET 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 + VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111, ALIVE, UNBLOCKED, UNRESET + VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, ALIVE, BLOCKED, UNRESET NS-VC Block count : 5 NS-VC replaced other count: 3 NS-VC changed NSEI count : 4 @@ -683,7 +683,7 @@ PROCESSING UNBLOCK_ACK from 0x05060708:32000 result (UNBLOCK_ACK) = 0 Current NS-VCIs: - VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000 + VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, ALIVE, UNBLOCKED, UNRESET NS-VC Block count : 1 --- RESET, SGSN -> BSS --- @@ -701,7 +701,7 @@ MESSAGE to SGSN, msg length 1 result (RESET) = 9 Current NS-VCIs: - VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked + VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, ALIVE, BLOCKED, UNRESET NS-VC Block count : 1 --- RESET with invalid NSEI, SGSN -> BSS --- @@ -716,7 +716,7 @@ MESSAGE to SGSN, msg length 9 result (RESET) = 0 Current NS-VCIs: - VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked + VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, ALIVE, BLOCKED, UNRESET NS-VC Block count : 1 NSEI was invalid count : 1 @@ -732,7 +732,7 @@ MESSAGE to SGSN, msg length 9 result (RESET) = 0 Current NS-VCIs: - VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked + VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, ALIVE, BLOCKED, UNRESET NS-VC Block count : 1 NS-VCI was invalid count : 1 NSEI was invalid count : 1 @@ -752,7 +752,7 @@ MESSAGE to SGSN, msg length 1 result (RESET) = 9 Current NS-VCIs: - VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked + VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, ALIVE, BLOCKED, UNRESET NS-VC Block count : 1 NS-VCI was invalid count : 1 NSEI was invalid count : 1 @@ -765,7 +765,7 @@ PROCESSING RESET_ACK from 0x05060708:32000 result (RESET_ACK) = 0 Current NS-VCIs: - VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked + VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, ALIVE, BLOCKED, UNRESET NS-VC Block count : 1 NS-VCI was invalid count : 1 NSEI was invalid count : 1 @@ -782,7 +782,7 @@ PROCESSING RESET_ACK from 0x05060708:32000 result (RESET_ACK) = -22 Current NS-VCIs: - VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked, dead + VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, DEAD, BLOCKED, RESET NS-VC Block count : 1 NS-VCI was invalid count : 1 NSEI was invalid count : 2 @@ -799,7 +799,7 @@ PROCESSING RESET_ACK from 0x05060708:32000 result (RESET_ACK) = -22 Current NS-VCIs: - VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked, dead + VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, DEAD, BLOCKED, RESET NS-VC Block count : 1 NS-VCI was invalid count : 2 NSEI was invalid count : 2 @@ -835,7 +835,7 @@ PROCESSING UNBLOCK_ACK from 0x05060708:32000 result (UNBLOCK_ACK) = 0 Current NS-VCIs: - VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000 + VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, ALIVE, UNBLOCKED, UNRESET NS-VC Block count : 1 --- Time out local test procedure --- @@ -938,7 +938,7 @@ MESSAGE to SGSN, msg length 12 02 00 81 01 01 82 01 01 04 82 01 00 Current NS-VCIs: - VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked, dead + VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, DEAD, BLOCKED, RESET --- Send message to SGSN --- @@ -967,7 +967,7 @@ MESSAGE to SGSN, msg length 1 result (ALIVE_ACK) = 1 Current NS-VCIs: - VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked + VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, ALIVE, BLOCKED, UNRESET NS-VC Block count : 1 --- Send message to SGSN --- @@ -995,7 +995,7 @@ MESSAGE to SGSN, msg length 1 result (ALIVE) = 1 Current NS-VCIs: - VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000 + VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, ALIVE, UNBLOCKED, UNRESET NS-VC Block count : 1 --- Send message to SGSN --- |