Commit Graph

791 Commits

Author SHA1 Message Date
Pau Espin Pedrol
6d1d181403 vty: Fix missing newline in description of 'apn tun-device' cmd
Change-Id: I92002acdb83455eb6becc688c33192d3856b0aa6
2024-10-21 18:45:24 +02:00
Pau Espin Pedrol
7d80216717 Move g_ggsn_list declaration to ggsn.c
The llist belongs to the data domain, not the vty.

Change-Id: I0a93aacbdecc283dd4f6b32892430ebdb0b94e50
2024-10-17 18:58:10 +02:00
Pau Espin Pedrol
de385e0253 Move ggsn allocation code out of vty file
The details of creation of data structures don't belong on the vty file.
While at it, split allocation code into its own function to quickly find
out where the allocation of the object happens.

Change-Id: Iaa4cd86c44957321c238d268ea62daafa1b79c69
2024-10-17 18:56:55 +02:00
Pau Espin Pedrol
ce691d8e64 Move apn allocation code out of vty file
The details of creation of data structures don't belong on the vty file.
While at it, split allocation code into its own function to quickly find
out where the allocation of the object happens.

Change-Id: If15a4158dd6599341017efd24dbf67ca565a7c34
2024-10-17 18:51:39 +02:00
Pau Espin Pedrol
8c015bd89a ggsn: kernel gtpu: Support updating pdp ctx remote IP address and TEID
Whenever the SGSN sends the GGSN a UpdatePDPCtxReq, it may offer a new
remote IP address or/and remote TEID, eg. because it wants to establish
a Direct Tunnel and point the GTPU towards the RNC, or to point it back
to itself.
If the gtpu kernel is used, osmo-ggsn lacked updating the kernel with
the new remote data.
The gtp kernel module doesn't provide an efficient/explicit way to
update a pdp context keeping the4 same local IP+TEID and changing only
the remote remote IP+TEID, hence first destroy the pdp ctx in the gtp
kernel module and then recreate it.

This fixes test GGSN_Tests_v4_only.TC_pdp4_act_update_teid in
ttcn3-ggsn-test-kernel-net-next.

Related: OS#6523
Change-Id: I1fc48be5c0f177ccf6fbe97c003b4df44809c0fe
2024-08-19 11:57:23 +02:00
Pau Espin Pedrol
5f8960b206 ggsn: Mark internal cb function static
Change-Id: Ic9fdd50ae098058cc69e5aa6a0085819d69e3599
2024-08-01 17:45:49 +02:00
Pau Espin Pedrol
0828b2afc3 gtp: Allow setting callback to receive update_context_ind
This will be used by:
* SGSN: Get to know that RNC has gonne down according to GGSN (re-attempt
  Direct Tunnel or go back to tun SGSN<->GGSN).
* GGSN: Maybe find out that Direct Flags are used (should be handled
  internally directly in the rx path probably)

Related: OS#6512
Change-Id: Ic80a9a928c55b6ff85be96014920bb42793cb943
2024-07-31 17:23:59 +02:00
Pau Espin Pedrol
70a1d64e55 gtp: Allow UpdatePDPContext initiated by GGSN
The Update PDP Context procedure can be initiated GGSN -> SGSN, as
described in TS 29.060 7.3.3.

Related: OS#6512
Change-Id: I1c3441c71b90c5bbf6f4545484586222e6180fe1
2024-07-31 17:20:58 +02:00
Pau Espin Pedrol
ea3cf1b8ae gtp: Store rx Direct Tunnel Flags in UpdatePDPCtx{Req,Resp}
In Update PDP Ctx Response, only SGSN is expected to transmit Direct
Tunnel Flags in the message.

Related: SYS#5435
Change-Id: Ia3e360a35d30858eab1e438dc2508fd756c2e22e
2024-07-31 17:20:58 +02:00
Pau Espin Pedrol
7ce14f5e93 gtp: Allow tx Direct Tunnel Flags in UpdatePDPCtx{Req,Resp}
In Update PDP Ctx Response, only SGSN is expected to transmit Direct
Tunnel Flags in the message.

Related: SYS#5435
Change-Id: I36d93619e2fe9cafd3092515df18b82d29099d2d
2024-07-31 17:20:54 +02:00
Oliver Smith
561a9bc77c Bump version: 1.11.0.31-7ae1-dirty → 1.12.0
Change-Id: Idf8b178290cbb14e5199590feb584c82dc076dd0
1.12.0
2024-07-24 16:22:26 +02:00
Vadim Yanitskiy
7ae1177e04 README.md: cosmetic: fix a typo
Change-Id: Ia04c62a682cfeca2b054c8fb1ff9fff2aab2860d
2024-06-05 18:34:07 +07:00
Oliver Smith
57585767dc {contrib,debian}/osmo-ggsn.init: remove
Remove SysV init scripts. These are not really maintained anymore and
this makes it consistent with other Osmocom projects.

