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
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
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
Otherwise, inet_ntop() might return ENOSPC because of the buffer
being too small to accomodate an IPv6 address.
Change-Id: I2283e0c3112bec8e6e7e7b5c96657facc09d0a7a
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
When deleting a PDP context via "gtp-tunnel delete", we specify only
the gtp netdevice, the gtp version and the TID/TEI. However, the
gtp_build_payload() function unconditionally created the netlink
attributes for GTPA_PEER_ADDRESS and GTPA_MS_ADDRESS, having their
addresses set to zero. The kernel then tried to find a PDP context with
MS and PEER address of 0.0.0.0, and always failed with ENOENT.
The same problem also occurred with OsmoGGSN and OpenGGSN: PDP contexts
could be added but never removed.
The corresponding kernel change that requires this userland change
is the following commit introduced in 4.12-rc1:
commit d9e2dd122637034a0697bf268eed9233701b9dca
Author: Andreas Schultz <aschultz@tpip.net>
Date: Thu Mar 9 17:43:00 2017 +0100
gtp: unify genl_find_pdp and prepare for per socket lookup
Older kernels will work with libgtpnl both before and after this commit,
as they internally will simply disregard any attributes beyond TID/TEI.
Change-Id: Ie2ceb2cd6d2fb009bba01a05b5480c1ad775d619
This aligns with a kernel patch that renames the netlink parameter
to emphasize that it refers to the remote peer which may be either
a GGSN or an SGSN.
The upstream kernel include file retains the legacy name as a define
but we don't need that in our internal library since we are no longer
using it anywhere.
I can't look tei by gtp-tunnel in GTPv1.
I write patch for libgtpnl.
head version
$./tools/gtp-tunnel add hoge v1 65535 65535 10.0.3.2 192.168.0.2
$./tools/gtp-tunnel list
version 1 tei 0/0 ms_addr 10.0.3.2 sgsn_addr 192.168.0.2
fixed version
$./tools/gtp-tunnel add hoge v1 65535 65535 10.0.3.2 192.168.0.2
$./tools/gtp-tunnel list
version 1 tei 65535/65535 ms_addr 10.0.3.2 sgsn_addr 192.168.0.2
This facilitates the use from other projects such as ASL licensed
software. We think there is no point in others having to re-implement
the GTP specific message parsing/encoding on top of libmnl, which is
LGPL anyway.
Please note that the tools are still licensed under GPL, just the
library has been changed.
GTPv1 tunnel use separate 32bit Tunnel Endpoint Identifier's for each
direction while GTPv0 uses only one 64bit Tunnel IDentifier.
Signed-off-by: Andreas Schultz <aschultz@tpip.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Fix these compilation warning:
gtp-genl.c:131:8: warning: 'pdp.version' may be used uninitialized in this function [-Wmaybe-uninitialized]
gtp-genl.c:132:8: warning: 'pdp.tid' may be used uninitialized in this function [-Wmaybe-uninitialized]
d CCLD libgtpnl.la
By initializing the pdp object.
This patch adds a gtp_tunnel structure to avoid having to deal with
functions with lots of parameters. This should also help to extend
the interfaces and the gtp_tunnel object without breaking the binary
interface (which will be good by when ipv6 support will be added).
This patch adds the libgtpnl library. Harald mentioned that he wanted
that the specific code that is added is well encapsulated, so let's
start a small library to interact with the GTP kernel module via netlink
interface.
This was done a bit while in the rush, so the interfaces are not nice
at all and the tools need to be ported on top of this library.
This library will be used to integrate openggsn with the GTP kernel
module.