]>
Commit | Line | Data |
---|---|---|
014275a0 GKH |
1 | From foo@baz Mon Oct 9 09:32:35 CEST 2017 |
2 | From: Edward Cree <ecree@solarflare.com> | |
3 | Date: Tue, 19 Sep 2017 18:45:56 +0100 | |
4 | Subject: net: change skb->mac_header when Generic XDP calls adjust_head | |
5 | ||
6 | From: Edward Cree <ecree@solarflare.com> | |
7 | ||
8 | ||
9 | [ Upstream commit 92dd5452c1be873a1193561f4f691763103d22ac ] | |
10 | ||
11 | Since 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). | |
15 | Without 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 | ||
18 | Fixes: b5cdae3291f7 ("net: Generic XDP") | |
19 | Signed-off-by: Edward Cree <ecree@solarflare.com> | |
20 | Signed-off-by: David S. Miller <davem@davemloft.net> | |
21 | Signed-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: |