diff options
-rw-r--r-- | openbsc/include/openbsc/gb_proxy.h | 4 | ||||
-rw-r--r-- | openbsc/src/gprs/gb_proxy_peer.c | 2 | ||||
-rw-r--r-- | openbsc/src/gprs/gb_proxy_tlli.c | 46 | ||||
-rw-r--r-- | openbsc/src/gprs/gb_proxy_vty.c | 6 | ||||
-rw-r--r-- | openbsc/tests/gbproxy/gbproxy_test.c | 42 |
5 files changed, 50 insertions, 50 deletions
diff --git a/openbsc/include/openbsc/gb_proxy.h b/openbsc/include/openbsc/gb_proxy.h index 1c06a9035..1d1812ff2 100644 --- a/openbsc/include/openbsc/gb_proxy.h +++ b/openbsc/include/openbsc/gb_proxy.h @@ -100,8 +100,8 @@ struct gbproxy_patch_state { int local_mcc; /* List of TLLIs for which patching is enabled */ - struct llist_head enabled_tllis; - int enabled_tllis_count; + struct llist_head logical_links; + int logical_link_count; }; struct gbproxy_peer { diff --git a/openbsc/src/gprs/gb_proxy_peer.c b/openbsc/src/gprs/gb_proxy_peer.c index 8f9066567..ce6690e5b 100644 --- a/openbsc/src/gprs/gb_proxy_peer.c +++ b/openbsc/src/gprs/gb_proxy_peer.c @@ -163,7 +163,7 @@ struct gbproxy_peer *gbproxy_peer_alloc(struct gbproxy_config *cfg, uint16_t bvc llist_add(&peer->list, &cfg->bts_peers); - INIT_LLIST_HEAD(&peer->patch_state.enabled_tllis); + INIT_LLIST_HEAD(&peer->patch_state.logical_links); return peer; } diff --git a/openbsc/src/gprs/gb_proxy_tlli.c b/openbsc/src/gprs/gb_proxy_tlli.c index 14ce7d86b..f5d7ef6a7 100644 --- a/openbsc/src/gprs/gb_proxy_tlli.c +++ b/openbsc/src/gprs/gb_proxy_tlli.c @@ -38,7 +38,7 @@ struct gbproxy_link_info *gbproxy_link_info_by_tlli(struct gbproxy_peer *peer, struct gbproxy_link_info *link_info; struct gbproxy_patch_state *state = &peer->patch_state; - llist_for_each_entry(link_info, &state->enabled_tllis, list) + llist_for_each_entry(link_info, &state->logical_links, list) if (link_info->tlli.current == tlli || link_info->tlli.assigned == tlli) return link_info; @@ -53,7 +53,7 @@ struct gbproxy_link_info *gbproxy_link_info_by_ptmsi( struct gbproxy_link_info *link_info; struct gbproxy_patch_state *state = &peer->patch_state; - llist_for_each_entry(link_info, &state->enabled_tllis, list) + llist_for_each_entry(link_info, &state->logical_links, list) if (link_info->tlli.ptmsi == ptmsi) return link_info; @@ -68,7 +68,7 @@ struct gbproxy_link_info *gbproxy_link_info_by_any_sgsn_tlli( struct gbproxy_patch_state *state = &peer->patch_state; /* Don't care about the NSEI */ - llist_for_each_entry(link_info, &state->enabled_tllis, list) + llist_for_each_entry(link_info, &state->logical_links, list) if (link_info->sgsn_tlli.current == tlli || link_info->sgsn_tlli.assigned == tlli) return link_info; @@ -83,7 +83,7 @@ struct gbproxy_link_info *gbproxy_link_info_by_sgsn_tlli( struct gbproxy_link_info *link_info; struct gbproxy_patch_state *state = &peer->patch_state; - llist_for_each_entry(link_info, &state->enabled_tllis, list) + llist_for_each_entry(link_info, &state->logical_links, list) if ((link_info->sgsn_tlli.current == tlli || link_info->sgsn_tlli.assigned == tlli) && link_info->sgsn_nsei == sgsn_nsei) @@ -103,7 +103,7 @@ struct gbproxy_link_info *gbproxy_link_info_by_imsi( if (!gprs_is_mi_imsi(imsi, imsi_len)) return NULL; - llist_for_each_entry(link_info, &state->enabled_tllis, list) { + llist_for_each_entry(link_info, &state->logical_links, list) { if (link_info->imsi_len != imsi_len) continue; if (memcmp(link_info->imsi, imsi, imsi_len) != 0) @@ -134,10 +134,10 @@ void gbproxy_delete_link_info(struct gbproxy_peer *peer, llist_del(&link_info->list); talloc_free(link_info); - state->enabled_tllis_count -= 1; + state->logical_link_count -= 1; peer->ctrg->ctr[GBPROX_PEER_CTR_TLLI_CACHE_SIZE].current = - state->enabled_tllis_count; + state->logical_link_count; } void gbproxy_delete_link_infos(struct gbproxy_peer *peer) @@ -145,11 +145,11 @@ void gbproxy_delete_link_infos(struct gbproxy_peer *peer) struct gbproxy_link_info *link_info, *nxt; struct gbproxy_patch_state *state = &peer->patch_state; - llist_for_each_entry_safe(link_info, nxt, &state->enabled_tllis, list) + llist_for_each_entry_safe(link_info, nxt, &state->logical_links, list) gbproxy_delete_link_info(peer, link_info); - OSMO_ASSERT(state->enabled_tllis_count == 0); - OSMO_ASSERT(llist_empty(&state->enabled_tllis)); + OSMO_ASSERT(state->logical_link_count == 0); + OSMO_ASSERT(llist_empty(&state->logical_links)); } void gbproxy_attach_link_info(struct gbproxy_peer *peer, time_t now, @@ -158,11 +158,11 @@ void gbproxy_attach_link_info(struct gbproxy_peer *peer, time_t now, struct gbproxy_patch_state *state = &peer->patch_state; link_info->timestamp = now; - llist_add(&link_info->list, &state->enabled_tllis); - state->enabled_tllis_count += 1; + llist_add(&link_info->list, &state->logical_links); + state->logical_link_count += 1; peer->ctrg->ctr[GBPROX_PEER_CTR_TLLI_CACHE_SIZE].current = - state->enabled_tllis_count; + state->logical_link_count; } int gbproxy_remove_stale_link_infos(struct gbproxy_peer *peer, time_t now) @@ -174,29 +174,29 @@ int gbproxy_remove_stale_link_infos(struct gbproxy_peer *peer, time_t now) if (peer->cfg->tlli_max_len > 0) exceeded_max_len = - state->enabled_tllis_count - peer->cfg->tlli_max_len; + state->logical_link_count - peer->cfg->tlli_max_len; check_for_age = peer->cfg->tlli_max_age > 0; for (; exceeded_max_len > 0; exceeded_max_len--) { struct gbproxy_link_info *link_info; - OSMO_ASSERT(!llist_empty(&state->enabled_tllis)); - link_info = llist_entry(state->enabled_tllis.prev, + OSMO_ASSERT(!llist_empty(&state->logical_links)); + link_info = llist_entry(state->logical_links.prev, struct gbproxy_link_info, list); LOGP(DGPRS, LOGL_INFO, "Removing TLLI %08x from list " "(stale, length %d, max_len exceeded)\n", - link_info->tlli.current, state->enabled_tllis_count); + link_info->tlli.current, state->logical_link_count); gbproxy_delete_link_info(peer, link_info); deleted_count += 1; } - while (check_for_age && !llist_empty(&state->enabled_tllis)) { + while (check_for_age && !llist_empty(&state->logical_links)) { time_t age; struct gbproxy_link_info *link_info; - link_info = llist_entry(state->enabled_tllis.prev, + link_info = llist_entry(state->logical_links.prev, struct gbproxy_link_info, list); age = now - link_info->timestamp; @@ -238,11 +238,11 @@ void gbproxy_detach_link_info( struct gbproxy_patch_state *state = &peer->patch_state; llist_del(&link_info->list); - OSMO_ASSERT(state->enabled_tllis_count > 0); - state->enabled_tllis_count -= 1; + OSMO_ASSERT(state->logical_link_count > 0); + state->logical_link_count -= 1; peer->ctrg->ctr[GBPROX_PEER_CTR_TLLI_CACHE_SIZE].current = - state->enabled_tllis_count; + state->logical_link_count; } void gbproxy_update_link_info(struct gbproxy_link_info *link_info, @@ -422,7 +422,7 @@ static void gbproxy_remove_matching_link_infos( struct gbproxy_patch_state *state = &peer->patch_state; /* Make sure that there is no second entry with the same P-TMSI or TLLI */ - llist_for_each_entry_safe(info, nxt, &state->enabled_tllis, list) { + llist_for_each_entry_safe(info, nxt, &state->logical_links, list) { if (info == link_info) continue; diff --git a/openbsc/src/gprs/gb_proxy_vty.c b/openbsc/src/gprs/gb_proxy_vty.c index 313cd9b3d..fefe8ebab 100644 --- a/openbsc/src/gprs/gb_proxy_vty.c +++ b/openbsc/src/gprs/gb_proxy_vty.c @@ -458,7 +458,7 @@ DEFUN(show_gbproxy_tllis, show_gbproxy_tllis_cmd, "show gbproxy tllis", gbprox_vty_print_peer(vty, peer); - llist_for_each_entry(link_info, &state->enabled_tllis, list) { + llist_for_each_entry(link_info, &state->logical_links, list) { time_t age = now - link_info->timestamp; int stored_msgs = 0; struct llist_head *iter; @@ -620,7 +620,7 @@ DEFUN(delete_gb_tlli_by_id, delete_gb_tlli_by_id_cmd, state = &peer->patch_state; - llist_for_each_entry_safe(link_info, nxt, &state->enabled_tllis, list) { + llist_for_each_entry_safe(link_info, nxt, &state->logical_links, list) { switch (match) { case MATCH_TLLI: if (link_info->tlli.current != ident) @@ -686,7 +686,7 @@ DEFUN(delete_gb_tlli, delete_gb_tlli_cmd, found, found == 1 ? "" : "s", VTY_NEWLINE); } else { llist_for_each_entry_safe(link_info, nxt, - &state->enabled_tllis, list) { + &state->logical_links, list) { if (!link_info->is_deregistered) continue; diff --git a/openbsc/tests/gbproxy/gbproxy_test.c b/openbsc/tests/gbproxy/gbproxy_test.c index 36200f432..6ac1ae902 100644 --- a/openbsc/tests/gbproxy/gbproxy_test.c +++ b/openbsc/tests/gbproxy/gbproxy_test.c @@ -117,8 +117,8 @@ static int dump_peers(FILE *stream, int indent, time_t now, } fprintf(stream, "%*s TLLI-Cache: %d\n", - indent, "", state->enabled_tllis_count); - llist_for_each_entry(link_info, &state->enabled_tllis, list) { + indent, "", state->logical_link_count); + llist_for_each_entry(link_info, &state->logical_links, list) { char mi_buf[200]; time_t age = now ? now - link_info->timestamp : 0; int stored_msgs = 0; @@ -3690,14 +3690,14 @@ static void test_gbproxy_tlli_expire(void) cfg.tlli_max_len = 0; cfg.tlli_max_age = 0; peer = gbproxy_peer_alloc(&cfg, 20); - OSMO_ASSERT(peer->patch_state.enabled_tllis_count == 0); + OSMO_ASSERT(peer->patch_state.logical_link_count == 0); printf(" Add TLLI 1, IMSI 1\n"); link_info = register_tlli(peer, tlli1, imsi1, ARRAY_SIZE(imsi1), now); OSMO_ASSERT(link_info); OSMO_ASSERT(link_info->tlli.current == tlli1); - OSMO_ASSERT(peer->patch_state.enabled_tllis_count == 1); + OSMO_ASSERT(peer->patch_state.logical_link_count == 1); /* replace the old entry */ printf(" Add TLLI 2, IMSI 1 (should replace TLLI 1)\n"); @@ -3705,7 +3705,7 @@ static void test_gbproxy_tlli_expire(void) imsi1, ARRAY_SIZE(imsi1), now); OSMO_ASSERT(link_info); OSMO_ASSERT(link_info->tlli.current == tlli2); - OSMO_ASSERT(peer->patch_state.enabled_tllis_count == 1); + OSMO_ASSERT(peer->patch_state.logical_link_count == 1); dump_peers(stdout, 2, now, &cfg); @@ -3729,14 +3729,14 @@ static void test_gbproxy_tlli_expire(void) cfg.tlli_max_len = 0; cfg.tlli_max_age = 0; peer = gbproxy_peer_alloc(&cfg, 20); - OSMO_ASSERT(peer->patch_state.enabled_tllis_count == 0); + OSMO_ASSERT(peer->patch_state.logical_link_count == 0); printf(" Add TLLI 1, IMSI 1\n"); link_info = register_tlli(peer, tlli1, imsi1, ARRAY_SIZE(imsi1), now); OSMO_ASSERT(link_info); OSMO_ASSERT(link_info->tlli.current == tlli1); - OSMO_ASSERT(peer->patch_state.enabled_tllis_count == 1); + OSMO_ASSERT(peer->patch_state.logical_link_count == 1); /* try to replace the old entry */ printf(" Add TLLI 1, IMSI 2 (should replace IMSI 1)\n"); @@ -3744,7 +3744,7 @@ static void test_gbproxy_tlli_expire(void) imsi2, ARRAY_SIZE(imsi2), now); OSMO_ASSERT(link_info); OSMO_ASSERT(link_info->tlli.current == tlli1); - OSMO_ASSERT(peer->patch_state.enabled_tllis_count == 1); + OSMO_ASSERT(peer->patch_state.logical_link_count == 1); dump_peers(stdout, 2, now, &cfg); @@ -3769,20 +3769,20 @@ static void test_gbproxy_tlli_expire(void) cfg.tlli_max_len = 1; cfg.tlli_max_age = 0; peer = gbproxy_peer_alloc(&cfg, 20); - OSMO_ASSERT(peer->patch_state.enabled_tllis_count == 0); + OSMO_ASSERT(peer->patch_state.logical_link_count == 0); printf(" Add TLLI 1, IMSI 1\n"); register_tlli(peer, tlli1, imsi1, ARRAY_SIZE(imsi1), now); - OSMO_ASSERT(peer->patch_state.enabled_tllis_count == 1); + OSMO_ASSERT(peer->patch_state.logical_link_count == 1); /* replace the old entry */ printf(" Add TLLI 2, IMSI 2 (should replace IMSI 1)\n"); register_tlli(peer, tlli2, imsi2, ARRAY_SIZE(imsi2), now); - OSMO_ASSERT(peer->patch_state.enabled_tllis_count == 2); + OSMO_ASSERT(peer->patch_state.logical_link_count == 2); num_removed = gbproxy_remove_stale_link_infos(peer, time(NULL) + 2); OSMO_ASSERT(num_removed == 1); - OSMO_ASSERT(peer->patch_state.enabled_tllis_count == 1); + OSMO_ASSERT(peer->patch_state.logical_link_count == 1); dump_peers(stdout, 2, now, &cfg); @@ -3807,20 +3807,20 @@ static void test_gbproxy_tlli_expire(void) cfg.tlli_max_len = 0; cfg.tlli_max_age = 1; peer = gbproxy_peer_alloc(&cfg, 20); - OSMO_ASSERT(peer->patch_state.enabled_tllis_count == 0); + OSMO_ASSERT(peer->patch_state.logical_link_count == 0); printf(" Add TLLI 1, IMSI 1 (should expire after timeout)\n"); register_tlli(peer, tlli1, imsi1, ARRAY_SIZE(imsi1), now); - OSMO_ASSERT(peer->patch_state.enabled_tllis_count == 1); + OSMO_ASSERT(peer->patch_state.logical_link_count == 1); printf(" Add TLLI 2, IMSI 2 (should not expire after timeout)\n"); register_tlli(peer, tlli2, imsi2, ARRAY_SIZE(imsi2), now + 1); - OSMO_ASSERT(peer->patch_state.enabled_tllis_count == 2); + OSMO_ASSERT(peer->patch_state.logical_link_count == 2); num_removed = gbproxy_remove_stale_link_infos(peer, now + 2); OSMO_ASSERT(num_removed == 1); - OSMO_ASSERT(peer->patch_state.enabled_tllis_count == 1); + OSMO_ASSERT(peer->patch_state.logical_link_count == 1); dump_peers(stdout, 2, now + 2, &cfg); @@ -3845,28 +3845,28 @@ static void test_gbproxy_tlli_expire(void) cfg.tlli_max_len = 0; cfg.tlli_max_age = 1; peer = gbproxy_peer_alloc(&cfg, 20); - OSMO_ASSERT(peer->patch_state.enabled_tllis_count == 0); + OSMO_ASSERT(peer->patch_state.logical_link_count == 0); printf(" Add TLLI 1, IMSI 1 (should expire)\n"); register_tlli(peer, tlli1, imsi1, ARRAY_SIZE(imsi1), now); - OSMO_ASSERT(peer->patch_state.enabled_tllis_count == 1); + OSMO_ASSERT(peer->patch_state.logical_link_count == 1); printf(" Add TLLI 2, IMSI 2 (should expire after timeout)\n"); register_tlli(peer, tlli2, imsi2, ARRAY_SIZE(imsi2), now + 1); - OSMO_ASSERT(peer->patch_state.enabled_tllis_count == 2); + OSMO_ASSERT(peer->patch_state.logical_link_count == 2); printf(" Add TLLI 3, IMSI 3 (should not expire after timeout)\n"); register_tlli(peer, tlli3, imsi3, ARRAY_SIZE(imsi3), now + 2); - OSMO_ASSERT(peer->patch_state.enabled_tllis_count == 3); + OSMO_ASSERT(peer->patch_state.logical_link_count == 3); dump_peers(stdout, 2, now + 2, &cfg); printf(" Remove stale TLLIs\n"); num_removed = gbproxy_remove_stale_link_infos(peer, now + 3); OSMO_ASSERT(num_removed == 2); - OSMO_ASSERT(peer->patch_state.enabled_tllis_count == 1); + OSMO_ASSERT(peer->patch_state.logical_link_count == 1); dump_peers(stdout, 2, now + 2, &cfg); |