On Fri, 2021-06-25 at 14:43 -0400, Willem de Bruijn wrote:
On Thu, Jun 24, 2021 at 8:30 AM David Woodhouse [off-list ref] wrote:
quoted
From: David Woodhouse <redacted>
In tun_get_user(), skb->protocol is either taken from the tun_pi header
or inferred from the first byte of the packet in IFF_TUN mode, while
eth_type_trans() is called only in the IFF_TAP mode where the payload
is expected to be an Ethernet frame.
The equivalent code path in tun_xdp_one() was unconditionally using
eth_type_trans(), which is the wrong thing to do in IFF_TUN mode and
corrupts packets.
Pull the logic out to a separate tun_skb_set_protocol() function, and
call it from both tun_get_user() and tun_xdp_one().
I think this should be two patches. The support for parsing pi is an
independent fix.
As things stand, this patch *doesn't* change the pskb_may_pull()
behaviour. I think we should make that unconditional, and can indeed do
so in a separate subsequent patch.