Merge branch 'reset-mac'
authorDavid S. Miller <davem@davemloft.net>
Mon, 28 Jun 2021 19:44:18 +0000 (12:44 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jun 2021 19:44:18 +0000 (12:44 -0700)
commit8eb517a2a4ae447b009f1d971004d334d244549e
tree5cd046d55428c9202b1a0cd4eb57d4012b6112ae
parentff8744b5eb116fdf9b80a6ff774393afac7325bd
parentb2d898c8a523f44ee7b3eea608e81a6e2264579f
Merge branch 'reset-mac'

Guillaume Nault says:

====================
net: reset MAC header consistently across L3 virtual devices

Some virtual L3 devices, like vxlan-gpe and gre (in collect_md mode),
reset the MAC header pointer after they parsed the outer headers. This
accurately reflects the fact that the decapsulated packet is pure L3
packet, as that makes the MAC header 0 bytes long (the MAC and network
header pointers are equal).

However, many L3 devices only adjust the network header after
decapsulation and leave the MAC header pointer to its original value.
This can confuse other parts of the networking stack, like TC, which
then considers the outer headers as one big MAC header.

This patch series makes the following L3 tunnels behave like VXLAN-GPE:
bareudp, ipip, sit, gre, ip6gre, ip6tnl, gtp.

The case of gre is a bit special. It already resets the MAC header
pointer in collect_md mode, so only the classical mode needs to be
adjusted. However, gre also has a special case that expects the MAC
header pointer to keep pointing to the outer header even after
decapsulation. Therefore, patch 4 keeps an exception for this case.

Ideally, we'd centralise the call to skb_reset_mac_header() in
ip_tunnel_rcv(), to avoid manual calls in ipip (patch 2),
sit (patch 3) and gre (patch 4). That's unfortunately not feasible
currently, because of the gre special case discussed above that
precludes us from resetting the MAC header unconditionally.

The original motivation is to redirect bareudp packets to Ethernet
devices (as described in patch 1). The rest of this series aims at
bringing consistency across all L3 devices (apart from gre's special
case unfortunately).

Note: the gtp patch results from pure code inspection and has been
compiled tested only.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>