Skip to content

Commit ac8d16b

Browse files
TropicaoMartin KaFai Lau
authored andcommitted
selftests/bpf: fix bpf_map_redirect call for cpu map test
xdp_redir_prog currently redirects packets based on the entry at index 1 in cpu_map, but the corresponding test only manipulates the entry at index 0. This does not really affect the test in its current form since the program is detached before having the opportunity to execute, but it needs to be fixed before being able improve the corresponding test (ie, not only test attach/detach but also the redirect feature) Fix this XDP program by making it redirect packets based on entry 0 in cpu_map instead of entry 1. Signed-off-by: Alexis Lothoré (eBPF Foundation) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin KaFai Lau <[email protected]>
1 parent 693fe95 commit ac8d16b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_helpers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct {
1515
SEC("xdp")
1616
int xdp_redir_prog(struct xdp_md *ctx)
1717
{
18-
return bpf_redirect_map(&cpu_map, 1, 0);
18+
return bpf_redirect_map(&cpu_map, 0, 0);
1919
}
2020

2121
SEC("xdp")

0 commit comments

Comments
 (0)