Commit Graph

104 Commits

Author SHA1 Message Date
Oliver Smith a2dda133e4 contrib: remove rpm spec file
Related: https://osmocom.org/news/255
Related: OS#6446
Change-Id: Idca6e77cb94529d4a5d85b004989db5b8993a82c
2024-05-08 14:40:52 +02:00
Harald Welte 39e085f03e README.md: Improve markdown formatting; more links
Change-Id: I16511491fdf00a01b9b6deecf8d19a1f2f5e6c3c
2024-03-23 19:30:11 +01:00
Harald Welte 9f46e04a23 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: I2b5d1c422370ce8a2703c6f68403d27451559322
2024-03-23 19:20:00 +01:00
Oliver Smith 1f8b868649 tests/qemu: add 05_ms_ip46_sgsn_ip4.sh
Change-Id: I1e306bc4534f14138249cd4034f54f77d940b261
2024-02-21 13:46:50 +01:00
Oliver Smith c95db93512 tools/gtp-tunnel: pass rc of gtp_del_tunnel
Don't exit with 0 if gtp_del_tunnel fails.

Change-Id: I8046a57a5831e6bdee2ac37415380ce391c79c22
2024-02-21 10:28:31 +01:00
Oliver Smith 170337196b tests/qemu: pass MS_PROTO to gtp-tunnel delete
The MS protocol needs to be passed to gtp-tunnel delete, instead of the
SGSN_GGSN_PROTO.

Fix for:
  + gtp-tunnel add gtp_sgsn v1 200 100 172.99.0.1 fd00::2
  …
  + gtp-tunnel delete gtp_sgsn v1 200 ip6
  genl_socket_talk: No such file or directory

Change-Id: Ib6b011520fe41855b87ed0e2f6f8a6af3d0b2400
2024-02-21 10:28:31 +01:00
Oliver Smith 7928152581 gtp-link: close sockets on error
Avoid resource leaks.

Fixes: CID#347578, CID#347579
Change-Id: I9c437de9712ebe568528b4c9ee1e89a4ba5cd5d1
2024-02-19 12:18:28 +01:00
Pablo Neira Ayuso d489488a70 gtp-link: allow to specify listener address
gtp-link add <device> <family> [--sgsn] [<address>]

Allow to specify listener address, if not specified use ANY_ADDRESS.

Change-Id: I7a9b64393fd68d58c2c158c0e85c0470be007f63
2024-02-16 16:08:19 +01:00
Oliver Smith 72ddb01219 Add QEMU tests
Add tests to ensure libgtpnl + kernel driver work as expected.

Right now a kernel needs to be built from source, using Pablo's tree:
https://git.kernel.org/pub/scm/linux/kernel/git/pablo/gtp.git/

Make sure to enable:
  CONFIG_GTP=y
  CONFIG_NET_NS=y
  CONFIG_VETH=y

$ cp bzImage tests/qemu/_linux
$ ./configure --enable-qemu-tests
$ make
$ make check

Once patches are upstreamed, it will be possible to use a pre-built
kernel from jenkins with: make -C tests qemu-download-kernel

Related: OS#1952
Change-Id: Ibf75514b866fffb11e90529e4705f126b23d7415
2024-02-16 15:15:24 +01:00
Pablo Neira Ayuso 791a620e4d gtp-tunnel: display i_tei in help
display <tid|i_tei> in help message that is printed.

Change-Id: I0aa78e654f23a2b6588ac8e1e5508e798caad1a7
2024-02-15 15:42:02 +01:00
Pablo Neira Ayuso 64b5757043 gtp-genl: display gtp device in listing
Display the device that the tunnel belongs to, users need this
information to delete tunnels.

Change-Id: I888723a8318c04772f7d22a042e69fa6e9ef2239
2024-02-15 15:42:02 +01:00
Pablo Neira Ayuso 43b88cadbf gtp: add flags to gtp_tunnel object
Flags tells us what fields have been set in this object.

This is required by

	./gtp-tunnel del

otherwise, build helper function adds the MS/UE address and kernel reports
ENOENT, and tunnel identifier is ignored.

Update gtp-tunnel tool to set flowid to zero in the GTP version 0 case,
otherwise kernel reports EINVAL since now this flag is not ever set.

