Let's disable category here since we don't care about its formatting here.
In any case, every test relying on logging output validation should
always explicitly state the config to avoid issues in the future if
default values change.
Change-Id: Icce09882ef3ed07328679594ff84902383d16c72
Related: OS#5034
Check if tun-device is defined and give the user a hint that it is
missing instead of segfaulting with gtpu-mode kernel-gtp:
20210205141701206 DGGSN <0002> ggsn.c:186 APN(internet): Starting
20210205141701206 DGGSN <0002> ggsn.c:204 APN(internet): Opening Kernel GTP device (null)
Segmentation fault
With gtpu-mode tun it didn't segfault, but still tried to open the NULL
device:
20210205141557598 DGGSN <0002> ggsn.c:186 APN(internet): Starting
20210205141557599 DGGSN <0002> ggsn.c:189 APN(internet): Opening TUN device (null)
20210205141557599 DTUN <0001> tun.c:195 errno=1/Operation not permitted ioctl() failed
Related: OS#3208
Change-Id: I9f71af65cc0eed71728c04b774e5c08352947913
Previous code relied on abort() switching sigaction to SIG_FDL +
retriggering SIGABRT in case the signal handler returns, which would
then generate the coredump + terminate the process.
However, if a SIGABRT is received from somewhere else (kill -SIGABRT),
then the process would print the talloc report and continue running,
which is not desired.
Change-Id: I7acfdfe5020320d853cba98b5add7479f8aaaf39
Fixes: OS#4865
Fix test for return value from gtp_pdp_getimsi() so
we do not call show_one_pdp() with an uninitialised pdp_t
Change-Id: Ic40429939b185f97c020dd3904e054fe860b91e8
The PDP context is searched on the hash which is generated
on context creation from the IMSI in gtp format. - A hash
created from "human-readable" IMSI does not match.
Check user input for length then convert the IMSI to gtp format
before continuing.
Change-Id: Icd2e2bc6068c06fbf5d5fe905ebcda8954f33f04
queue_test.c:39:3: warning: format '%ld' expects argument of type
'long int', but argument 9 has type 'unsigned int' [-Wformat=]
Change-Id: Ie9530cdd191386ca3f6c336684f81c4582c4d962
Remove OpenSUSE bug report link, set version to @VERSION@, make it build
with CentOS 8 etc.
Related: OS#4550
Change-Id: Iba04d5c7b9beee80baca83063f9cb2cd533a0003
Remove old osmo-ggsn.spec.in file from 2017 in favor of the one imported
from mnhauke, which is currently used in openSUSE nightly builds (will
be added in a follow-up commit).
Related: OS#4550
Change-Id: I24794564f0d4d85d3955ab08f4e4c3c05f53a0cd
In debug.c the log category DICMP6 uses LOGL_DEBUG as default. This is
way to verbose, lets use LOGL_NOTICE instead.
Change-Id: I4c6a9165114d1240e7e2cfa98d30d571a3f4e9d2
Related: OS#2577
The device name option could be empty, using it without checking
would crash sgsnemu. Using the real device is better anyway.
Change-Id: Ic3934281bfc2e433323e4ab72cf5be2cbd1c962a
Until now, sgsnemu was able to identify pdp contexts of incoming packets
in the tun based on the assumption that the Interface-Identifier part of
public IPv6 addresses in incoming packets was equal to the announced
prefix path during Create Pdp Context Response (see changes in cb_tun_ind()).
This assumption works fine with osmo-ggsn due to implementation details but
breaks on other spec-conformant GGSNs.
In order to fix it, a new placeholder struct pdp_peer_sgsnemu_ctx is
introduced which will be assigned to each pdp_t "peer[0]" user-defined
pointer. This way, each pdp_t ctx upgrades from having only 1 iphash_t
item to 3 (hence being able to match against 3 different ip addresses).
This way, in IPv6 we can match against 2 different IP addresses set on
the tun iface:
* link-local: "fe80::IfId", where IfId is the Interface-Identifier
received during Pdp Context Resp and which can be used to communicate
with the nearest router (the GGSN).
* global: The global IPv6 addr set after SLAAC procedure, containing a
the prefix announced by CreatePdpContextResp/RouterAdvertisement and
an Interface-Identifier chosen by sgsnemu itself (currently ::ff).
This change is also a step forward towards supporting IPv4v6 APNs in sgsnemu.
Related: OS#4434
Change-Id: I0d36145250185e4cce699fdaedfe96bd969f5fa1
Disable IPv6 automatic SLAAC by linux kernel and handle it manually.
This allows us gaining control on local address acquisition and set
addresses and routing properly. It will also allow us to run in ping
mode without a tun iface.
Related: OS#4434
Change-Id: Iae59cf6ffb181357e10b3080a5c751bd454f4a1f
On older systems (like debian 8), the enum is not present in the header
file and build will fail (as saw in osmocom's OBS instance).
Furthermore, the sysctl to change the value was added at a later point
in time, which means compiling can go fine but running may fail due to
the sysctl not being available.
This is a fix-up to Change-Id I1d51f3ca91edbb3b788939982ab63264182ec2ce
Change-Id: I208970d5b16ea7148444d414b0a6f68c8d9a086c
Functions for IPv6 will be added soon afterwards. Also take the chance
to check for address length in sgsnemu and only apply the route if the
address matches.
Change-Id: Ic6c1b3c11c56f047e6e8c6f1040257fd62afea0f
It's not needed because a link-local address will be added as a result
of Create Pdp Context Response. Morevoer, it fools sgsnemu ip addr
verifications since it gets used on some scenarios by applications.
Change-Id: I1d51f3ca91edbb3b788939982ab63264182ec2ce
The example config for osmo-sgsn suggests to use 127.0.0.6 as bind ip.
(the ip-address where the SGSN tries to connect) Lets use 127.0.0.2
instead to match the default config of osmo-sgsn.
Change-Id: I513ab64896dee47fd92dbc5ef495fe1c6e734ec3
The error handling in the code was doing exactly what one would not
expect. If we switch to a netns and then encounter an error, we
obviously have to switch back to the original netns before returning.
Likewise, if we temporarily change the signal mask, we need to switch
back to the original one before returning.
Change-Id: I9ff5ae7bffc5bd7629dae0af1b72cfea548f9039
The parameter was simply unused until this change was made. An Ipv6 can
have a prefix length between 48 and 64 bits.
Change-Id: I4b1512d5a4d7bbc2516221ea6808565eac0eb18f
sgsnemu is a testing program and doesn't have a VTY iface to configure
its log levels, so let's simply enable INFO as a default.
Change-Id: I2a577f547b57fb0ab7b83de5c12da088697f3904
Let's avoid buffer-overflow writing into out-of-bounds memory in the
event the GGSN sends us 2 EUAs in Create PDP Context Respose. It should
theoretically happen since we don't yet support ipv4v6 APNs in sgsnemu,
but who knows.
Change-Id: I8becd90ce1f0e8bb6e21438c04da4a9cab845492
As pointed out at https://github.com/libexpat/libexpat/issues/312
libtool does not play nice with clang sanitizer builds at all.
For those builds LD shoud be set to clang too (and LDFLAGS needs the
sanitizer flags as well), because the clang compiler driver knows how
linking to the sanitizer libs works, but then at a later stage libtool
fails to actually produce the shared libraries and the build fails. This
is fixed by this patch.
Addtionally LD_LIBRARY_PATH has no effect on conftest runs during
configure time, so the rpath needs to be set to the asan library path to
ensure the configure run does not fail due to a missing asan library,
i.e.:
SANS='-fsanitize=memory -fsanitize-recover=all -shared-libsan'
export CC=clang-10
ASANPATH=$(dirname `$CC -print-file-name=libclang_rt.asan-x86_64.so`)
export LDFLAGS="-Wl,-rpath,$ASANPATH $SANS $LDFLAGS"
Change-Id: Icc09c9d09bfa01264ddf867356d068e50d97c5a0