Commit Graph

745 Commits

Author SHA1 Message Date
Vadim Yanitskiy be1338789a bssmap_le: support additional IEs in Perform Location Request
Change-Id: I8775a93cf4089b1752d040e43d2cba6b8997f955
Related: SYS#5891
2022-03-22 18:38:19 +03:00
Pau Espin fffd7c345b gsm0808: Fix decoding of IE GSM0808_IE_LCS_CLIENT_TYPE
Change-Id: I7acafdefd105e330c466df2e17e884327651e348
2022-03-18 17:36:46 +01:00
Pau Espin a3987fcf39 gsm0808_test: Add new unit test showing dec error
This unit tests shows how decoding of such message fails. Fix will be
provided in a follow up patch to make the test pass.

Related: SYS#5891
Change-Id: Ib4ff71d5e01d464febb062c5bfe3e06ee5a19ecd
2022-03-18 17:36:43 +01:00
Pau Espin b5551eec33 gsm: [ABI BREAK] Support CellId SAI, change CellId CGI-PS id number
Those are available in 3GPP TS 48.008 version 16.0.0 Release 16, section
3.2.2.17 Cell Identifier. It can be seen that we have a collision
between the osmocom non-standard format and the SAI standard one.

This is because CGI-PS is not really a TS 48.008 Cell Identifier, but only
specified in TS 48.018 and has no ID number assigned. The CGI-PS was
added there because the whole osmo-bsc neighbour configuration works
with CellIds to manage neighbours, so it felt natural to extend the APIs
to also provide means to use CGI-PS format (TS 48.018 even refers 48.008
existance and mentions there's no explicit ID).

At the time this Cell Identifier was added, the firstly available number
(11) was taken, which was of course a really bad idea since newer
versions of the spec can at some point use it, which is the case if one
checks for instance TS 48.008 Release 16 SAI Cell Id.

There no perfect way to fix this bad decision at the time, but the
CGI-PS is only used in osmo-bsc and only for RIM related purposes, so by
changing the ID of CELL_IDENT_WHOLE_GLOBAL_PS, we only break RIM under
some specific CIs being used, and when an osmo-bsc is built against
older libosmocore and then used at runtime against a newer libosmocore
(which should be rare).
Hence, the downside is acceptable, and by moving the new ID number to be
ouside of the spec proto TS 48.008 range (4 bits), we make sure we don't
have the same problem again in the future.

Related: SYS#5838
Fixes: ca33a71ca8
Change-Id: Id25e563febdb7640174540136225f399515a0089
2022-02-16 17:59:23 +01:00
Harald Welte a87526d53e gsm0808: Test if we properly decode a SRVCC cell identifier list
We don't handle this correctly, as we decided to overload the
meaning of 0b1011 in a cell identifier list (defined by 3GPP
as used in SRVCC) with something osmocom proprietary.

Change-Id: I608220e8e5dd5a44f85c6bc5ea04622a2cad24ec
2022-02-16 12:51:40 +01:00
Vadim Yanitskiy b12dbf76c2 tests/logging: merge both logging_test_{stream,wqueue}.err
Change-Id: I0ff0a6e0d22575047cc00dd822bc94d696171076
2022-01-31 16:56:09 +00:00
Vadim Yanitskiy 83f423b11e logging: fix printing of '\0' when filename printed last
As was demonstrated in I54bf5e5c036efb1908232fe3d8e8e2989715fbb3,
when the logging is configured to print the filename *after* the
logging message, each logging line contains an artifact - '\0'.

The problem is that the 'len' variable is not updated.  Fix this.

Change-Id: I5c920a0d5c1cf45bcdd327b39e33d63346b4f51c
Fixes: I393907b3c9e0cc1145e102328adad0a83ee13a9f
2022-01-31 16:56:09 +00:00
Neels Hofmeyr 09d6574a45 add osmo_sockaddr_to_str_c(), osmo_sockaddr_to_str_buf2()
To easily log and print a sockaddr using OTC_SELECT, add
osmo_sockaddr_to_str_c().

Implement osmo_sockaddr_to_str_buf2() using osmo_strbuf, so that we can
return the chars_needed which osmo_sockaddr_to_str_c() uses.

From previous osmo_sockaddr_to_str_buf(), call
osmo_sockaddr_to_str_buf2() and return NULL if the buf_len was
insufficient, to mimick previous behavior. This makes it more
consistently returning NULL for insufficient buf_len, as shown in the
tweak that is needed in socket_test.c. Before osmo_sockaddr_to_str_buf()
would return a truncated port number, now it's all or NULL.

I will use osmo_sockaddr_to_str_c() in the new osmo-upf implementation.

Related: SYS#5599
Change-Id: I12771bf8a021e6785217b1faad03c09ec1cfef0e
2022-01-31 15:03:53 +00:00
Vadim Yanitskiy eff0880f3b tests/logging: also test printing the filename information
This commit demonstrates a bug introduced in [1], which can be
observed when the logging is configured to print the filename
*after* the logging message (LOG_FILENAME_POS_HEADER_END):

  logging print file 1 last
                       ^^^^

In this mode, the code in _output_buf() overwrites the '\n' sybmol
contained in the logging message itself by shifting the 'offset'
backwards, and appends the nipped '\n' after the filename info.

The problem is that the 'len' variable is not updated in this case,
so the resulting length includes +1 character - '\0', which gets
printed at the end of every logging line.

Interestingly enough, this problem affects only the wqueue mode.

Change-Id: I54bf5e5c036efb1908232fe3d8e8e2989715fbb3
Related: [1] I393907b3c9e0cc1145e102328adad0a83ee13a9f
2022-01-31 15:47:42 +06:00
Vadim Yanitskiy 27961906ad tests/logging: ensure both stream and wqueue modes are tested
Change-Id: I37e789b5b287d72c443f50fd99a5284bc7296c0b
2022-01-31 15:45:22 +06:00
Neels Hofmeyr 13fa00e183 PFCP: add DLPFCP and osmo-upf port numbers
Related: SYS#5599
Change-Id: I0a46b147ec6a76d909df28136cfd2b764b2c75ea
2022-01-21 00:55:51 +01:00
Pau Espin 604eaba2c3 iuup: Submit RNL-STATUS-Initialization.ind upon rx of Init
This allows init-passive users to get the configured sizes for the RFCIs
and other similar information once engotiated with the peer.

Realted: OS#1937
Change-Id: I63ee780b4aa162ea097410b234e73984000c0965
2022-01-07 13:02:56 +00:00
Philipp Maier b1ef8f5f69 select: gather statistics for TCP connections
osmocom applications are deployed in a variety of different situations.
Dependung on the medium that interconnects the network components
unexpected behaviour may occur. To debug problems with the
interconnection between network components it might help to monitor the
health of the related TCP connections.

Change-Id: I1416f95aff2adcf13689646b7574845de169fa3d
Related: SYS#5701
2021-12-23 14:52:15 +00:00
Harald Welte 9fe1f9fb0b Introduce CRC and FSM for IuUP (user plane) as used in 3G RTP data
Only support for SMpSDU mode is introduced in this commit.

Not supported explicit list:
- Transparent mode
- ATM/AAL2 based Transport layer
- GTP-U based Transport Layer
- Iu Rate Control procedure
- Time Alignment procedure

APIs are provided to allocate the primitives properly inside the related
msgb. This way primitives can be placed in the headroom, leaving the
data part of the msgb for the IuUP payload, hence allowing re-use of the
msgb and 0 copy of IuUP payload when forwarding data over RNL<->TNL.
Since RNL and TNL primitives relu struct osmo_prim_header, which is not
packed, they cannot be set to packed, and hence proper memory alignment
in the msgb must be done to avoid misaligned accesses (Asan errors about
it otherwise).

Related: SYS#5516
Change-Id: Ibe356fa7b1abaca0091e368db8478e79c09c6cb0
2021-12-22 14:58:31 +01:00
Oliver Smith 04bfb7165b treewide: remove FSF address
Remove the paragraph about writing to the Free Software Foundation's
mailing address. The FSF has changed addresses in the past, and may do
so again. In 2021 this is not useful, let's rather have a bit less
boilerplate at the start of source files.

Change-Id: I5050285e75cf120407a1d883e99b3c4bcae8ffd7
2021-12-14 12:44:03 +01:00
Vadim Yanitskiy 3a22173892 tests/testsuite.at: ensure empty stderr for the bitvec_test
The address sanitizer may print errors and warnings to stderr, and
this was actually the case for bitvec_test before [1]:

  bitvec.c:492:24: runtime error: shift exponent 64 is too large
                                  for 64-bit type 'long unsigned int'

Change-Id: Ia82b92eddb18dc596881abcef2f098dc7385538b
Related: [1] I4deeabba7ebb720cdbe7c85b37bc011d05bdfa65
2021-11-18 13:11:20 +00:00
Vadim Yanitskiy 8a55a6c571 bitvec_read_field(): fix incorrect bit-shift issue found by UBSan
While running a sanitized version of the bitvec_test I get:

  bitvec.c:492:24: runtime error: shift exponent 64 is too large
                                  for 64-bit type 'long unsigned int'

This error is triggered by the following line in the bitvec_test:

  _bitvec_read_field(0, 8 * 8 + 1); /* too many bits */

which basically tries to parse more bits (65) than the test vector
actually has (64).  The problem is that we don't check if the
given vector has enough data *before* entering the parsing loop,
so we end up doing weird bit-shifts and getting weird values:

  bitvec_read_field(idx=0, len=65) => bd5b7ddffdd7b5db (error)

Unfortunately, this problem remained unnoticed so far because in
'tests/testsuite.at' we don't check if stderr is empty.  This is
fixed in a follow up change [1].

Rather than checking for errors in every loop iteration, do this
once and return early if the overrun is possible with the given
offset and length arguments.

Change-Id: I4deeabba7ebb720cdbe7c85b37bc011d05bdfa65
Related: [1] Ia82b92eddb18dc596881abcef2f098dc7385538b
2021-11-18 13:11:20 +00:00
Vadim Yanitskiy de3549a234 bitvec_read_field(): indicate errors using errno
This function returns an *unsigned* integer (uint64_t), so returning
a negative value on error is a bad idea.  A negative value turns into
a huge positive value, what was demonstrated in the bitvec_test:

  bitvec_read_field(idx=512, len=16) => ffffffffffffffea
  bitvec_read_field(idx=0, len=65) => ffffffffffffffea
  bitvec_read_field(idx=64, len=16) => ffffffffffffffea

The 0xffffffffffffffea above is basically:

  (uint64_t) -EINVAL, or
  (uint64_t) -22 + 1, or
  0xffffffffffffffff - 0x16 + 1.

Let's make use of the errno in order to indicate an error to the caller.

Change-Id: I2cc734caa3365d03c2ae2b3f2cd9544933c25e9e
Related: OS#4388
2021-11-18 13:11:20 +00:00
Vadim Yanitskiy 52a38b456d tests/tdef: rename the binaries to end with '_test'
It's the usual naming for unit test binaries.  Without the '_test' endig,
the tdef_vty_test_{config_root,config_subnode,dynamic} binaries do not
match the 'tests/*/*_test' pattern and appear as untracked files in git.

Change-Id: I828fa45132e11a41c527d4b25df850c19871cb75
2021-11-17 20:17:59 +00:00
Vadim Yanitskiy ce73dda7fb tests/vty: fix use of GNU 'missing =' extension in designator
Change-Id: I66edb247898594b51cc9d7c1b3d0c60ba66fc637
2021-11-17 20:13:18 +00:00
Neels Hofmeyr 25c9741445 add osmo_time_cc, moved from osmo-bsc
Related: SYS#4878
Related: Ica9f908a1a30f334a24c59471affa11225117e12 (osmo-bsc)
Change-Id: Iabb17a08e6e1a86f168cdb008fba05ecd4776bdd
2021-11-15 09:06:03 +00:00
Vadim Yanitskiy 52a5c112f1 stats: clarify error messages in cfg_no_stats_reporter_{statsd,log}
Change-Id: I287130213c7de31a510f293bed0f3daddd53ce04
Related: SYS#5713
2021-11-09 15:04:00 +03:00
Vadim Yanitskiy d6b00591f7 stats: don't mark reporter as 'disable' beforehand
Change-Id: I330a079807cca48b7cc43767abcd2b58830a05fc
Related: SYS#5713
2021-11-09 13:46:59 +03:00
Vadim Yanitskiy 4f1c4e3027 stats: cosmetic: print 'stats interval' before the reporters
It's better to have the common parameters printed first.

Change-Id: Ifb401d4d363fb70e89960ca739baba5ee55eefe8
Related: SYS#5713
2021-11-09 13:41:56 +03:00
Vadim Yanitskiy bfc8377398 stats: allow configuring reporter's name in the VTY
This allows configuring more than one reporter of the given type.

Change-Id: Ia815c24dc974648985539913012b3b074ea317a9
Related: SYS#5713
2021-11-09 04:35:07 +03:00
Vadim Yanitskiy 4e92472281 stats: use llist_add_tail() in osmo_stats_reporter_alloc()
This allows printing reporters in the exact order as they were configired.

Change-Id: I904cd0ed53510dbe26c15cd287ba2707ca04cd6e
Related: SYS#5713
2021-11-09 04:34:46 +03:00
Vadim Yanitskiy ac3a3fc91b tests/stats: add VTY transcript tests
Change-Id: I85ac73f4c866617179e55821a292aad33b6edc99
Related: SYS#5713
2021-11-09 04:29:57 +03:00
Harald Welte b72867f0e6 logging: Change stderr + file target to use non-blocking write
So far, we used blocking, buffered fwrite() to write to stderr
and file targets.  This causes problems if there are [slow] consumers
causing delays, such as gnome-terminal (when the program is started
interactively) or systemd/journald (where we observe 64..128ms blocks on
stderr).

This patch introduces stderr/file based logging via write_queue
and osmo_select_main(), i.e. switch from glibc-buffered, blocking
to internally buffered, non-blocking writes.

* when osmo_stderr_target is created via application.c, we create it
  in blocking stream mode for backwards compatibility, particularly
  for [smaller] programs that don't use osmo_select_main()

* when the VTY code encounters 'log stderr' or 'log file FILENAME',
  we switch that respective target to non-blocking write-queue mode,
  as this means the application is in fact using osmo_select_main()

* The config file can now state 'log stderr blocking-io' or
  'log file FILENAME blocking-io' to explicitly enforce using blocking
  stream based I/O

* The application can at any time use API functions to switch either way

Closes: OS#4311
Change-Id: Ia58fd78535c41b3da3aeb7733aadc785ace610da
2021-10-26 17:16:47 +02:00
Alexander Couzens 67cfc5dc9a ns2: message: BLOCK/BLOCK ACK allow to use a given NSVCI instead of using the nsvc nsvci
The BLOCK and BLOCK ACK PDUs can be send over a working NSVC to inform
the NSE that a NSVC is blocked.

Change-Id: I6189229fdc1f054e86811bc60cb7646e1f758a78
2021-10-08 05:43:46 +00:00
Neels Hofmeyr 6a5940740a refactor stat_item: report only changed values
Change the functionality of skipping unchanged values: instead of
looking up whether new values have been set on a stat item, rather
remember the last reported value and skip reporting identical values.

stats_test.c shows that previously, a stat item reported a value of 10
again, even though the previous report had already sent a value of 10.
That's just because the value 10 was explicitly set again, internally.

From a perspective of preserving all data points, it could make sense to
send consecutive identical values. But since we already collapse all
data points per reporting period into a max, that is pointless.

Related: SYS#5542
Change-Id: I8f4cf34dfed17e0879716fa2cbeee137c158978b
2021-09-30 18:33:43 +00:00
Neels Hofmeyr e90c7176be refactor stat_item: get rid of FIFO and "skipped" error
Intead of attempting to store all distinct values of a reporting period,
just store min, max, last as well as a sum and N of each reporting
period.

This gets rid of error messages like

  DLSTATS ERROR stat_item.c:285 num_bts:oml_connected: 44 stats values skipped

while at the same time more accurately reporting the max value for each
reporting period. (So far stats_item only reports the max value; keep
that part unchanged, as shown in stats_test.c.)

With the other so far unused values (min, sum), we are ready to also
report the minimum value as well as an average value per reporting
period in the future, if/when our stats reporter allows for it.

Store the complete record of the previous reporting period. So far we
only compare the 'max' value, but like this we are ready to also see
changes in min, last and average value between reporting periods.

This patch breaks API by removing:
- struct members osmo_stats_item.stats_next_id, .last_offs and .values[]
- struct osmo_stats_item_value
- osmo_stat_item_get_next()
- osmo_stat_item_discard()
- osmo_stat_item_discard_all()
and by making struct osmo_stats_item opaque.
In libosmocore, we do have a policy of never breaking API. But since the
above should never be accessed by users of the osmo_stats_item API -- or
if they are, would no longer yield useful results, we decided to make an
exception in this case. The alternative would be to introduce a new
osmo_stats_item2 API and maintaining an unused legacy osmo_stats_item
forever, but we decided that the effort is not worth it. There are no
known users of the removed items.

Related: SYS#5542
Change-Id: I137992a5479fc39bbceb6c6c2af9c227bd33b39b
2021-09-30 18:33:43 +00:00
Alexander Couzens ca5ce0d849 ns2: nsvc: add a uptime/downtime to track the last state change
To show adminstrator the last state change of a nsvc add a timestamp and
show it on the vty

> show ns nsei 1234
NSEI 01234: UDP, DEAD since 0d 0h 1m 42s
[...]
  4 NS-VC:
   UNBLOCKED DYNAMIC sig_weight=1 data_weight=1 udp)[127.0.0.1]:22000<>[127.0.0.1]:23001 ALIVE since 0d 0h 0m 1s
   UNBLOCKED DYNAMIC sig_weight=2 data_weight=2 udp)[127.0.0.1]:22000<>[127.0.0.1]:23000 ALIVE since 0d 0h 0m 1s
   UNBLOCKED DYNAMIC sig_weight=2 data_weight=2 udp)[127.0.0.1]:22001<>[127.0.0.1]:23000 ALIVE since 0d 0h 0m 1s
   UNBLOCKED DYNAMIC sig_weight=1 data_weight=1 udp)[127.0.0.1]:22001<>[127.0.0.1]:23001 ALIVE since 0d 0h 0m 1s