Change-Id: I66677ab2d4de2c459ed9987c465fce6f059d6d93
2024-02-15 15:42:02 +01:00
Pablo Neira Ayuso 67e1fef97d gtp: provide interface to set family
Kernel now supports for TID/I_TEI to be used in both IPv4 and IPv6 GTP
tunnels. This improves dualstack support for MS/UE so GTP traffic can
be identified with the same tunnel identifier.

Update gtp-tunnel to specify the family, since a tunnel is now
identified by the following tuple [ version, identifier, family ].

Change-Id: I584d3997ffb89cd430dfda9615a4ce0ce517ab2a
2024-02-15 15:42:02 +01:00
Pablo Neira Ayuso 9911f6bfeb gtp-link: set IPv6 socket only
GTP driver bails out for IPv4-mapped-IPv6 socket with EADDRNOAVAIL,
to prevent issues with setsockopt IPV6_ADDRFORM.

GTP control plane checks that tunnel family matches the socket family
for this GTP device, ie. there is a 1:1 mapping between the socket
listener and the device which determines the supported IP tunnel header.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Change-Id: I887a107657059adeb14ae425576ae7ea9018f762
2024-02-15 15:41:42 +01:00
Pablo Neira Ayuso 38b5e239d6 gtp-link: add IPv6 support
Update tool to allow to specify family that is used for the outer network
header in GTP tunnels.

./gtp-link add gtp0 ip 			# IPv4 GGSN
./gtp-link add gtp0 ip --sgsn		# IPv4 SGSN
./gtp-link add gtp0 ip6 		# IPv6 GGSN
./gtp-link add gtp0 ip6 --sgsn		# IPv6 SGSN

Change-Id: I201c32a1bf9a2ab7a228287590bc7ec19c4997b9
2024-02-15 15:14:08 +01:00
Oliver Smith f3253354e3 tools/gtp-tunnel: pass rc of gtp_add_tunnel
Don't exit with 0 if gtp_add_tunnel fails.

Change-Id: If11b1fb4487a96dcb7f24d95794fea4e36202203
2024-02-14 16:18:52 +01:00
Oliver Smith 4374964187 Makefile.am: remove DIST_SUBDIRS
It is the same as SUBDIRS, so it doesn't need to be defined. We don't do
this is in other Osmocom projects either.

Related: https://www.gnu.org/software/automake/manual/html_node/SUBDIRS-vs-DIST_005fSUBDIRS.html
Change-Id: I35345ba1c6ab6ecc827177dfd6f14a5be6606432
2024-02-14 16:18:52 +01:00
Oliver Smith 9c14b5060c configure.ac: move AC_OUTPUT -> AC_CONFIG_FILES
Instead of having one file in AC_OUTPUT, and all others in
AC_CONFIG_FILES, move all of them to AC_CONFIG_FILES. Sort the files
while at it and have one per line.

Fix this warning:
  configure.ac:86: warning: AC_OUTPUT should be used without arguments.

Change-Id: Iea782b03c9ede154eedbd0c0e9f0d7359bb49967
2024-02-14 16:18:52 +01:00
Oliver Smith a295615229 Add IPv6 support
Implement IPv6 in libgtpnl and the gtp-tunnel testing tool. Allow to
combine:

- GTPA_MS_ADDRESS and GTPA_PEER_ADDR6
- GTPA_MS_ADDR6 and GTPA_PEER_ADDRESS

to specify IPv4-in-IPv6-GTP and IPv6-in-IPv4-GTP in the tunnel
declaration from control plane.

This patch is based on multiple patches from Pablo in OS#6123. I decided
to squash them to directly implement v4-in-v6 and vice versa, instead of
implementing another variant first and then changing it again.

Co-developed-by: Pablo Neira Ayuso <pablo@netfilter.org>
Related: OS#6096
Change-Id: If864c9170f74af52a95cbc4cdb1b866e0309306b
2023-10-24 13:54:09 +02:00
Oliver Smith 717db098c7 Use struct gtp_addr for ms_addr and sgsn_addr
Prepare for IPv6 support by using a new struct for MS and SGSN
addresses, in which either an IPv4 or IPv6 can be stored.

Related: OS#6096
Change-Id: Ifc7e3b03a723fb544d1c7b789101102b2c27b60e
2023-10-19 16:09:15 +02:00
Oliver Smith 2db5d2baf7 include/linux/gtp.h: sync with kernel header
Make the file exactly the same as include/uapi/linux/gtp.h in
linux.git. GTPA_SGSN_ADDRESS is not used, but we decided to rather add
it and not have a diff.

