summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2015-11-17gtp: add some debug instrumentationHEADmasterAndreas Schultz1-0/+6
Signed-off-by: Andreas Schultz <aschultz@tpip.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2015-11-16gtp: fix the order of error cases in gtp_encap_enableAndreas Schultz1-2/+2
The ordering of the error case exit was wrong and would attempt to release the wrong socket. Signed-off-by: Andreas Schultz <aschultz@tpip.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2015-11-16gtp: convert the global gtp_instance_list to a per netns listAndreas Schultz1-8/+58
This add basic network namespace support by changing to global gtp_instance_list into a pre namespace list. Before this change all pdp context would be visible from all network namespaces, now only the namespace that they belong too, can see them. Also selectively destroy all gtp devices when a namespace is destroyed. Signed-off-by: Andreas Schultz <aschultz@tpip.net> Signed-off-by: Pablo Neira Ayuso <pablo@soleta.eu>
2015-11-16gtp: remove genl_register_family_with_ops for Linux < 3.13Andreas Schultz1-15/+10
Remove the support for genl_register_family_with_ops for Linux < 3.13. Also reorder the initialization to be more in line with similar modules. Signed-off-by: Andreas Schultz <aschultz@tpip.net> Signed-off-by: Pablo Neira Ayuso <pablo@soleta.eu>
2015-11-16gtp: remove unused local variableAndreas Schultz1-2/+1
Signed-off-by: Andreas Schultz <aschultz@tpip.net> Signed-off-by: Pablo Neira Ayuso <pablo@soleta.eu>
2015-11-07gtp: update for Linux > 4.2+, set NO_QUEUE flag on gtp deviceAndreas Schultz1-0/+2
Signed-off-by: Andreas Schultz <aschultz@tpip.net> Signed-off-by: Pablo Neira Ayuso <pablo@soleta.eu>
2015-11-07gtp: update for Linux > 4.1+, genlmsg_end return should be ignoredAndreas Schultz1-1/+2
Signed-off-by: Andreas Schultz <aschultz@tpip.net> Signed-off-by: Pablo Neira Ayuso <pablo@soleta.eu>
2015-11-07gtp: update for Linux > 4.1+, __ip_select_ident arguments have changedAndreas Schultz1-1/+1
Signed-off-by: Andreas Schultz <aschultz@tpip.net> Signed-off-by: Pablo Neira Ayuso <pablo@soleta.eu>
2015-11-07gtp: remove per cpu stats compat ifdef for Linux < 3.13Andreas Schultz1-4/+0
Signed-off-by: Andreas Schultz <aschultz@tpip.net> Signed-off-by: Pablo Neira Ayuso <pablo@soleta.eu>
2015-11-07gtp: remove genl_ops compat ifdef for Linux < 3.13Andreas Schultz1-4/+0
Signed-off-by: Andreas Schultz <aschultz@tpip.net> Signed-off-by: Pablo Neira Ayuso <pablo@soleta.eu>
2015-11-07build: update Makefile for simpler out of tree buildsAndreas Schultz1-5/+12
Signed-off-by: Andreas Schultz <aschultz@tpip.net> Signed-off-by: Pablo Neira Ayuso <pablo@soleta.eu>
2014-04-03Add copright headers and license files, list Pablo as authorHarald Welte11-0/+1169
The kernel module still only listed me as author, even though Pablo was doing most of the work on it after my initial incomplete version.
2014-03-21build: link this library to libmnlPablo Neira Ayuso1-0/+1
With this change, application don't need to pass to the linker -lmnl which is the right way to make it since they don't directly refer to mnl_* functions.
2014-03-20gtp-rtnl: add gtp_dev_config functionPablo Neira Ayuso3-2/+52
This function allows us to set the gtp0 device configuration the route to encapsulate all traffic that is addressed to the MS from the GGSN
2014-03-20gtp-rtnl: refactor common rtnetlink socket initialization codePablo Neira Ayuso1-21/+33
This allow reusing this code in follow up changes.
2014-03-20libgtpnl: add flow id supportPablo Neira Ayuso6-11/+27
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-20gtp: set flow ID for PDP context created throught GTPv0Pablo Neira Ayuso2-5/+25
This field is very important, downlink and uplink packet shall use the same flow ID.
2014-03-20libgtpnl: tools: gtp-tunnel: display teid in hexadecimalPablo Neira Ayuso1-1/+1
So it is displayed like in wireshark.
2014-03-20gtp: add attribute validation for GTPA_TIDPablo Neira Ayuso1-1/+2
Make sure userspace passes a u64.
2014-03-20gtp: fix hashing of GTPv0 entries in the forwarding basePablo Neira Ayuso1-5/+12
Use the corresponding hash function depending on the version type. Using ipv4_hashfn was working with GTPv1 because the TEI is also 32-bits, bit GTPv0 was broken.
2014-03-20gtp-rtnl: remove debugging message that print netlink messagePablo Neira Ayuso1-3/+0
2014-03-19gtp: use proper netdev_dbg dynamic debugging infrastructurePablo Neira Ayuso1-43/+42
Add some instruction in the proper way that can be enabled on the demand to debug problems. Let's make it quite verbose at this stage to relax this later. Make sure debugfs is mounted: # mount -t debugfs nodev /sys/kernel/debug To enable: echo -n 'file gtp.c +p' > /sys/kernel/debug/dynamic_debug/control To disable: echo -n 'file gtp.c -p' > /sys/kernel/debug/dynamic_debug/control More information here on how to use this: http://lwn.net/Articles/434856/
2014-03-19gtp: implement gtp_genl_tunnel_getPablo Neira Ayuso1-28/+80
This function allows you to check if there is a MS address or TEID that already exists in the gtp forwarding base in a very fast way, without having to dump the entire forwarding base and doing a search from userspace.
2014-03-18gtp: fix incorrect UDP header length fieldPablo Neira Ayuso1-2/+4
With this fix, osmo-sgsn doesn't ignore our tunneled packet anymore. It was complaining about incorrect packet length for received packets. And osmo-ggsn is working in my testbed :-).
2014-03-18gtp: fix wrong handling of option header fields in GTPv1Pablo Neira Ayuso1-13/+8
TS 29.060 expresses thing is a quite complicated way just to say that if any of the optional fields is there, then all optional fields become mandatory :-). "This field shall be present if and only if any one or more of the S, PN and E flags are set.". So, if any flag is set, we *always* have 4 extra bytes.
2014-03-18libgtpnl: tools: fix compilation of gtp-link-addPablo Neira Ayuso1-1/+1
A typo slipped through into that file and it stopped compiling.
2014-03-18gtp: fix wrong stripping of UDP and GTP headersPablo Neira Ayuso1-31/+27
We cannot strip the UDP header until we are sure that this is a data packet, otherwise this passes a malformed packet to userspace. The header stripping is now the very last operation in the processing of GTP packets.
2014-02-24gtp: remove leftover workqueuePablo Neira Ayuso1-6/+0
Not needed anymore after 5747406dbb4a.
2014-02-24allow to specify the interface name for the GTP devicePablo Neira Ayuso3-9/+20
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-23gtp: create socket from userspace and pass them as configurationPablo Neira Ayuso5-85/+64
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-22gtp-rtnl: add gtp_dev_destroyPablo Neira Ayuso3-0/+22
This function allows you to destroy the gtpX device.
2014-02-22gtp-rtnl: refactor code to prepare the addition of gtp_dev_destroyPablo Neira Ayuso1-24/+40
Add gtp_dev_talk() and gtp_put_nlmsg().
2014-02-22gtp-rtnl: fix leak in struct mnl_socket on error in gtp_dev_create()Pablo Neira Ayuso1-5/+7
Release it in the error path.
2014-02-22tools: gtp-tunnel: fix accidentally swapped ms_addr and sgsn_addrPablo Neira Ayuso1-2/+2
The output was swapping the ms and the sgsn addresses.
2014-02-22gtp-genl: fix compilation warningPablo Neira Ayuso1-1/+1
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-22add struct gtp_tunnel and adapt functions to use itPablo Neira Ayuso8-38/+143
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-21gtp: delay initialization if compiled built-inPablo Neira Ayuso1-2/+1
Make sure the IPv4/IPv6 sockets are ready to be used before gtp needs them.
2014-02-21gtp: fix missing initialization of iph->idPablo Neira Ayuso1-0/+2
This is required by a sane stack to reassemble fragments.
2014-02-20add libgtpnlPablo Neira Ayuso22-7/+513
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-20gtp: get rid of tid variablePablo Neira Ayuso1-5/+2
It's only used once.
2014-02-20gtp: ensure sufficient room for the header in gtp0_udp_encap_recvPablo Neira Ayuso1-0/+4
2014-02-20gtp: fix handling of messages in the encap input pathPablo Neira Ayuso1-22/+26
* pass up to the stack if we don't know what to do. * drop packet if not well-formed or not found in our PDP ctx database.
2014-02-20gtp: compile with Linux kernel 3.10.28Pablo Neira Ayuso1-1/+12
Add tweak to get this compiling with 3.10.28. Test shows that works for me.
2014-02-20gtp: don't care if GTP socket is not yet ready in gtp_dev_xmit()Pablo Neira Ayuso1-7/+0
If we receive any packet, it will be just ignored. I don't find any reason to prematurely drop this in the xmit patch.
2014-02-20gtp: kill unused fields in struct pdp_ctxPablo Neira Ayuso1-3/+0
This is using the sgsn_addr to know where to send the GTP packets, I guess that was the intention of those fields.
2014-02-20gtp: remove dead code in gtp_link_setup()Pablo Neira Ayuso1-3/+0
I don't find a good reason why this can't be used with pktgen (IFF_TX_SKB_SHARING) and the tx_queue is already zero if not initialized.
2014-02-20gtp: use GTP_V0 and GTP_V1 whenever possiblePablo Neira Ayuso1-3/+7
Just a cleanup.
2014-02-20gtp: rework handling of GTPv1 extensionsPablo Neira Ayuso1-8/+8
* Conditional check if we can pull the extensions (if any). * Pull the GTPv1 header (8 bytes) and the extensions (if any). Tested with emulated replayed pcap traffic, works for me.
2014-02-19gtp: fix flags field for GTPv1Pablo Neira Ayuso1-1/+7
Now wireshark shows a well-formed GTPv1 message.
2014-02-19gtp: fix wrong version in headerPablo Neira Ayuso1-1/+5
v1 is 001 (as interpreted in binary), not 0001 (which is interpreted as v0.