From 0e50ce614569b9ae7bcc6e7becc4aeec46e8369d Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Thu, 21 May 2015 16:58:22 +0200 Subject: tbf: Always call set_tlli/confirm_tlli in update_ms Currently the m_tlli member in GprsMs is set by the constructor, circumventing the TLLI confirmation mechanism. This commit replaces the get_or_create_ms() method by a create_ms() method which takes the TLLI and the direction (UL or DL) as parameters to select either set_tlli() or confirm_tlli(). The MS object is instantiated with TLLI = 0, and therefore GprsMs::tlli() is extended to return the DL TLLI if both of the other TLLI are not set. Note that create_ms() will not check whether an MS object with a matching TLLI is already stored in the list, so it should only be called after a corresponding get_ms() in general. Sponsored-by: On-Waves ehf --- src/gprs_ms_storage.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/gprs_ms_storage.cpp') diff --git a/src/gprs_ms_storage.cpp b/src/gprs_ms_storage.cpp index 4f72c86f..1cdb7537 100644 --- a/src/gprs_ms_storage.cpp +++ b/src/gprs_ms_storage.cpp @@ -71,14 +71,20 @@ GprsMs *GprsMsStorage::get_ms(uint32_t tlli, uint32_t old_tlli, const char *imsi return ms; } -GprsMs *GprsMsStorage::get_or_create_ms(uint32_t tlli, uint32_t old_tlli, const char *imsi) +GprsMs *GprsMsStorage::create_ms(uint32_t tlli, enum gprs_rlcmac_tbf_direction dir) { - GprsMs *ms = get_ms(tlli, old_tlli, imsi); + GprsMs *ms = get_ms(tlli); if (ms) return ms; - ms = new GprsMs(tlli); + ms = new GprsMs(0); + + if (dir == GPRS_RLCMAC_UL_TBF) + ms->set_tlli(tlli); + else + ms->confirm_tlli(tlli); + ms->set_callback(this); llist_add(&ms->list(), &m_list); -- cgit v1.2.3