Commit Graph

718 Commits

Author SHA1 Message Date
Pau Espin 5545bcea5d pco.h: Fix typo in reference to spec
Change-Id: Ic428892161123b62d25a7619128ef7325bf85500
2022-03-24 12:51:17 +01:00
Pau Espin c97286f839 gtp: Fix typo in comment
Change-Id: I0e38e0966081d8b37c3f816f5330b4f52f81b7fa
2022-03-07 16:22:53 +01:00
Pau Espin f471800168 gtp: Log retrans queue register&free entries
Change-Id: I4e12376652fc7a6a96fbdcb579dbe916c1473012
2022-03-07 16:22:53 +01:00
Pau Espin bdf0697a5a gtp: Specify retrans queue name & seqnum in log lines
Change-Id: I4f193d7a482ace33afd8526b5f50d2d03467d5fa
2022-03-07 12:55:07 +01:00
Pau Espin 674a912fb5 gtp: Small log improvements in gtp_create_pdp_ind()
Drop unneeded log line, rewrite line to better fit code path.

Change-Id: Id254e04d539cc055fee8c16fb66cd897b041557e
2022-03-07 12:44:15 +01:00
Pau Espin 1bf3b3d0f9 gtp: Log detection of rx duplicate
Change-Id: I8bc9143db6743ad4fae2fe6d6fe0417648e9eec9
2022-03-07 12:20:13 +01:00
Pau Espin fb9303c610 gtp: Use switch statement in gtp_create_pdp_ind()
Double if had to be changed to if-else anyway, so let's simply use a
switch statement.

Change-Id: I91e8722947e58776742521d89abef8ae7584cb25
2022-03-07 11:34:30 +01:00
Pau Espin 0585769741 libgtp: Define retransmit QUEUE_SIZE relative to PDP_MAX (increase)
QUEUE_SIZE holds the number of pending transmitted messages
which can be handled concurrently.
Current value was 1024, same as PDP contexts (PDP_MAX). However, that
seems to be a quite low amount, which can be filled under certain
conditions, for instance if recovery procedure is triggered on the GSN
which is running full (around PDP_MAX pdp contexts created).
In this scenario, the GSN would need to send around PDP_MAX concurrent
messages (DeletePDPContextReq), which means the queue would very likely
end up being full.
Hence, let's define QUEUE_SIZE based on PDP_MAX, and set it to twice the
size to make sure it won't be filled in extreme conditions.

Change-Id: I6034b0fab2b2e5962314c2fca2f893246ce5cf4f
2022-03-01 12:39:08 +01:00
Pau Espin 9b288b788e libgtp: Fix ggsn crash if pdp alloc array is full (PDP_MAX)
osmo-ggsn crashes when concurrent pdp context num 1024 is created, due to
the gsn->pdpa array (of size PDP_MAX, 1024) being full.
The crash happens because return code of gtp_pdp_newpdp was not checked,
and hence a pointer "pdp" pointing to a temporary not-fully-allocated
object was being passed to gsn->cb_create_context_ind() callback.

Let's avoid crashing and instead reject the PDP context.

Related: OS#5469
Change-Id: I0d94ffad97eb4fef477d981bf285bf99740592a3
2022-03-01 12:38:58 +01:00
Pau Espin 134ac7e7c8 vty: Fix cmd 'no echo-interval' doing nothing
It was incorrectly implemented and in practice was a NOOP.

Change-Id: I5e03c4965d05871d3f2e56675da6e75af0ec18c2
2022-02-25 17:25:00 +01:00
Pau Espin 46f04343a5 tests: in46a_test: Make coverity happy when calling in46a_from_eua
Coverity warns around that test code:
"Overrunning struct type in46_addr of 20 bytes by passing it to a
function which accesses it at byte offset 39."

That's basically because in64a_from_eua expects to be passed a 2 element
array to be filled. The second element, though, is only accessed in the
case where an IPv4v6 EUA is passed, so in the cases where the test
explicitly passes an IPv4 or IPv6 EUA it's not really an issue, hence
coverity throwing a false positive here.
Let's anyway rewrite the code to pass a 2 element array for completeness,
since it doesn't hurt and makes coverity happy.

