Commit Graph

64 Commits

Author SHA1 Message Date
Pablo Neira Ayuso 1f683290fd gtp-rtnl: refactor common rtnetlink socket initialization code
This allow reusing this code in follow up changes.
2014-03-20 16:21:29 +01:00
Pablo Neira Ayuso b976ffa42c libgtpnl: add flow id support
Add new attribute to the gtp tunnel object, this extension is required
by GTPv0 since the same flowid needs to be used for uplink and downlink
packet.
2014-03-20 13:57:22 +01:00
Pablo Neira Ayuso b0d712b055 libgtpnl: tools: gtp-tunnel: display teid in hexadecimal
So it is displayed like in wireshark.
2014-03-20 12:56:31 +01:00
Pablo Neira Ayuso 2d875f2c72 gtp-rtnl: remove debugging message that print netlink message 2014-03-20 10:33:18 +01:00
Pablo Neira Ayuso 3a7dd0a215 libgtpnl: tools: fix compilation of gtp-link-add
A typo slipped through into that file and it stopped compiling.
2014-03-18 18:30:05 +01:00
Pablo Neira Ayuso 7aa2087885 allow to specify the interface name for the GTP device
We can use this to specify 'gtp0' from openggsn, so we make sure that
it always uses the same tunnel device on creation. If it already exists,
it will return EEXIST. This is used to skip the problem of lacking
NLM_F_ECHO in the rtnetlink link interface that allows us to know the
name of the gtp device that has been dynamically allocated from the
kernel.

And, finally, I don't find any use case for having more than one tunnel
device when integrating this with openggsn.

This patch also adjusts tools/gtp-link-add.c which needs some care, since
it is not yet using any of the library functions. This tools are likely
to be useful for troubleshooting and debugging.
2014-02-24 11:41:51 +01:00
Pablo Neira Ayuso dea76a0069 gtp: create socket from userspace and pass them as configuration
openggsn already sets up the UDP sockets that we need for the control
and user planes of GTP. Since we cannot bind two UDP sockets (one from
userspace and another from the kernel) to the same port, change the
current code to pass the socket descriptors that has been allocated
by openggsn (or whatever daemon which uses the GTP kernel
infrastructure).

Two new attributes are added to set up the tunnel device: IFLA_GTP_FD0
(for GTP0) and IFLA_GTP_FD1 (for GTP1u), which specify the UDP socket
created from userspace. Thus, the GTP kernel code only takes care of
enabling the kernel UDP encapsulation routine.
2014-02-23 23:09:59 +01:00
Pablo Neira Ayuso 41ff538fb4 gtp-rtnl: add gtp_dev_destroy
This function allows you to destroy the gtpX device.
2014-02-22 23:19:58 +01:00
Pablo Neira Ayuso 10df05902b gtp-rtnl: refactor code to prepare the addition of gtp_dev_destroy
Add gtp_dev_talk() and gtp_put_nlmsg().
2014-02-22 23:09:38 +01:00
Pablo Neira Ayuso 3876ef618d gtp-rtnl: fix leak in struct mnl_socket on error in gtp_dev_create()
Release it in the error path.
2014-02-22 22:50:00 +01:00
Pablo Neira Ayuso f8ca765f8b tools: gtp-tunnel: fix accidentally swapped ms_addr and sgsn_addr
The output was swapping the ms and the sgsn addresses.
2014-02-22 22:38:05 +01:00
Pablo Neira Ayuso 0829e0efeb gtp-genl: fix compilation warning
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.
2014-02-22 22:30:23 +01:00
Pablo Neira Ayuso 18532955e2 add struct gtp_tunnel and adapt functions to use it
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).
2014-02-22 22:30:14 +01:00
Pablo Neira Ayuso 14506665d9 add libgtpnl
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.
2014-02-20 19:41:29 +01:00