If the gtp tunneling code receives a too small/malformed message,
just let it continue its travel through the stack since it will
will just simply drop it itself.
This fixes a memory leak in these case, since we should release
the skbuff if the handler returns <= 0.
Several changes to get a working input handling:
* Set skb->dev to the tunnel device instead of the real_dev, to follow
the logical flow which is:
input packet -> eth0 -> gtp0
eth0 <- gtp0 <- output packet
* Set skb->ip_summed = CHECKSUM_NONE to avoid a crash in skb_checksum()
when forwarding the packet.
* dev_forward_skb(), among many other things, calls skb_scrub_packet()
which resets the skb->mark. We already reset what we need from the
input path and the mark should still remain the same for decapsulated
packets for netfilter/iptables classification. So use netrx_if()
instead.
After this patch, it already forwards a (yet malformed) packet to
the real device. GTPv1 receival path yet untested but similar
changes that were done to GTPv0 has been done.
Remove all code that configures the special gtpX tunnel device as
an ethernet device, eg.
34: gtp0: <NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
link/generic
This also removes the ethernet header from the packet that is
transmitted through the gtp device. So now wireshark shows a well-formed
GTP packet in the output path.
It includes lots of pr_info messages, still in very early stage, but
it already transmit packets that look like GTP.
Set IFF_NOARP flag in device to disable ARP resolution in gtp0, the
actual device doing is the real one behind it.
This patch also move code to gtp*_push_header headers.
This patch detaches the hashtable and the UDP setup from the
GTP_CMD_TUNNEL_* command. The gtp kernel modules needs to support
UDP socket reconfiguration.
After this patch, the steps to bring up a tunnel are:
1st) bring up the device gtp0 via rtnetlink using the "gtp" link type.
2nd) attach a configuration to the gtp0 device, it includes the
initialization of the hashes and the UDP socket, via genetlink
"gtp" family using the GTP_CMD_CFG_NEW command.
3rd) add/delete tunnels using genetlink "gtp" family and GTP_CMD_TUNNEL_*
commands.
Still unusable, but the netlink interface looks in better shape.
Type `make' to compile kernel and userspace code. After that, you should
see gtp.ko kernel module that you can insmod.
The rudimentary userspace tools are:
* gtp-link-add, that allows you to bring up the gtp0 device (via
rtnetlink).
* gtp-tunnel-add, to create tunnels via genetlink.
This is also using using genl-family-get to obtain the (dynamic) genetlink
family for the gtp operations, but that code is scheduled to be merged to
gtp-tunnel-add.
The tunneling code does not work yet, it triggers a crash, so it's been
temporarily disabled.
Original work from Harald Welte, I added the netlink interfaces and got
this compiling.