Skip to content

Commit 2c6c5c7

Browse files
bastien-curutchetMartin KaFai Lau
authored andcommitted
selftests/bpf: test_xdp_redirect: Rename BPF sections
SEC("redirect_to_111") and SEC("redirect_to_222") can't be loaded by the __load() helper. Rename both sections SEC("xdp") so it can be interpreted by the __load() helper in upcoming patch. Update the test_xdp_redirect.sh to use the program name instead of the section name to load the BPF program. Signed-off-by: Bastien Curutchet (eBPF Foundation) <bastien.curutchet@bootlin.com> Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org> Reviewed-by: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com> Link: https://patch.msgid.link/20250110-xdp_redirect-v2-1-b8f3ae53e894@bootlin.com
1 parent 95ad526 commit 2c6c5c7

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
#include <linux/bpf.h>
1313
#include <bpf/bpf_helpers.h>
1414

15-
SEC("redirect_to_111")
15+
SEC("xdp")
1616
int xdp_redirect_to_111(struct xdp_md *xdp)
1717
{
1818
return bpf_redirect(111, 0);
1919
}
20-
SEC("redirect_to_222")
20+
SEC("xdp")
2121
int xdp_redirect_to_222(struct xdp_md *xdp)
2222
{
2323
return bpf_redirect(222, 0);

tools/testing/selftests/bpf/test_xdp_redirect.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ test_xdp_redirect()
5656

5757
ip -n ${NS1} link set veth11 $xdpmode obj xdp_dummy.bpf.o sec xdp &> /dev/null
5858
ip -n ${NS2} link set veth22 $xdpmode obj xdp_dummy.bpf.o sec xdp &> /dev/null
59-
ip link set dev veth1 $xdpmode obj test_xdp_redirect.bpf.o sec redirect_to_222 &> /dev/null
60-
ip link set dev veth2 $xdpmode obj test_xdp_redirect.bpf.o sec redirect_to_111 &> /dev/null
59+
ip link set dev veth1 $xdpmode obj test_xdp_redirect.bpf.o program xdp_redirect_to_222 &> /dev/null
60+
ip link set dev veth2 $xdpmode obj test_xdp_redirect.bpf.o program xdp_redirect_to_111 &> /dev/null
6161

6262
if ip netns exec ${NS1} ping -c 1 10.1.1.22 &> /dev/null &&
6363
ip netns exec ${NS2} ping -c 1 10.1.1.11 &> /dev/null; then

0 commit comments

Comments
 (0)