OSDN Git Service

selftests/bpf: Add lwt_xmit tests for BPF_REDIRECT
authorYan Zhai <yan@cloudflare.com>
Fri, 18 Aug 2023 02:58:16 +0000 (19:58 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 18 Aug 2023 14:05:26 +0000 (16:05 +0200)
commit43a7c3ef8a15d19ee59214fa1d1c6bab55f9d894
tree73364e4c348044e74f28ab264e864755c73f34ff
parenta171fbec88a2c730b108c7147ac5e7b2f5a02b47
selftests/bpf: Add lwt_xmit tests for BPF_REDIRECT

There is no lwt_xmit test case for BPF_REDIRECT yet. Add test cases for
both normal and abnormal situations. For abnormal test cases, devices
are set down or have its carrier set down. Without proper fixes,
BPF_REDIRECT to either ingress or egress of such device would panic the
kernel.

Signed-off-by: Yan Zhai <yan@cloudflare.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/96bf435243641939d9c9da329fab29cb45f7df22.1692326837.git.yan@cloudflare.com
tools/testing/selftests/bpf/config
tools/testing/selftests/bpf/prog_tests/lwt_helpers.h [new file with mode: 0644]
tools/testing/selftests/bpf/prog_tests/lwt_redirect.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/test_lwt_redirect.c [new file with mode: 0644]