Related: https://gerrit.osmocom.org/c/libgtpnl/+/34735/comment/909c69a6_2fe7781a/
Change-Id: Icf7b78e6655b6573c09c2eaa71d22ef6742b2594
2023-10-19 16:09:15 +02:00
Oliver Smith 2121b82a61 include/linux/gtp.h: fix GTPA_MAX
Apply same fix as done by Pablo in linux.git:
> Subtract one to __GTPA_MAX, otherwise GTPA_MAX is off by 2

Change-Id: I42a358fc795d0e593e2c5509dcfa6ffdbad3cbfa
2023-10-19 16:09:15 +02:00
Oliver Smith 0bd1e0d6eb configure: add --enable-werror
Change-Id: Ife3716c667d2e9b3fcd94d3cdc044d594e7dab5a
2023-10-19 16:09:15 +02:00
Oliver Smith dd335ef8fc configure: regular_C(PP)FLAGS -> C(PP)FLAGS
Make it consistent with other Osmocom projects by removing special
naming for CFLAGS and CPPFLAGS. Otherwise the arguments we typically
add, such as --enable-sanitize which is already there, or
--enable-werror which I'll add in the next patch, do not work without
further changes.

Change-Id: I11e9657fb0c038169bd414a6455044ff4a4709b7
2023-10-19 16:09:15 +02:00
Oliver Smith 6db529f2da README, debian/control: update URLs
Change-Id: I0995f14657e3f58a46e9e357aa3e6baecc132fe0
2023-10-19 16:09:15 +02:00
Oliver Smith b4e23a4fed gitignore: add gtp-link, gtp-tunnel
Change-Id: I9f9c9f64d96e25d99c5631ec40c1439f76678905
2023-10-19 15:54:51 +02:00
Pablo Neira Ayuso 99a5c32546 gtp-genl: allocate room for maximum IPv6 address
Otherwise, inet_ntop() might return ENOSPC because of the buffer
being too small to accomodate an IPv6 address.

Change-Id: I2283e0c3112bec8e6e7e7b5c96657facc09d0a7a
2023-10-19 11:55:50 +00:00
Oliver Smith 0b272f256d gitreview: new file
Change-Id: Iadc35e1a14563516c81d4c845d0d6c5c7fda668a
2023-10-18 14:21:19 +02:00
Pau Espin 6af24bb93c Bump version: 1.2.4.3-b59b → 1.2.5
Change-Id: I7a752f8b3652be3c87808fa8c4f46ea98841969f
2023-09-12 14:18:53 +02:00
Oliver Smith b59bc14f17 debian: set compat level to 10
Related: OS#5958
Change-Id: I393d7e1211e6f9ace420a874a0582208c939bbc2
2023-04-25 16:48:16 +02:00
Neels Hofmeyr b8503c6537 Merge "fix memleak on del_tunnel() failure" 2023-02-09 16:50:42 +00:00
Pau Espin dd3696f173 Bump version: 1.2.3.3-6954 → 1.2.4
Change-Id: I905039b2fb8d1602df16a235c976ffbc48b5da44
2023-02-07 14:07:11 +01:00
Neels Hofmeyr 50ae7eafd2 fix memleak on del_tunnel() failure
Related: CID#307542
Change-Id: Ie29840a7518435447acf48f12e81fc520308a265
2023-02-03 01:05:01 +01:00
Oliver Smith 6954da78fb tools/gtp-link: add --sgsn to usage
Change-Id: I995754812b8418757a8df9ab2a3c208d61f16a8c
2022-09-07 15:48:16 +02:00
Oliver Smith 25d92af06a tools/gtp-tunnel: fix del usage
Change-Id: Iba5afd0cdb1588def3d865900ae02773dfd654e2
2022-09-07 15:43:27 +02:00
Oliver Smith 0535f30a37 README: fix link to homepage
Old link is 404, so adjust it.

Change-Id: I9ae4e9cb53618f4119170eb00e771c9033c52229
2022-09-01 14:29:21 +02:00
Pau Espin 6e7f2f2aa3 Bump version: 1.2.2.1-9fa7-dirty → 1.2.3
Change-Id: I9530d28a2deb4c31be0d1929a37e956c56f55b36
2022-06-28 16:13:45 +02:00
Neels Hofmeyr 9fa76ec4d6 fix some cases of rc == 0 on error
When genl_socket_talk() fails, return rc != 0.

