diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2014-08-07 20:18:47 +0200 |
---|---|---|
committer | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2014-08-13 11:14:08 +0200 |
commit | 5e68ecf3b2b57aec76162caa7894dff5670dca31 (patch) | |
tree | d519a28a60507baf4c0ed80e2e5768308c07d207 /openbsc/tests | |
parent | 2dec9851bd13e053790502275bf03ace25efbf76 (diff) |
gbproxy: Pass tlli_info around
This patch modifies the code to pass a pointer to the tlli_info
around once it has been acquired. To achieve this,
gbprox_register_tlli() and gbprox_update_state() are modified to
return it (if it has been found or created), and gbprox_patch_llc(),
gbprox_patch_bssgp(), and gbprox_update_state_after() are modified to
take it as parameter.
Add a new function gbprox_touch_tlli() to update timestamp and list
ordering for existing tlli_infos.
The motivation behind this patch is to make the tlli_info available to
the patching code and to avoid repeated searches for the same TLLI.
Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc/tests')
-rw-r--r-- | openbsc/tests/gbproxy/gbproxy_test.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/openbsc/tests/gbproxy/gbproxy_test.c b/openbsc/tests/gbproxy/gbproxy_test.c index f1c24f9ed..cca50949b 100644 --- a/openbsc/tests/gbproxy/gbproxy_test.c +++ b/openbsc/tests/gbproxy/gbproxy_test.c @@ -1358,12 +1358,18 @@ static void test_gbproxy_tlli_expire(void) OSMO_ASSERT(peer->patch_state.enabled_tllis_count == 0); printf(" Add TLLI 1, IMSI 1\n"); - gbprox_register_tlli(peer, tlli1, imsi1, ARRAY_SIZE(imsi1), now); + tlli_info = gbprox_register_tlli(peer, tlli1, + imsi1, ARRAY_SIZE(imsi1), now); + OSMO_ASSERT(tlli_info); + OSMO_ASSERT(tlli_info->tlli == tlli1); OSMO_ASSERT(peer->patch_state.enabled_tllis_count == 1); /* replace the old entry */ printf(" Add TLLI 2, IMSI 1 (should replace TLLI 1)\n"); - gbprox_register_tlli(peer, tlli2, imsi1, ARRAY_SIZE(imsi1), now); + tlli_info = gbprox_register_tlli(peer, tlli2, + imsi1, ARRAY_SIZE(imsi1), now); + OSMO_ASSERT(tlli_info); + OSMO_ASSERT(tlli_info->tlli == tlli2); OSMO_ASSERT(peer->patch_state.enabled_tllis_count == 1); dump_peers(stdout, 2, now, &cfg); @@ -1391,12 +1397,18 @@ static void test_gbproxy_tlli_expire(void) OSMO_ASSERT(peer->patch_state.enabled_tllis_count == 0); printf(" Add TLLI 1, IMSI 1\n"); - gbprox_register_tlli(peer, tlli1, imsi1, ARRAY_SIZE(imsi1), now); + tlli_info = gbprox_register_tlli(peer, tlli1, + imsi1, ARRAY_SIZE(imsi1), now); + OSMO_ASSERT(tlli_info); + OSMO_ASSERT(tlli_info->tlli == tlli1); OSMO_ASSERT(peer->patch_state.enabled_tllis_count == 1); /* try to replace the old entry */ printf(" Add TLLI 1, IMSI 2 (should replace IMSI 1)\n"); - gbprox_register_tlli(peer, tlli1, imsi2, ARRAY_SIZE(imsi2), now); + tlli_info = gbprox_register_tlli(peer, tlli1, + imsi2, ARRAY_SIZE(imsi2), now); + OSMO_ASSERT(tlli_info); + OSMO_ASSERT(tlli_info->tlli == tlli1); OSMO_ASSERT(peer->patch_state.enabled_tllis_count == 1); dump_peers(stdout, 2, now, &cfg); |