Related: OS#5028
Change-Id: Ie3a039a209869295afa5feda39297cee81fedf22
2021-09-23 13:12:34 +02:00
Alexander Couzens 2c64c257c8 ns2: nse: add a uptime/downtime to track the last state change
To show adminstrator the last state change of a nse add a timestamp and
show it on the vty

> show ns nse 1234

NSEI 01234: UDP, ALIVE since 0d 0h 0m 16s
 FSM Instance Name: 'GPRS-NS2-SNS-SGSN(NSE01234-SNS)[0x6120000012a0]', ID: 'NSE01234-SNS'
  Log-Level: 'DEBUG', State: 'CONFIGURED'
  Timer: 4
 Maximum number of remote  NS-VCs: 8, IPv4 Endpoints: 2, IPv6 Endpoints: 0
 [...]

Related: OS#5028
Change-Id: I8143080a3c5c9a55d37dfad44ba2ac6561daa216
2021-09-23 13:12:34 +02:00
Harald Welte 53b4bbb955 osmo-auc-gen: Print RFC3310 IMS HTTP-AKA style base64 nonce/res
This is useful when debugging IMS Authentication which uses
RFC3310 representation of the nonce and expected result.

Change-Id: Ibfa72410d8ff8e5b42063f1a12bff69ad2bebbb8
2021-09-21 19:57:56 +00:00
Harald Welte d075e3ae23 base64: reformat using Lindent to conform to our coding style
Change-Id: I2286fa0d2cba7c11359bb48329135dfcd0d8a948
2021-09-21 19:57:56 +00:00
Harald Welte 292f9e7014 base64: Migrate over to osmocom
This containts the osmocom changes to the mbedtls base64 code
merged in the previous commit.