Avoids synchronizing with SysV scripts on debian:
  # systemctl enable osmo-ggsn
  Synchronizing state of osmo-ggsn.service with SysV service script with /lib/systemd/systemd-sysv-install.
  Executing: /lib/systemd/systemd-sysv-install enable osmo-ggsn

Change-Id: I11bfb5122344b54970b7f742470cb74b95fa37e0
2024-05-16 09:00:21 +00:00
Oliver Smith
488972b442 Use uniform log format for default config files
Related: OS#6272
Change-Id: I272767e029e95b64f2525d4f19efdfa1f0e29ca2
2024-05-16 09:00:21 +00:00
Oliver Smith
08239ccac3 contrib/systemd: run as osmocom user
Related: OS#4107
Change-Id: I915f2fc12d0bd905d24636aacb2760a6b72a55e3
2024-05-16 09:00:21 +00:00
Oliver Smith
fbc56063c5 doc: set state-dir to /var/lib/osmocom/osmo-ggsn
Prepare to run osmo-ggsn as user with the systemd service. As with other
Osmocom service files, we will set StateDirectory= and WorkingDirectory=
options. This results in osmo-ggsn only being able to write to
/var/lib/osmocom, therefore let's change the state-dir from /tmp to
/var/lib/osmocom/osmo-ggsn to avoid:

  gsn.c:411 fopen(path=/tmp/gsn_restart, mode=w) failed: Error = Permission denied

Having the state in /var/lib/osmocom also makes more sense, because then
it doesn't get deleted on reboot.

Change-Id: I5b51529b4f8bd2462e54f58a1ce2e2d7c76ff46a
2024-05-16 09:00:21 +00:00
Oliver Smith
c1598e0eb4 ggsn/ggsn_vty: create state-dir
Prepare to change the state-dir in the default config in a follow-up
commit. Create the directory if it does not exist.

Change-Id: I91349fb284336a9de6af41475f1b824eb0e021b0
2024-05-16 09:00:21 +00:00
Oliver Smith
519a2e401d gtp/gtp_internal.h: new file
While at it, move internal functions of gtp.h to a separate file too.
Make all functions that are only used inside gtp.c static.

The following APIs are unexpectedly public:
* imsi_gtp2str gets used by pdp.h
* gsna2in_addr, gtp_echo_req gets used by osmo-sgsn

Change-Id: I72c40cbdec33449ca8104fb3cad8df1a9e07dfd7
2024-05-14 11:13:45 +02:00
Oliver Smith
fbef527222 gtp: move conversion functions up
Move the conversion functions above the first user, so we can make
in_addr2gsna static in a follow-up commit and remove the extra
declaration.

Change-Id: I51e6a7c1161320fc54b0e8197ae57e4327976eb1
2024-05-14 11:13:45 +02:00
Oliver Smith
68f5b086ad gtp: remove unused conversion functions
Remove ipv42eua and eua2ipv4, which are in the "internal functions"
section of gtp.h, but are not used anywhere in the code anymore. This is
in preparation of moving the internal functions that are used in
multiple .c files into a separate header file, and to make the other
internal functions static. (Compiler complains about unused static
functions.)

Change-Id: I90e2750f6a6e3e6122e9c562103fda77d7326932
2024-05-14 11:13:41 +02:00
Oliver Smith
3cb3423a59 gtp/gtp.c: move gtp_create_context_resp down
Move gtp_create_context_resp below gtp_create_pdp_resp, which it calls.
In a follow-up commit, we can make gtp_create_pdp_resp static and
remove the additional declaration.

Change-Id: I34efe7592013a8423f4f280758272d81f24b65fa
2024-05-13 15:16:58 +02:00
Oliver Smith
bad5eeba0f gtp/gsn_internal.h: new file
Change-Id: I999462e39411fc4ec7e50bd0212e870006fbc4f1
2024-05-13 15:16:58 +02:00
Oliver Smith
1dd16fa12f libgtp: move includes to osmocom/include/gtp
Move all includes from /usr/include/….h to
/usr/include/osmocom/gtp/….h to be more consistent with other Osmocom
projects, and to not "pollute" the top include directory if we add more
header files.

