From 89d3d343d1d15fb5f48826c73171c51b61b47efb Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Wed, 6 Aug 2014 18:55:15 +0200 Subject: gbproxy: Track TLLI even when the IMSI is not known Currently only TLLIs for which it is known that they may be patched are put into the TLLI list. This patch changes this to add TLLIs even when the IMSI is not yet known. A enable_patching flag is added to the gbproxy_tlli_info structure to control patching. Note that this puts every active TLLI into the list where accesses are O(N) currently. Sponsored-by: On-Waves ehf --- openbsc/tests/gbproxy/gbproxy_test.c | 12 ++++++++---- openbsc/tests/gbproxy/gbproxy_test.ok | 14 ++++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) (limited to 'openbsc/tests') diff --git a/openbsc/tests/gbproxy/gbproxy_test.c b/openbsc/tests/gbproxy/gbproxy_test.c index 769dc675d..229d2d45f 100644 --- a/openbsc/tests/gbproxy/gbproxy_test.c +++ b/openbsc/tests/gbproxy/gbproxy_test.c @@ -116,10 +116,14 @@ static int dump_peers(FILE *stream, int indent, struct gbproxy_config *cfg) llist_for_each_entry(tlli_info, &state->enabled_tllis, list) { char mi_buf[200]; time_t age = now - tlli_info->timestamp; - snprintf(mi_buf, sizeof(mi_buf), "(invalid)"); - gsm48_mi_to_string(mi_buf, sizeof(mi_buf), - tlli_info->mi_data, - tlli_info->mi_data_len); + if (tlli_info->mi_data_len > 0) { + snprintf(mi_buf, sizeof(mi_buf), "(invalid)"); + gsm48_mi_to_string(mi_buf, sizeof(mi_buf), + tlli_info->mi_data, + tlli_info->mi_data_len); + } else { + snprintf(mi_buf, sizeof(mi_buf), "(none)"); + } rc = fprintf(stream, "%*s TLLI %08x, IMSI %s, AGE %d\n", indent, "", diff --git a/openbsc/tests/gbproxy/gbproxy_test.ok b/openbsc/tests/gbproxy/gbproxy_test.ok index ee67c33ef..455364883 100644 --- a/openbsc/tests/gbproxy/gbproxy_test.ok +++ b/openbsc/tests/gbproxy/gbproxy_test.ok @@ -1807,8 +1807,9 @@ Peers: RAID patched (SGSN): 3 APN patched : 3 Attach Request count : 1 - TLLI cache size : 1 - TLLI-Cache: 1 + TLLI cache size : 2 + TLLI-Cache: 2 + TLLI efe2b700, IMSI (none), AGE 0 TLLI efe28117, IMSI 12131415161718, AGE 0 PROCESSING DETACH REQ from 0x01020304:1111 00 00 10 02 01 ef e2 b7 00 00 00 04 08 88 11 22 33 40 50 60 75 30 00 80 0e 00 15 01 c0 19 08 05 01 18 05 f4 ef e2 b7 00 19 03 b9 97 cb 7e e1 41 @@ -1841,7 +1842,9 @@ Peers: RAID patched (SGSN): 3 APN patched : 3 Attach Request count : 1 - TLLI-Cache: 0 + TLLI cache size : 1 + TLLI-Cache: 1 + TLLI efe28117, IMSI 12131415161718, AGE 0 --- Bad cases --- TLLI is already detached, shouldn't patch @@ -1879,7 +1882,10 @@ Peers: RAID patched (SGSN): 3 APN patched : 3 Attach Request count : 1 - TLLI-Cache: 0 + TLLI cache size : 2 + TLLI-Cache: 2 + TLLI efe2b700, IMSI (none), AGE 0 + TLLI efe28117, IMSI 12131415161718, AGE 0 Test TLLI info expiry Test TLLI replacement: -- cgit v1.2.3