Change-Id: I82c1bf5f827c8def370dbcb80b146e9e4184c4a3
2021-09-21 19:57:56 +00:00
Neels Hofmeyr 599601e12c stats_test: assert counter and stat item val counts separately
Instead of just a send_count, keep one such count for the counter
updates, and a separate one for the stat item updates.
Print those numbers in the test output.

An upcoming patch will tweak stat_item reporting so that only an
actually changed value results in sending a new stat value. This patch
allows illustrating that change clearly.

Related: SYS#5542
Change-Id: I2da003ee6ec15f1c3959efe69e01b4ee24af82bb
2021-09-20 13:05:32 +00:00
Neels Hofmeyr 47773344fb utils: add osmo_str_to_int() and osmo_str_to_int64()
Properly converting a string to an integer while validating against all
possible errors is not trivial. It is a recurring theme in code review,
and there are places in osmo code that do it wrong.
End this by providing a simple API, if for nothing else then as an
example of how to use strol() / strtoul() / strtoll() / strtoull()
in an airtight way.

A subsequent patch, adding stat items to the CTRL interface, uses this
to properly validate indexes in CTRL variables and convert them to int.

Related: SYS#5542
Change-Id: I4dac826aab00bc1780a5258b6b55d34ce7d50c60
2021-09-12 21:24:50 +02:00
Alexander Couzens 1f3193d344 gprs_ns2_sns: implement local change weight procedure
When changing the bind ip-sns weight, initiate a
SNS CHANGE WEIGHT procedure to inform the other side.

