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
diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c
index 00acb62..bc2e119 100644
--- a/openbsc/src/gprs/gb_proxy.c
+++ b/openbsc/src/gprs/gb_proxy.c
@@ -464,6 +464,7 @@
 		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 @@
 		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_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 @@
 		     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)