]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Set mac_len in bpf_skb_change_head
authorJussi Maki <joamaki@gmail.com>
Wed, 19 May 2021 15:47:42 +0000 (15:47 +0000)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 20 May 2021 22:03:51 +0000 (00:03 +0200)
commit0fae96924e5abf42b89bfd2f622ba824e5f1c1ca
tree62e7d5b25ec67270ff834530363db0c89d542114
parentf41585f8aaa89ee5cb9aa00e4bcbd5986e1b4e62
bpf: Set mac_len in bpf_skb_change_head

The skb_change_head() helper did not set "skb->mac_len", which is
problematic when it's used in combination with skb_redirect_peer().
Without it, redirecting a packet from a L3 device such as wireguard to
the veth peer device will cause skb->data to point to the middle of the
IP header on entry to tcp_v4_rcv() since the L2 header is not pulled
correctly due to mac_len=0.

Fixes: 5504a378b4f2 ("bpf: BPF for lightweight tunnel infrastructure")
Signed-off-by: Jussi Maki <joamaki@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20210519154743.2554771-2-joamaki@gmail.com
net/core/filter.c