Skip to content

Commit

Permalink
selftests/bpf: Add test for l3 use of bpf_redirect_peer
Browse files Browse the repository at this point in the history
Add a test case for using bpf_skb_change_head() in combination with
bpf_redirect_peer() to redirect a packet from a L3 device to veth and back.

The test uses a BPF program that adds L2 headers to the packet coming
from a L3 device and then calls bpf_redirect_peer() to redirect the packet
to a veth device. The test fails as skb->mac_len is not set properly and
thus the ethernet headers are not properly skb_pull'd in cls_bpf_classify(),
causing tcp_v4_rcv() to point the TCP header into middle of the IP header.

Signed-off-by: Jussi Maki <joamaki@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20210525102955.2811090-1-joamaki@gmail.com
  • Loading branch information
Jussi Maki authored and Daniel Borkmann committed May 25, 2021
1 parent a8deba8 commit 6fd5fb6
Show file tree
Hide file tree
Showing 2 changed files with 405 additions and 178 deletions.
Loading

0 comments on commit 6fd5fb6

Please sign in to comment.