Related: OS#5036
Change-Id: Icec4dabb46bc198f68f91bfe09ba279fbe68d454
2021-09-04 00:00:48 +02:00
Oliver Smith 11da4a4abd stats: send real last value if no new values come
Background:
* Individual values can be added to osmo_stat_item.values at any time.
* Stats are reported at a fixed interval (see vty 'stats interval'),
  e.g. every 10 seconds.
* In order to report a new stat value, we use the maximum of all
  osmo_stat_item.values added since the last report.
* By default, we do not send new stat values if they did not change
  (see vty 'config-stats' -> 'flush-period' default of 0).

Fix the following bug:
* If 'flush-period' is 0, and no new osmo_stat_item.values are coming
  in, the last value that gets reported is not necessarily the last
  entry in osmo_stat_item.values.
* For attached reporters (statsd), it could then be that the given stat
  stays at the wrong value for a long stretch of time (think of several
  hours/days/forever).

Explanation of how the test shows that it is fixed:
* stats get reported (value is irrelevant)
* osmo_stat_item gets a new value: 20
* osmo_stat_item gets a new value: 10
* stats get reported (value: 20, the maximum of both new values)
* osmo_stat_item gets no new values
* stats get reported (value: 10, this is new because of the bug fix,
  the real last value in osmo_stat_item, different from the 20 sent
  earlier, without the fix it would not send anything here and the last
  sent value would be 20)
