Commit Graph

12 Commits

Author SHA1 Message Date
Pau Espin 97e88fd35f bts: Drop specific functions to add values to stats
Change-Id: I877a9c9a35b6c94c3dd6b1ab3019bc57f6c8568a
2020-05-14 11:19:05 +00:00
Max f4d3973688 MS store: move test helper to unit test
It's confusing to have test-specific helper with the same name as tested
function directly inside the GprsMsStorage class. Let's convert it into
static function and move to the unit test.

Change-Id: Ia2a5b90779051af894fe15d957c1d26f0a142f33
2019-03-19 15:05:51 +00:00
Max 1187a7719c Update header includes
Many files include unnecessary headers and don't include headers which
are actually used. Because of that combined with the fact that OsmoPCU
is a mixture of C and C++, it makes it hard to modularize code. Fix
this (using iwyu [1] tool):

* add missing headers
* remove unused headers

[1] https://include-what-you-use.org/

Related: OS#1539
Change-Id: I8c9f488a43b099c72b2d30d3245e7ba50872fc00
2018-02-19 08:43:46 +00:00
Jacob Erlbeck c362df25a2 pcu: Fix memory corruption bugs (ASAN)
ASAN has found improper deletion of objects. These only occur
on shutdown but makes it impossible to run the test cases with
full ASAN support.

This commit fixes some of them and deactivates the freeing of the_pcu.bctx
which may cause a corruption in BTS::~BTS() later on.

Note that the latter is only a work-aound and should be fixed
properly. It will leak bctx objects, but this is currently not
critical, since gprs_bssgp_destroy is only called once, immediately
before a call to exit().

Ticket: OW#1572
Sponsored-by: On-Waves ehf
2016-02-01 13:56:32 +01:00
Jacob Erlbeck f5898a0528 stat: Add global stat group
Add a global stat_item group for measurement values and a
corresponding macro to get and set the values.
Add a stat_item STAT_MS_PRESET to monitor the number of
MS objects in the storage.

Sponsored-by: On-Waves ehf
2015-11-30 12:11:29 +01:00
Jacob Erlbeck fea17f8b8c ms: Do not retrieve MS with IMSI 000 from the storage
The IMSI '000' is used as default value for an incoming BSSGP
message's IMSI IE. This can lead to the retrieval of the wrong MS
object from the storage.

This commit changes the get_ms method to skip the IMSI search if such
an IMSI is passed as selector.

Note that changing the default value in the BSSGP code does not help
here.

Sponsored-by: On-Waves ehf
2015-08-17 16:23:27 +02:00
Jacob Erlbeck cb1b494c89 tbf: Add BTS::ms_alloc method
Currently the code that creates the MS objects with tbf.cpp is
duplicated.

This commit moves the corresponding code into a new method. Since
there is no TLLI available there, the GprsMsStorage::create_ms method
has been refactored into two variants: one with TLLI/direction and
one without.

Sponsored-by: On-Waves ehf
2015-06-29 11:43:17 +02:00
Jacob Erlbeck 17214bb06d ms: Add back pointer to BTS
Since more functionality will be moved to the GprsMs class, a pointer
to the current BTS object is added to allow access to configuration
data and other methods.

Sponsored-by: On-Waves ehf
2015-06-08 09:39:07 +02:00
Jacob Erlbeck 7b9f825ae8 ms: Use the IMSI to retrieve the MS object
This commit extends get_ms() to really compare the IMSI if it has
been given. Matching by TLLI has a higher precedence than matching by
IMSI.

Ticket: #1674
Sponsored-by: On-Waves ehf
2015-05-28 12:29:40 +02:00
Jacob Erlbeck 0e50ce6145 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
2015-05-27 13:30:01 +02:00
Jacob Erlbeck 9399046729 ms: Support new and old TLLIs
According to the specification (GSM 04.08/24.008, 4.7.1.5) after a
new P-TMSI has been assigned, the old P-TMSI must be kept basically
until it has been used by both sides. Since the TLLI will be derived
from the P-TMSI, the old TLLI must also be kept until the new TLLI
has been used by both MS and SGSN.

This commit modifies the TLLI handling of GprsMs accordingly.
set_tlli() is only used with TLLIs derived from MS messages,
confirm_tlli() is used with TLLIs derived from messages received from
the SGSN. tlli() returns the value set by the MS. check_tlli()
matches each of the TLLI used by either MS or SGSN as well as the old
TLLI until it has been confirmed.

Sponsored-by: On-Waves ehf
2015-05-21 17:10:42 +02:00
Jacob Erlbeck 5367086175 ms: Add MS storage class
Currently the MS objects are contained in the TBF objects only. To
allow for an extended life time after the TBF objects have been freed
and to find them based on TLLI, a container for the MS objects is
needed.

This commit adds the container class and also adds the corresponding
m_list member to GprsMs. Further integration into the PCU code is not
yet done.

Ticket: #1674
Sponsored-by: On-Waves ehf
2015-05-20 11:36:12 +02:00