Related: Coverity CID#249006
Change-Id: Idfc9104f48eeee6e7f11ebc5c17d4b0e4b2fe9e2
2022-02-09 09:41:46 +01:00
Pau Espin a3ca2d185b Bump version: 1.7.1.20-8cbd-dirty → 1.8.0
Change-Id: I21502c6e0b804237fe9bd8f5579dbabd519d6d51
2021-11-16 13:49:16 +01:00
Pau Espin 8cbdd21867 gtp_echo_responder: report invalid chars present in node-feautres cmdline arg as error
from "man strtoul":
"""
If endptr is not NULL, strtoul() stores the address of the first invalid character in *endptr.
In particular, if *nptr is not '\0' but **endptr is '\0' on return, the entire string is valid.
"""

Fixes: ae81195418
Change-Id: I89d26a575ef81ee17483db035924354588d9d094
2021-10-08 17:28:16 +02:00
Pau Espin ae81195418 Introduce program gtp-echo-responder
This is a small standalone program (under MIT license, hence cannot make
use of libosmocore) whose only purpose is to answer GTPC (v1 and v2)
Echo Request messages with Echo Reply ones, with information provided
from the command line.

A small python script companion is provided to easily test the program.

Related: SYS#5598
Change-Id: Ibdd6d8f6920571db0c60cf8b3b25d541b15ad3f1
2021-10-04 14:06:51 +02:00
Pau Espin 6ee5fa939a cosmetic: configure.ac: Fix tabulation in line
Change-Id: I5cfc90ace5f9cc9c3fe4dde7aeccbdf1909da007
2021-09-23 13:35:13 +02:00
Pau Espin b6a0e3fd2e ggsn: Fix heap-use-after-free during Recovery without associated PDP
Related: OS#4641
Change-Id: Ib4dca2e30e723a196084b0fa0040fbceca835359
2021-06-10 19:41:00 +02:00
Pau Espin bd2b55679e ggsn: Log tun fd write errors
Change-Id: I5f681b5edcc4cf525629d2078ae0c0ffd7ebb72d
2021-06-01 12:00:21 +02:00
Pau Espin f32c6a9095 gtp: Support tx/rx RAN Information Relay message
See 3GPP TS 29.060 sec 7.5.14.1 RAN Information Relay.

Related: SYS#5314
Change-Id: Iea3eb032ccd4aed5187baca7f7719349d76039d4
2021-05-06 18:57:12 +02:00
Pau Espin 2eed6ec5ec gtp: constify pointer arg
Change-Id: Ib5b5a8b64247202a2538c2ff8f8601981ccda822
2021-05-05 17:51:34 +02:00
Pau Espin 641206ad5e cosmetic: gtpie.c: Fix trailing whitespace
Change-Id: I552e3b5f694e1b49fe5e21fa4023e4a24ffc2784
2021-05-03 17:24:30 +02:00
Pau Espin bfd3119ae4 gtp: Improve logging of failing pdp ctx resolution from TEI/TID
Change-Id: I4f2084ec7e3a830e0224dd998ff0fe6654cc23bd
2021-04-22 16:24:55 +02:00
Pau Espin 4b9b19e998 ggsn: Improve logging on incoming DL data packets
Change-Id: I3617c8f68d8f18617871c070e28cc6ae5c6a925b
2021-04-22 16:24:55 +02:00
Pau Espin 00e0559e17 gtp: Rework parsing logic of UpdatePdpCtxResponse
The previous order of parsing lead to non-optimal information gathering
when pushing events to upper layers.

This patch rearranges parsing of packet data to always gather as much
info as possible for the benefit of the upper layer. This way it can
gather information such as the cause, which is important in the case of
"Non-existent", since user should then drop the context.

First we want to parse the recovery state, but delay cb to upper layers
until we tried to gather the pdp ctx (meaning all except that pdp ctx
should be freed).
Second, we want to parse the cause, in order to know if there's an
associated pdp ctx we can gather from TEID.
Third, once we know if we should expect a meaningul TEID, parse it.

