]> git.baikalelectronics.ru Git - kernel.git/commit
net: xdp: pull ethernet header off packet after computing skb->protocol
authorJason A. Donenfeld <Jason@zx2c4.com>
Sat, 15 Aug 2020 07:29:30 +0000 (09:29 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 16 Aug 2020 22:28:18 +0000 (15:28 -0700)
commitd520c8999eea679fcd6e141a0f9fb13c9ac55eb1
tree5c12348c0fbfde213c6f86d3a5e8733ec0e27a9c
parent70e30d00af592309397e9019c53d4186b8d4a45a
net: xdp: pull ethernet header off packet after computing skb->protocol

When an XDP program changes the ethernet header protocol field,
eth_type_trans is used to recalculate skb->protocol. In order for
eth_type_trans to work correctly, the ethernet header must actually be
part of the skb data segment, so the code first pushes that onto the
head of the skb. However, it subsequently forgets to pull it back off,
making the behavior of the passed-on packet inconsistent between the
protocol modifying case and the static protocol case. This patch fixes
the issue by simply pulling the ethernet header back off of the skb
head.

Fixes: d4a1adf6b248 ("net: fix generic XDP to handle if eth header was mangled")
Cc: Jesper Dangaard Brouer <brouer@redhat.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/dev.c