Also the new directory structure makes more obvious, which headers are
public and which ones aren't.

Adjust libgtp.pc.in so both #include <gtp.h> (legacy)
and #include <osmocom/gtp/gtp.h> can be used.

Related: OS#6373
Change-Id: If7e01c61168819bf7120667344e40c857da5490b
2024-05-13 15:16:58 +02:00
Oliver Smith
3372625ad9 contrib: remove rpm spec file
Related: https://osmocom.org/news/255
Related: OS#6446
Change-Id: I7cfe55fa2fda43da4eaa1e1b8d40b31d1c8aaf30
2024-05-08 14:40:58 +02:00
Harald Welte
1f9cc2674f README.md: Major overhaul
A lot of the existing contents was still from the old openggsn days, and
predated osmo-ggsn.

Change-Id: I6ec92260da0f55e9493a15db2e8178e5436143a0
2024-03-23 16:32:45 +01:00
Harald Welte
4abe361f33 README.md: Add Forum + Issue Tracker sections
Change-Id: I7b03a78178de77ebf733587ed178fd48c019663c
2024-03-23 16:15:42 +01:00
Harald Welte
bb0655d5aa README.md: Improve markdown formatting
Change-Id: I4e5d99384978d22e6ba0310e97e93d87b610a174
2024-03-23 16:11:50 +01:00
Harald Welte
4e6fe42731 Add funding link to github mirror
see https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/displaying-a-sponsor-button-in-your-repository

Change-Id: I75ba8c4f8635d5a2d36d5bb97566d737e27bcec9
2024-03-23 16:06:28 +01:00
Oliver Smith
19a506b705 Add clear error for kernel not supporting IPv6
Make it clear to the user, that if adding a tunnel fails with kernel GTP
and IPv6: the reason is that the kernel doesn't support IPv6 yet.

Related: OS#6096
Change-Id: I1d3c8cbb51212c91136292347dad9529a5c58a31
2024-03-04 11:15:07 +01:00
Oliver Smith
ea6c02ac1f doc: fix typo ndoe -> node
Change-Id: Ib78b5de45b93a7534163de2cd91211e9be75445d
2024-03-01 08:08:43 +00:00
Oliver Smith
ec357c5377 lib/gtp-kernel.c: check rc of in46a_from_eua
Fixes: b17fe7bf ("kernel-gtp: support IPv6 on inner layer")
Change-Id: I40e4de1517de8871224a45c173208810b42312ff
2024-02-27 16:04:42 +01:00
Oliver Smith
768d6d5be9 lib/gtp-kernel.c: initialize ret with 0
Fix -Werror=maybe-uninitialize found in Pau's build env:

/home/pespin/dev/sysmocom/git/osmo-ggsn/lib/gtp-kernel.c: In function ‘gtp_kernel_tunnel_add’:
/home/pespin/dev/sysmocom/git/osmo-ggsn/lib/gtp-kernel.c:111:13: error: ‘ret’ may be used uninitialized [-Werror=maybe-uninitialize]
  111 |         int ret;
      |             ^~~
/home/pespin/dev/sysmocom/git/osmo-ggsn/lib/gtp-kernel.c: In function ‘gtp_kernel_tunnel_del’:
/home/pespin/dev/sysmocom/git/osmo-ggsn/lib/gtp-kernel.c:167:13: error: ‘ret’ may be used uninitialized [-Werror=maybe-uninitialize]
  167 |         int ret;
      |             ^~~

Fixes: b17fe7bf ("kernel-gtp: support IPv6 on inner layer")
Change-Id: I19067ebe561d4c067b9ace7f5b201e15af6b342e
2024-02-27 15:00:59 +01:00
Oliver Smith
fa91a10498 Cosmetic: {lib,gtp}/Makefile.am: diff friendly
Change-Id: Ib1956794edc6e82cfa6c5419b2609565674d98a4
2024-02-23 13:25:32 +01:00
Oliver Smith
6929391ecf Cosmetic: AM_CFLAGS: make diff friendly
Change-Id: I3303cd8ba8c8b21ff267608833d9fb4833ffc471
2024-02-23 12:08:48 +01:00
Oliver Smith
9baac03927 Cosmetic: Makefile.am: make SUBDIRS diff friendly
Change-Id: I49e1b08e48dc324f313228e8c69679c37aa774f4
2024-02-23 12:08:48 +01:00
Oliver Smith
9bd2711f39 Revert "kernel-gtp: support IPv6 on outer layer"
This reverts commit 0917ce4e22,
as it breaks building osmo-sgsn. This needs to be reworked to be
backwards compatible.

