gbproxy/test: Add test cases for IMSI acquisition
If the Attach Request procedure gets restarted e.g. because of a lost message, all of these messages are stored if IMSI acquisition is in progress. This patch adds a test for this case and modifies the dump_peers function to output the number of stored messages. Note that the number of stored messages currently increases with each (repeatedly) received Attach Request which is not the desired behaviour. Sponsored-by: On-Waves ehf
This commit is contained in:
parent
b1ee5cd3b6
commit
ea1698e322
|
@ -121,6 +121,11 @@ static int dump_peers(FILE *stream, int indent, time_t now,
|
|||
llist_for_each_entry(tlli_info, &state->enabled_tllis, list) {
|
||||
char mi_buf[200];
|
||||
time_t age = now ? now - tlli_info->timestamp : 0;
|
||||
int stored_msgs = 0;
|
||||
struct llist_head *iter;
|
||||
llist_for_each(iter, &tlli_info->stored_msgs)
|
||||
stored_msgs++;
|
||||
|
||||
if (tlli_info->mi_data_len > 0) {
|
||||
snprintf(mi_buf, sizeof(mi_buf), "(invalid)");
|
||||
gsm48_mi_to_string(mi_buf, sizeof(mi_buf),
|
||||
|
@ -143,15 +148,15 @@ static int dump_peers(FILE *stream, int indent, time_t now,
|
|||
fprintf(stream, ", IMSI %s, AGE %d",
|
||||
mi_buf, (int)age);
|
||||
|
||||
if (stored_msgs)
|
||||
fprintf(stream, ", STORED %d", stored_msgs);
|
||||
|
||||
if (cfg->check_imsi && tlli_info->enable_patching)
|
||||
fprintf(stream, ", IMSI matches");
|
||||
|
||||
if (tlli_info->imsi_acq_pending)
|
||||
fprintf(stream, ", IMSI acquisition in progress");
|
||||
|
||||
if (!llist_empty(&tlli_info->stored_msgs))
|
||||
fprintf(stream, ", stored messages");
|
||||
|
||||
rc = fprintf(stream, "\n");
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
@ -2036,6 +2041,20 @@ static void test_gbproxy_imsi_acquisition()
|
|||
|
||||
dump_peers(stdout, 0, 0, &gbcfg);
|
||||
|
||||
/* Special case: Repeated Attach Requests */
|
||||
|
||||
send_llc_ul_ui(nsi, "ATTACH REQUEST", &bss_peer[0], 0x1002,
|
||||
foreign_bss_tlli, &rai_unknown, cell_id,
|
||||
GPRS_SAPI_GMM, bss_nu++,
|
||||
dtap_attach_req, sizeof(dtap_attach_req));
|
||||
|
||||
send_llc_ul_ui(nsi, "ATTACH REQUEST", &bss_peer[0], 0x1002,
|
||||
foreign_bss_tlli, &rai_unknown, cell_id,
|
||||
GPRS_SAPI_GMM, bss_nu++,
|
||||
dtap_attach_req, sizeof(dtap_attach_req));
|
||||
|
||||
dump_peers(stdout, 0, 0, &gbcfg);
|
||||
|
||||
dump_global(stdout, 0);
|
||||
|
||||
gbprox_reset(&gbcfg);
|
||||
|
|
|
@ -2627,7 +2627,7 @@ Peers:
|
|||
Attach Request count : 1
|
||||
TLLI cache size : 1
|
||||
TLLI-Cache: 1
|
||||
TLLI 8000dead -> 7c69fb81, IMSI (none), AGE 0, IMSI acquisition in progress, stored messages
|
||||
TLLI 8000dead -> 7c69fb81, IMSI (none), AGE 0, STORED 1, IMSI acquisition in progress
|
||||
PROCESSING IDENT RESPONSE from 0x01020304:1111
|
||||
00 00 10 02 01 80 00 de ad 00 00 04 08 88 11 22 33 40 50 60 12 34 00 80 0e 00 11 01 c0 05 08 16 08 11 12 13 14 15 16 17 18 ad 05 28
|
||||
|
||||
|
@ -3000,6 +3000,37 @@ Peers:
|
|||
P-TMSI patched (SGSN): 1
|
||||
Attach Request count : 1
|
||||
TLLI-Cache: 0
|
||||
PROCESSING ATTACH REQUEST from 0x01020304:1111
|
||||
00 00 10 02 01 80 00 de ad 00 00 04 08 88 00 f1 99 00 63 60 12 34 00 80 0e 00 34 01 c0 15 08 01 02 f5 e0 21 08 02 05 f4 fb c5 46 79 11 22 33 40 50 60 19 18 b3 43 2b 25 96 62 00 60 80 9a c2 c6 62 00 60 80 ba c8 c6 62 00 60 80 00 e6 1c b0
|
||||
|
||||
CALLBACK, event 0, msg length 75, bvci 0x1002
|
||||
00 00 10 02 01 80 00 de ad 00 00 04 08 88 00 f1 99 00 63 60 12 34 00 80 0e 00 34 01 c0 15 08 01 02 f5 e0 21 08 02 05 f4 fb c5 46 79 11 22 33 40 50 60 19 18 b3 43 2b 25 96 62 00 60 80 9a c2 c6 62 00 60 80 ba c8 c6 62 00 60 80 00 e6 1c b0
|
||||
|
||||
NS UNITDATA MESSAGE to BSS, BVCI 0x1002, msg length 24 (gprs_ns_sendmsg)
|
||||
MESSAGE to BSS at 0x01020304:1111, msg length 28
|
||||
00 00 10 02 00 80 00 de ad 00 50 20 16 82 02 58 0e 00 09 41 c0 01 08 15 01 ff 6c ba
|
||||
|
||||
result (ATTACH REQUEST) = 0
|
||||
|
||||
PROCESSING ATTACH REQUEST from 0x01020304:1111
|
||||
00 00 10 02 01 80 00 de ad 00 00 04 08 88 00 f1 99 00 63 60 12 34 00 80 0e 00 34 01 c0 19 08 01 02 f5 e0 21 08 02 05 f4 fb c5 46 79 11 22 33 40 50 60 19 18 b3 43 2b 25 96 62 00 60 80 9a c2 c6 62 00 60 80 ba c8 c6 62 00 60 80 00 b6 33 df
|
||||
|
||||
CALLBACK, event 0, msg length 75, bvci 0x1002
|
||||
00 00 10 02 01 80 00 de ad 00 00 04 08 88 00 f1 99 00 63 60 12 34 00 80 0e 00 34 01 c0 19 08 01 02 f5 e0 21 08 02 05 f4 fb c5 46 79 11 22 33 40 50 60 19 18 b3 43 2b 25 96 62 00 60 80 9a c2 c6 62 00 60 80 ba c8 c6 62 00 60 80 00 b6 33 df
|
||||
|
||||
result (ATTACH REQUEST) = 0
|
||||
|
||||
Peers:
|
||||
NSEI 4096, BVCI 4098, not blocked, RAI 112-332-16464-96
|
||||
RAID patched (BSS ): 8
|
||||
RAID patched (SGSN): 3
|
||||
TLLI patched (BSS ): 9
|
||||
TLLI patched (SGSN): 9
|
||||
P-TMSI patched (SGSN): 1
|
||||
Attach Request count : 3
|
||||
TLLI cache size : 1
|
||||
TLLI-Cache: 1
|
||||
TLLI 8000dead -> 7eb52dfb, IMSI (none), AGE 0, STORED 2, IMSI acquisition in progress
|
||||
Gbproxy global:
|
||||
Invalid Routing Area Identifier : 1
|
||||
BSSGP protocol error (SGSN): 1
|
||||
|
@ -3249,7 +3280,7 @@ Peers:
|
|||
Attach Request count : 1
|
||||
TLLI cache size : 1
|
||||
TLLI-Cache: 1
|
||||
TLLI 8000dead -> 7c69fb81, IMSI (none), AGE 0, IMSI acquisition in progress, stored messages
|
||||
TLLI 8000dead -> 7c69fb81, IMSI (none), AGE 0, STORED 1, IMSI acquisition in progress
|
||||
PROCESSING IDENT RESPONSE from 0x01020304:1111
|
||||
00 00 10 02 01 80 00 de ad 00 00 04 08 88 11 22 33 40 50 60 12 34 00 80 0e 00 11 01 c0 05 08 16 08 11 12 13 14 15 16 17 18 ad 05 28
|
||||
|
||||
|
@ -3556,7 +3587,7 @@ Peers:
|
|||
Attach Request count : 2
|
||||
TLLI cache size : 2
|
||||
TLLI-Cache: 2
|
||||
TLLI 8000beef -> 7eb52dfb, IMSI (none), AGE 0, IMSI acquisition in progress, stored messages
|
||||
TLLI 8000beef -> 7eb52dfb, IMSI (none), AGE 0, STORED 1, IMSI acquisition in progress
|
||||
TLLI c00f7304 -> efe2b700, IMSI 12131415161718, AGE 0
|
||||
PROCESSING IDENT RESPONSE from 0x01020304:1111
|
||||
00 00 10 02 01 80 00 be ef 00 00 04 08 88 11 22 33 40 50 60 12 34 00 80 0e 00 11 01 c0 15 08 16 08 11 12 99 99 99 16 17 18 b2 dd 58
|
||||
|
|
Loading…
Reference in New Issue