Skip to content

Commit f761312

Browse files
tehnerdborkmann
authored andcommitted
bpf: fix xdp_generic for bpf_adjust_tail usecase
When bpf_adjust_tail was introduced for generic xdp, it changed skb's tail pointer, so it was pointing to the new "end of the packet". However skb's len field wasn't properly modified, so on the wire ethernet frame had original (or even bigger, if adjust_head was used) size. This diff is fixing this. Fixes: 198d83b (" bpf: make generic xdp compatible w/ bpf_xdp_adjust_tail") Signed-off-by: Nikita V. Shirokov <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
1 parent 9b984a2 commit f761312

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/core/dev.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4057,8 +4057,10 @@ static u32 netif_receive_generic_xdp(struct sk_buff *skb,
40574057
* pckt.
40584058
*/
40594059
off = orig_data_end - xdp.data_end;
4060-
if (off != 0)
4060+
if (off != 0) {
40614061
skb_set_tail_pointer(skb, xdp.data_end - xdp.data);
4062+
skb->len -= off;
4063+
}
40624064

40634065
switch (act) {
40644066
case XDP_REDIRECT:

0 commit comments

Comments
 (0)