Building with gcc (Debian 12.2.0-14) 12.2.0 and --enable-werror fails
without this during "make distcheck":
../../../src/gb_proxy.c:450:24: error: storing the address of local variable 'tp' in '((struct libgb_msgb_cb *)msg).bssgp_cell_id' [-Werror=dangling-pointer=]
450 | msgb_bcid(msg) = (void *)&tp;
This means that gcc now warns (and we turn that into an error) if one
assigns the address of a local (stack) variable to something allocated
on the heap, and doesn't remove that reference before ending the function
(invalidating the stack).
By default systemd will execute service with root directory (or home directory for user instance) which might result in
attempts to create files in unexpected place. Let's set it to 'osmocom' subdir of state directory (/var/lib for system instance) instead.
Previously the SGSN BVCs would still be present after the related Cell
was freed. This caused some inconsistencies if a BVC with the same BVCI
was established again. The symptoms of this were cells that were attached
to no SGSN or the same one multiple times and crashes.
This patch ensures that the SGSN-side BVCs are also freed when the cell
is freed and that this fact is reflected when handling reset
The BVCI IE is listed as conditional and is only included if the flush
action indicates that LLC-PDUs are transferred. (3GPP TS 48.018 Ch.
The code in gbprox_rx_sig_from_bss unconditionally tries to get a BVCI
from a FLUSH_LL message which could result in a segfault if no such IE
is included. Routing towards the SGSN can happen simply based on TLLI (for pooling)
since there is only one signalling BVC towards the SGSN.
The ra_id as well as the cell_id are already present in struct
gbproxy_cell which is reachable from bvc->cell. Remove the ra_id in
struct gbproxy_bvc and also remove some unused/unneeded code. The FSM
reset_notif callback already takes care of updating the cell.
Do not turn some compiler warnings into errors by default. This patch
was added before --enable-werror was available.
We build with --enable-werror during development and in CI. If the code
is built with a different compiler that throws additional warnings, it
should not stop the build.
This reverts commit 34f012639ddf41470714ae74ae961d158670a4c7.
This code was copied in BSS and SGSN PTP receive functions and also in
the functions that extract the inner PDU-in-error from the STATUS PDU.
Use a central function for less code duplication and better
This also fixes TTCN3 test TC_status_ptp_ul_tlli the c&p omitted the
special handling of UL/DL unitdata.
Handle SGSN BVCs that are gone from the BSS differently.
The previous patch removed the gbproxy_bvc on the SGSN-side after it was
gone on the BSS-side. This caused a STATUS response to BVC_BLOCK_ACK messages
that should be valid. Instead of removing the BVC this patch marks it as
inactive so we can still handle BVC_BLOCK_ACK correctly, but ignore
other messages - especially BVC_RESET from the SGSN.
Related: SYS#5628. OS#5236
If we keep the bvc around the SGSN could send a BVC-RESET which the
gbproxy would ACK. This will reestablish the BVC only between the gbproxy and
SGSN which can lead to all sorts of issues.
With this patch the gbproxy will respond with a BVC-STATUS cause BVCI
Both ctrl commands gbproxy-state and number-of-peers should only
operate on PtP-BVCs. This patch avoids a crash in gbproxy-state and
fixes the count of number-of-peers to only include PtP-BVCs.
Related: SYS#5542, OS#5200