* osmo_stat_item gets no new values
* stats get reported (nothing gets sent, since the real last value was
  already sent and 'flush-period' is 0)

Fixes: OS#5215
Change-Id: Ibeefd0e3d1dbe4be454ff05a21df4848b2abfabe
2021-08-20 14:04:54 +00:00
Oliver Smith a79a549273 tests/stats: show how last item sent may be wrong
Extend the test to illustrate the bug described in the related issue,
which will be fixed with the next patch.

Related: OS#5215
Change-Id: I1d26867ac1b837bea6a9754a3203e53c147e7a5f
2021-08-20 14:04:54 +00:00
Oliver Smith 22db07d7ed tests: add 'make update_exp' target
Add convenience target to update the test output.

Change-Id: I7247fffde82ab9195ae03b2ccb30d7aa47543113
2021-08-19 10:04:26 +02:00
Alexander Couzens a140d44a4f gprs_ns2: ensure the NSE becomes dead when FR link went down
The FR code is using force unconfigured to change the state of the NSVC
when the FR link goes down. The force unconfigured state didn't
notified the NSE when changing into this state.

Related: SYS#5533
Change-Id: I4d7bbbbce26f7cde99eebe96995c50b1e812e5bd
2021-07-13 07:43:06 +00:00
Alexander Couzens 5e040bf1f1 gprs_ns2_vty: dump_nsvc: change output depending on NSVCI
If the NSVCI is valid, there is no signalling or data weight defined (internally this is 1).
For NSVC with NSVCI don't print the signalling or data weight.
For NSVC without NSVCI, don't print NSVCI at all.