Related: SYS#5435
Change-Id: Idd10b494e8fbac8703c49ecd8f9bbe4246e51c57
2021-04-22 16:24:48 +02:00
Pau Espin 0b1d9dbc40 gtp: Update teic_confirmed only on resp success
Change-Id: I54c54cbb51bfa5d1520855f448fa27511037b396
2021-04-21 19:45:23 +02:00
Harald Welte 5379273ea3 vty: Inform user that static IP addresses are not supported
Currently, osmo-ggsn doesn't implement PDP contexts with static IP
addresses.  The code for specifying ranges that can be used for
static IPs was always present even from OpenGGSN days, but we never
really treated them.  Let's not raise the impression we do by
warning accordingly if the user configures them.

Change-Id: I7787dae037c46c0c5052aa6dd000be330984f144
Related: OS#5097
2021-03-27 19:03:30 +01:00
Harald Welte ecef920b8f ggsn: Reject PDP CTX ACT for static IP addresses
We don't implement handling of static IP addresses for now,
let's properly reject those rather than allocating a dynamic address
anyway.

Change-Id: Iac8868438655fe4e5e07d167d7dbd6273dbb7678
Related: OS#5097
2021-03-27 19:00:34 +01:00
Harald Welte eb9267b15e Don't install sgsnemu.conf to /etc/osmocom/
This is an auxiliary example config file, which should not be installed
to /etc/ and hence not be in OSMOCONF_FILES

This fixes the following rpm packaging error:
[  149s] error: Installed (but unpackaged) file(s) found:
[  149s]    /etc/osmocom/sgsnemu.conf

Change-Id: Id31f6542590405531ff61a9434041c15e779865b
Fixes: Icd6f3efcf5a9ef50237a3d0a76d4cce55051f447
2021-03-03 08:10:56 +01:00
Harald Welte 1efb2bcd90 Don't install osmo-ggsn-kernel-gtp.cfg to /etc/osmocom/
This is an auxiliary example config file, which should not be installed
to /etc/ and hence not be in OSMOCONF_FILES

This fixes the following rpm packaging error:
[  149s] error: Installed (but unpackaged) file(s) found:
[  149s]    /etc/osmocom/osmo-ggsn-kernel-gtp.cfg

Change-Id: If118ed26491a1edda83eda7f95479e165ca4c150
Fixes: I6fbe8a8e55bad41532e9aed3cf71ebebffdcee52
2021-03-03 08:10:23 +01:00
Oliver Smith 878593f205 gitignore: add ggsn_vty_reference.xml
Change-Id: I39bd36e4bde457b7c7a62ca6aa6d5dadea4051fc
2021-03-02 09:03:20 +01:00
Oliver Smith 1596463985 doc/manuals: describe GTP-U kernel module
Related: OS#3209
Change-Id: Ib45cbfe03077960f216a83cf500ab3203d02cb3b
2021-03-02 09:03:09 +01:00
Oliver Smith 9d82492e49 doc/examples/osmo-ggsn-kernel-gtp.cfg: new file
Add a copy of osmo-ggsn.cfg, with gtpu-mode set to kernel-gtp and apn
inet6 and inet46 removed (as the kernel module only supports ipv4).

Related: OS#3209
Change-Id: I6fbe8a8e55bad41532e9aed3cf71ebebffdcee52
2021-03-01 15:37:39 +01:00
Oliver Smith 303aeea8a8 doc/examples/Makefile.am: add sgsnemu.conf
Related: OS#3209
Change-Id: Icd6f3efcf5a9ef50237a3d0a76d4cce55051f447
2021-03-01 15:03:10 +01:00
Pau Espin 18898b4a9f Bump version: 1.7.0.2-17ce → 1.7.1
Change-Id: Ideca49e0762eb20799375a33a04469673dfeb168
2021-02-23 17:31:24 +01:00
Harald Welte 17cee2056c manuals: generate vty reference xml at build time
Remove ggsn_vty_reference from the source tree.

In manuals/Makefile.am use the new BUILT_REFERENCE_XML feature recently added
to osmo-gsm-manuals, and add a build target to generate the XML using the new
osmo-ggsn --vty-ref-xml cmdline switch.

