aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-06-27 12:20:44 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-07-22 17:05:16 +0200
commit040b4012a77201110cc478054d9b6e9039339621 (patch)
treea6090cc35f24dab74c73155dbdd89382556710e4
parentaa3e334608d0101c8e98b5bc65d4cd9fd2bc82ea (diff)
gprs: Fix TLLI cache size computation
Currently the enabled_tllis_count field isn't always decremented when an element is removed from the TLLI cache list. This patch adds the missing update and also adjusts the counter accordingly. Sponsored-by: On-Waves ehf
-rw-r--r--openbsc/src/gprs/gb_proxy.c7
-rw-r--r--openbsc/tests/gbproxy/gbproxy_test.ok12
2 files changed, 10 insertions, 9 deletions
diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c
index 00acb629a..bc2e119eb 100644
--- a/openbsc/src/gprs/gb_proxy.c
+++ b/openbsc/src/gprs/gb_proxy.c
@@ -464,6 +464,7 @@ static void gbprox_delete_tllis(struct gbprox_peer *peer)
llist_del(&tlli_info->list);
talloc_free(tlli_info);
}
+ state->enabled_tllis_count = 0;
OSMO_ASSERT(llist_empty(&state->enabled_tllis));
}
@@ -646,7 +647,6 @@ static void gbprox_register_tlli(struct gbprox_peer *peer, uint32_t tlli,
memcpy(tlli_info->mi_data, imsi, imsi_len);
}
- /* TODO: Hack??? */
peer->ctrg->ctr[GBPROX_PEER_CTR_TLLI_CACHE_SIZE].current =
state->enabled_tllis_count;
}
@@ -654,6 +654,7 @@ static void gbprox_register_tlli(struct gbprox_peer *peer, uint32_t tlli,
static void gbprox_unregister_tlli(struct gbprox_peer *peer, uint32_t tlli)
{
struct gbprox_tlli_info *tlli_info;
+ struct gbprox_patch_state *state = &peer->patch_state;
tlli_info = gbprox_find_tlli(peer, tlli);
if (tlli_info) {
@@ -662,7 +663,11 @@ static void gbprox_unregister_tlli(struct gbprox_peer *peer, uint32_t tlli)
tlli);
llist_del(&tlli_info->list);
talloc_free(tlli_info);
+ state->enabled_tllis_count -= 1;
}
+
+ peer->ctrg->ctr[GBPROX_PEER_CTR_TLLI_CACHE_SIZE].current =
+ state->enabled_tllis_count;
}
static int gbprox_check_tlli(struct gbprox_peer *peer, uint32_t tlli)
diff --git a/openbsc/tests/gbproxy/gbproxy_test.ok b/openbsc/tests/gbproxy/gbproxy_test.ok
index de54311a7..5f2d81e3c 100644
--- a/openbsc/tests/gbproxy/gbproxy_test.ok
+++ b/openbsc/tests/gbproxy/gbproxy_test.ok
@@ -1737,8 +1737,7 @@ Peers:
RAID patched (SGSN): 2
APN patched : 2
Attach Request count : 1
- TLLI cache size : 2
- TLLI-Cache: 2
+ TLLI-Cache: 0
--- RA update ---
PROCESSING RA UPD REQ from 0x01020304:1111
@@ -1783,8 +1782,7 @@ Peers:
RAID patched (SGSN): 3
APN patched : 2
Attach Request count : 1
- TLLI cache size : 2
- TLLI-Cache: 2
+ TLLI-Cache: 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
@@ -1816,8 +1814,7 @@ Peers:
RAID patched (SGSN): 3
APN patched : 2
Attach Request count : 1
- TLLI cache size : 3
- TLLI-Cache: 3
+ TLLI-Cache: 0
--- Bad cases ---
TLLI is already detached, shouldn't patch
@@ -1855,7 +1852,6 @@ Peers:
RAID patched (SGSN): 3
APN patched : 2
Attach Request count : 1
- TLLI cache size : 3
- TLLI-Cache: 3
+ TLLI-Cache: 0
===== GbProxy test END