Related: OS#5180
Change-Id: Iaadc806a9136436468e2b02eb0bc1f4570a10ecc
2021-07-06 09:50:23 +00:00
Alexander Couzens 56287d26fe gprs_ns2: use gprs_ns2_free_bind() to clean up a bind
gprs_ns2_free_bind() takes care of all required steps to clean up a bind.
The driver->free_bind() operation only cleans up the driver internal state
but not NSVCs and other generic things.
Fixes a crash when free'ing a bind from the vty which has active NSVCs.

Related: OS#5195
Change-Id: I0a2ad22905bcacb929b9b5f5b034af0da3081826
2021-07-06 11:21:30 +02:00
Alexander Couzens db7b2ab36b gprs_ns2: fix crash when changing the MTU
When the MTU changes for any fr device, all
NSE will recalculate their MTU. If any NSE is alive,
libosmocore will crash.

Related: OS#5192
Change-Id: I31ba5cefea7bbb0b74060d6664b42c58815ee2a1
2021-07-02 17:38:02 +02:00
Alexander Couzens e09deb6355 gprs_ns2: fix missing notify towards the NSE when NSVC become blocked
The NSE wasn't notified when a NSVC went into the BLOCKED state from
an UNBLOCKED state.

Related: OS#5182
Change-Id: I09634e414e9bb966e6b5809b7de1b59fbabd413d
2021-06-25 08:12:39 +00:00
Alexander Couzens d5cd8c61cb gprs_ns2: use llist_add_tail to keep order
When configuring multiple NSE/BINDs the order of the configuration
should be keeped.

Related: OS#5181
Change-Id: Ibbc03f0780b49543b5bd97ee059f11cfd6c2a126
2021-06-25 08:12:39 +00:00
Pau Espin f5b8ed14a9 ctrl: Pre-calculate required size before allocating msgb
This commit fixes crash when response is more than ~4096 chars.
Furthermore, we now allocate only the required memory, not 4096 for all
messages, which usually don't require it.
Test needs to be adapted since it assumed there was more available space
at the end of the msgb.

Related: OS#5169
Change-Id: I0b8f370f7b08736207f9efed13a0663b5e482824
2021-06-15 16:29:44 +00:00
Pau Espin 7b894a7de0 Use new stat item/ctr getter APIs
Generated with spatch:
"""
@@
expression E1, E2;
@@
- &E2->ctr[E1]
+ rate_ctr_group_get_ctr(E2, E1)
"""

"""
@@
expression E1, E2, E3;
@@
- E2->items[E1]
+ osmo_stat_item_group_get_item(E2, E1)
"""

Change-Id: I41297a8df68e28dfc6016330ac82b0ed5dd0ebc1
2021-06-04 18:19:37 +02:00