Related: OS#6373
Change-Id: I2c2b2ff0875217e041d94c8e2cef030d2a86c2d8
2024-02-22 16:06:33 +01:00
Oliver Smith
b17fe7bfe9 kernel-gtp: support IPv6 on inner layer
Related: OS#6096
Change-Id: I3df47b6c209f1e2f8254ba139581d6e622c6b35f
2024-02-21 16:22:24 +01:00
Oliver Smith
0917ce4e22 kernel-gtp: support IPv6 on outer layer
Related: OS#1953, OS#6096
Change-Id: I257fff1dcd9d030a7f9ea936b2693a3f13208230
2024-02-21 16:22:21 +01:00
Oliver Smith
2a0d37cb1d gtp_new: deduplicate create_and_bind_socket code
Change-Id: Iff3cfdfb0c08033d869c51499754b3416c71732b
2024-02-21 13:06:04 +01:00
Oliver Smith
f3d541e353 Fix a typo
Change-Id: I508274a1a466651025c488ad897aeed739e4b799
2024-02-21 13:05:56 +01:00
Pau Espin Pedrol
8d976444b8 pco: Improve IPCP spec reference documentation
Change-Id: I1dd4a41bae491c61197e8e307efcfc8c63945a71
2024-01-26 16:12:08 +01:00
Daniel Willmann
77734ac81b libgtp: Remove defines for reserved causes in gtp.h
As discussed in Gerrit change I9c3bf64537ef2223e29f8082861fa32fde26bf68
remove defines that don't serve any purpose. These are defines for
reserved values and changing them later if a newer spec defined them
would break API.

Keep the comments to explain the missing values.

Change-Id: I8db0aa0ade59785443a407b51dea326144406dcf
2023-11-29 16:40:49 +01:00
Oliver Smith
848ec697e2 Bump version: 1.10.2.1-a625 → 1.11.0
Change-Id: I1f116e1cded135f231f22ebc9b817aebf3736fc2
1.11.0
2023-11-28 13:07:17 +00:00
Daniel Willmann
6a2e82542d libgtp: Use gtp_cause_successful() instead of GTPCAUSE_ACC_REQ
In some cases the phone requests a PDP context type that isn't available
no the PGW/GGSN, e.g. phone requests a combined IPv4/v6 context, but
only IPv4 is supported.

In that case the GGSN can send a Create PDP Context Response with cause
"New PDP type due to network preference" or "New PDP type due to single
address bearer only". libgtp should continue handling these cause values
like the "Request Accepted" cause. Use the new gtp_cause_successful()
function for that.

Related: OS#6268
Change-Id: I7dd1e0aa185530e1e2d0402742df833c61a787a7
2023-11-24 09:48:22 +01:00
Daniel Willmann
a625bdd136 gtp: Add net GTP cause values and a function to check for success
According to the spec the upf/pgw can accept a modified pdp context from
the request e.g. if an ipv4/6 context was requested, but only ipv4 is
availiable. Introduce a function that checks all cause values that are
considered successful.

See also: 3GPP TS 29.060 Ch 7.3.2

Related: OS#6268
Change-Id: I9c3bf64537ef2223e29f8082861fa32fde26bf68
2023-11-22 12:36:49 +01:00
Pau Espin Pedrol
08bb5182a4 Bump version: 1.10.1.8-4963-dirty → 1.10.2
Change-Id: I148375902975aba0a374e4507c97f1ff67d687bc
1.10.2
2023-09-12 14:36:11 +02:00
Oliver Smith
4963d1c2ea lib/in46_addr: add in46a_from_gsna
Prepare to use it in gtp-kernel.c in a future patch.

Related: OS#6096
Change-Id: I3e76eb7ee89ba338f085c617662d15cffa2a62d5
2023-07-24 15:06:03 +02:00
Oliver Smith
37daa5d003 doc: running: update kernel-gtp limitations
Related: OS#6096
Change-Id: Ie4f1452ecefbe0db0e4093caa8177f1c87bd3950
2023-07-21 12:59:41 +02:00
Oliver Smith
c4c4d90b85 README: update documentation section
Change-Id: I3320dc5eb3d183a18c2bd2fe3139f729978ea2a1
2023-07-21 11:19:14 +02:00
Oliver Smith
59f1539ece systemd: depend on networking-online.target
Related: SYS#6400
Change-Id: I29e547242b2ed1cfc4750c7d7e5f8636c2e8f3dc
2023-05-26 14:10:45 +02:00