aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gprs/gb_proxy.c
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 /openbsc/src/gprs/gb_proxy.c
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
Diffstat (limited to 'openbsc/src/gprs/gb_proxy.c')
-rw-r--r--openbsc/src/gprs/gb_proxy.c7
1 files changed, 6 insertions, 1 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)