While testing the new osmo-upf program, I noticed that I failed to get a
"Operation not permitted" error when forgetting to set cap_net_admin on
the osmo-upf binary. It looked like everything should work, but doesn't.

It is possible to catch these error cases without this patch, by
monitoring errno. That may well be the intention of the API? I'm still
submitting this patch because it seems better to return rc != 0.

Here is a code example that also catches all error cases without this
patch:

        errno = 0;
        rc = gtp_add_tunnel(genl_id, nl, t);
        if (errno) {
                rc = -errno;
        } else if (rc) {
                rc = -EINVAL;
        } else {
                tun->active = true;
        }
	return rc;

Related: SYS#5599
Change-Id: I22fd69709e023572c6c616a4184340a554456faf
2022-04-28 08:03:58 +02:00
Pau Espin Pedrol 314cc32fce Bump version: 1.2.1.6-465b → 1.2.2
Change-Id: Ica00c6684de20df06f69678cd321abaeca1996fb
2021-02-23 12:52:08 +01:00
Gabriel Ganne 465b76dfca install gtp-tunnel and gtp-link tools
This eases quick setup for demonstration purposes.

Change-Id: I674c463989bc1529bfe132b7ec0df7a0052169df
2021-02-12 09:36:52 +01:00
Pau Espin 118dd3ab17 .gitignore: Ignore new autofoo tmp files
Change-Id: Iaf853783679815e74b6b8e5f3e8631c53ed20613
2021-02-04 12:44:56 +01:00
Oliver Smith 5314ea43ac configure.ac: set -std=gnu11
Change-Id: Iea60698b4cb0f9c04a6f75cc4ca2ea5fbb84bae8
2021-01-27 17:31:54 +01:00
Pau Espin 102c81cf1b Enable parallel make in make distcheck
Related: OS#4421
Change-Id: I4fd59946c771906b5ec36e605fa8e6cbc648beec
2020-10-12 17:44:21 +02:00
Oliver Smith 01b2d940a0 contrib: integrate RPM spec
Remove OpenSUSE bug report link, set version to @VERSION@, make it build with
CentOS 8 etc.

Related: OS#4550
Change-Id: I5376fde96c7442eb70f49a2ce38f57a817a94f81
2020-05-19 15:19:35 +02:00
Oliver Smith 2f276eb3c6 contrib: import RPM spec
Copy the RPM spec file from:
https://build.opensuse.org/project/show/home:mnhauke:osmocom:nightly

Related: OS#4550
Change-Id: I3c9c989972cd223a46d28955edbfe4c69b7a7afb
2020-05-14 11:18:39 +02:00
Pau Espin fd3e98d334 Bump version: 1.2.0.2-d160-dirty → 1.2.1
Change-Id: Icc0dca37a88ce213f9b80598ab89570bd81cf0e7
2019-08-07 12:29:05 +02:00
Pau Espin 8639be5549 debian: Adapt package name to lib's current major version
Current LIBVERSION is 1:1:1 (current:revision:age), so major=current-age
makes it be major=0: libgtpnl0.

It can bee seen in current osmocom debian repos that libgtpnl1 package
contains libgtpnl.so.0.

Let's set package name accordingly.

Change-Id: I7d2fa50b6a17a598467f555558660ef2396c1744
2019-08-07 12:26:19 +02:00
Oliver Smith d160a73a41 contrib/jenkins.sh: run "make maintainer-clean"
Related: OS#3047
Change-Id: I20997b986b24ced9bb8d6d66a66d5ec2bafd00f2
2019-07-10 11:57:27 +02:00
Pau Espin bc71674c67 debian/rules: Don't overwrite .tarball-version
The .tarball-version file should contain the *source version* uniquely
identifying the git commit, and not the Debian package name.

With https://gerrit.osmocom.org/#/c/osmo-ci/+/10343/ there is a correct
.tarball-version file in the .tar.xz of the nightly source packages.

Related: OS#3449
Change-Id: I22dac8524ce8acb033dc9c72eab107999f49f975
2018-09-17 10:40:04 +02:00
Pau Espin f76e213543 Bump version: 1.1.0.5-b1ad-dirty → 1.2.0
Change-Id: I4b72bfb1c9c2413e84e9d8a1c5ebc19d476aada1
2018-05-02 16:37:14 +02:00