]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.13.6/net-change-skb-mac_header-when-generic-xdp-calls-adjust_head.patch
fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.13.6 / net-change-skb-mac_header-when-generic-xdp-calls-adjust_head.patch
CommitLineData
014275a0
GKH
1From foo@baz Mon Oct 9 09:32:35 CEST 2017
2From: Edward Cree <ecree@solarflare.com>
3Date: Tue, 19 Sep 2017 18:45:56 +0100
4Subject: net: change skb->mac_header when Generic XDP calls adjust_head
5
6From: Edward Cree <ecree@solarflare.com>
7
8
9[ Upstream commit 92dd5452c1be873a1193561f4f691763103d22ac ]
10
11Since XDP's view of the packet includes the MAC header, moving the start-
12 of-packet with bpf_xdp_adjust_head needs to also update the offset of the
13 MAC header (which is relative to skb->head, not to the skb->data that was
14 changed).
15Without this, tcpdump sees packets starting from the old MAC header rather
16 than the new one, at least in my tests on the loopback device.
17
18Fixes: b5cdae3291f7 ("net: Generic XDP")
19Signed-off-by: Edward Cree <ecree@solarflare.com>
20Signed-off-by: David S. Miller <davem@davemloft.net>
21Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22---
23 net/core/dev.c | 1 +
24 1 file changed, 1 insertion(+)
25
26--- a/net/core/dev.c
27+++ b/net/core/dev.c
28@@ -4408,6 +4408,7 @@ static u32 netif_receive_generic_xdp(str
29 __skb_pull(skb, off);
30 else if (off < 0)
31 __skb_push(skb, -off);
32+ skb->mac_header += off;
33
34 switch (act) {
35 case XDP_TX: