Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/bpf: Fix bpf_nf selftest failure

For systems with missing iptables-legacy tool this selftest fails.

Add check to find if iptables-legacy tool is available and skip the
test if the tool is missing.

Fixes: de9c8d848d90 ("selftests/bpf: S/iptables/iptables-legacy/ in the bpf_nf and xdp_synproxy test")
Signed-off-by: Saket Kumar Bhaskar <skb99@linux.ibm.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20250409095633.33653-1-skb99@linux.ibm.com

authored by

Saket Kumar Bhaskar and committed by
Andrii Nakryiko
967e8def a76116f4

+6
+6
tools/testing/selftests/bpf/prog_tests/bpf_nf.c
··· 63 63 .repeat = 1, 64 64 ); 65 65 66 + if (SYS_NOFAIL("iptables-legacy --version")) { 67 + fprintf(stdout, "Missing required iptables-legacy tool\n"); 68 + test__skip(); 69 + return; 70 + } 71 + 66 72 skel = test_bpf_nf__open_and_load(); 67 73 if (!ASSERT_OK_PTR(skel, "test_bpf_nf__open_and_load")) 68 74 return;