Change-Id: I772293cc78a6c95e07565a7048c1c8dadf87d2fc
Depends: I613d692328050a036d05b49a436ab495fc2087ba
Related: OS#5041
2021-02-23 17:08:14 +01:00
Harald Welte 67a3c833af main: add --vty-ref-mode, use vty_dump_xml_ref_mode()
Change-Id: I966715ab2a430497bbccf26c50aef72d0901997f
Depends: Ie2022a7f9e167e5ceacf15350c037dd43768ff40
Related: OS#5041
2021-02-23 17:08:06 +01:00
Pau Espin Pedrol b1f641b5b7 Bump version: 1.6.0.22-f01c-dirty → 1.7.0
Change-Id: I05d9bee0791cec5aebbeb1602be6697ecc2e2b74
2021-02-23 13:34:40 +01:00
Harald Welte f01ce65f5b gtp-kernel: don't #include libmnl headers
* we don't check for libmnl via pkg-config in configure.ac
* we don't add libmnl include path to CFLAGS

As a result, we cannot #include related files.

libmnl is completely encapsulated by libgtpnl.  It even
includes a forward-declaration of 'struct mnl_socket'.

Change-Id: I0af869cc3c8e30b69d73a4985c56ef7743565e95
2021-02-20 11:28:59 +01:00
Harald Welte be1cf99e9a gtp-kernel: Remove duplicate #include section
This was probably a wrong patch merge at some point.

Change-Id: I54191aca8fd55de84d86591035fe9785d379205f
2021-02-20 11:05:53 +01:00
Oliver Smith 7710080ffd deb/rpm: build with --enable-gtp-linux
Allow optional use of the GTP kernel module.

Related: OS#3208
Change-Id: Ic001ec6c5ec9887706a5b27f2a48cd61942ab4ee
2021-02-19 18:28:04 +01:00
Oliver Smith 798a81d48d .gitignore: ignore debian/libgtp*
Change-Id: I41fa611917defeab13f01a59dcc3f95961f10bda
2021-02-19 18:25:58 +01:00
Pau Espin 51930f7b63 tests: Replace deprecated API log_set_print_filename
Change-Id: I35eb879d82e1030ea8be56ce9039277c021bb6fa
2021-02-19 13:23:00 +01:00
Pau Espin 00ef1b0d6e tests: Explicitly drop category from log
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
2021-02-19 13:22:28 +01:00
Oliver Smith 02a82c3c9b apn_start: avoid segfault if missing tun-device
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
2021-02-05 16:37:02 +01:00
Oliver Smith 349cbfcf50 configure.ac: set -std=gnu11
Change-Id: I7fed7d43242f804e6d2b005277c5b2b1bd197aa8
2021-01-28 09:28:56 +00:00
Oliver Smith 51f99ae250 contrib/jenkins: don't build osmo-gsm-manuals
Related: OS#4912
Change-Id: Ie77a81d3bd7cdb739fa082d9e1b5ddeba433a9db
2021-01-13 13:05:20 +01:00
Pau Espin 12304c0e5a ggsn: generate coredump and exit upon SIGABRT received
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
2020-11-25 18:49:16 +01:00
Harald Welte 1719abb409 Use OSMO_FD_* instead of deprecated BSC_FD_*
Change-Id: Ib660cbbeafd8f4077c693d53127ecd1c15455455
2020-10-18 22:38:20 +02:00
Pau Espin 3ddf4c6933 contrib/jenkins: Enable parallel make in make distcheck
Change-Id: Id7d4e6682be1d4f77979e896089b42f35548ca98
Related: OS#4421
2020-10-12 19:32:31 +02:00
Keith Whyte fb2a7298e0 GTP: Replace recently introduced imsi_str2gtp()
Replace with the version from osmo-sgsn, renamed so
as not to collide with that version.

Change-Id: I910d5339a823332277ce7b5854d5c943ed69ea81
2020-10-12 15:47:26 +02:00
Keith Whyte 568ac5ee8e sgsnemu: relax check on length of IMSI cmdline arg.
Change-Id: I0374ff8773ae528c916fbee5f3f1efd89a5d2a08
2020-10-12 13:17:49 +02:00