aboutsummaryrefslogtreecommitdiffstats
path: root/tests/tbf/TbfTest.cpp
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-08-16 18:19:32 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-08-17 16:23:01 +0200
commit28c40b17574a2dc792278baffb6f4f87e3559bb6 (patch)
treea3fd8c7bc9ffc04279e19979ce6d63e951ecaf2c /tests/tbf/TbfTest.cpp
parent3449a61032cbf91f1a042e02264142b4df3d61a7 (diff)
tbf: Clean old MS objects if they have the same TLLI
Currently if an MS retries to access the PCU by using RACH and if there is already an entry for that MS, a duplicated MS object referring to the same TLLI is created. This is caused by blindly setting the TLLI without querying the MS storage to avoid inconsitencies. This leads to several entries in the MS storage that are assigned to the same TLLI. If that happens, 'show ms all' can display multiple entries with the same TLLI (note that an MS object can belong to several TLLIs, so there might be an intersection that is not visible in the list) or 'show tbf all' can show entries with MS_CLASS == 0 in some cases. This commit changes update_ms() to merge and clean up old entries that belong to the given TLLI if they exist. Some data (like the MS class) is copied to the new MS object. Note that TBF belonging to the old MS object are deleted immediately if they have not registered a timer. Sponsored-by: On-Waves ehf
Diffstat (limited to 'tests/tbf/TbfTest.cpp')
-rw-r--r--tests/tbf/TbfTest.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp
index 80bc818..19895ad 100644
--- a/tests/tbf/TbfTest.cpp
+++ b/tests/tbf/TbfTest.cpp
@@ -388,18 +388,23 @@ static void test_tbf_imsi()
OSMO_ASSERT(ms1 == ms2);
/* use the same IMSI on TBF 2 */
- dl_tbf[1]->assign_imsi("001001000000002");
- ms1 = the_bts.ms_store().get_ms(0, 0, "001001000000002");
- OSMO_ASSERT(ms1 != NULL);
- OSMO_ASSERT(ms1 != ms2);
- OSMO_ASSERT(strcmp(ms1->imsi(), "001001000000002") == 0);
- OSMO_ASSERT(strcmp(ms2->imsi(), "") == 0);
+ {
+ GprsMs::Guard guard(ms2);
+ dl_tbf[1]->assign_imsi("001001000000002");
+ ms1 = the_bts.ms_store().get_ms(0, 0, "001001000000002");
+ OSMO_ASSERT(ms1 != NULL);
+ OSMO_ASSERT(ms1 != ms2);
+ OSMO_ASSERT(strcmp(ms1->imsi(), "001001000000002") == 0);
+ OSMO_ASSERT(strcmp(ms2->imsi(), "") == 0);
+ }
+
+ ms2 = the_bts.ms_store().get_ms(0xf1000001);
+ OSMO_ASSERT(ms2 == NULL);
tbf_free(dl_tbf[1]);
ms1 = the_bts.ms_store().get_ms(0, 0, "001001000000002");
OSMO_ASSERT(ms1 == NULL);
- tbf_free(dl_tbf[0]);
printf("=== end %s ===\n", __func__);
}