diff options
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index fc676b2610e3..0891f499c1bb 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -4374,12 +4374,17 @@ static u32 netif_receive_generic_xdp(struct sk_buff *skb, | |||
4374 | 4374 | ||
4375 | act = bpf_prog_run_xdp(xdp_prog, xdp); | 4375 | act = bpf_prog_run_xdp(xdp_prog, xdp); |
4376 | 4376 | ||
4377 | /* check if bpf_xdp_adjust_head was used */ | ||
4377 | off = xdp->data - orig_data; | 4378 | off = xdp->data - orig_data; |
4378 | if (off > 0) | 4379 | if (off) { |
4379 | __skb_pull(skb, off); | 4380 | if (off > 0) |
4380 | else if (off < 0) | 4381 | __skb_pull(skb, off); |
4381 | __skb_push(skb, -off); | 4382 | else if (off < 0) |
4382 | skb->mac_header += off; | 4383 | __skb_push(skb, -off); |
4384 | |||
4385 | skb->mac_header += off; | ||
4386 | skb_reset_network_header(skb); | ||
4387 | } | ||
4383 | 4388 | ||
4384 | /* check if bpf_xdp_adjust_tail was used. it can only "shrink" | 4389 | /* check if bpf_xdp_adjust_tail was used. it can only "shrink" |
4385 | * pckt. | 4390 | * pckt. |
@@ -9701,6 +9706,8 @@ static void __net_exit default_device_exit(struct net *net) | |||
9701 | 9706 | ||
9702 | /* Push remaining network devices to init_net */ | 9707 | /* Push remaining network devices to init_net */ |
9703 | snprintf(fb_name, IFNAMSIZ, "dev%d", dev->ifindex); | 9708 | snprintf(fb_name, IFNAMSIZ, "dev%d", dev->ifindex); |
9709 | if (__dev_get_by_name(&init_net, fb_name)) | ||
9710 | snprintf(fb_name, IFNAMSIZ, "dev%%d"); | ||
9704 | err = dev_change_net_namespace(dev, &init_net, fb_name); | 9711 | err = dev_change_net_namespace(dev, &init_net, fb_name); |
9705 | if (err) { | 9712 | if (err) { |
9706 | pr_emerg("%s: failed to move %s to init_net: %d\n", | 9713 | pr_emerg("%s: failed to move %s to init_net: %d\n", |