Skip to content

Commit 915654f

Browse files
tohojoborkmann
authored andcommitted
samples/bpf: Fix dummy program unloading for xdp_redirect samples
The xdp_redirect and xdp_redirect_map sample programs both load a dummy program onto the egress interfaces. However, the unload code checks these programs against the wrong id number, and thus refuses to unload them. Fix the comparison to avoid this. Fixes: 3b7a8ec ("samples/bpf: Check the prog id before exiting") Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com> Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com> Acked-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
1 parent e80d02d commit 915654f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

samples/bpf/xdp_redirect_map_user.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static void int_exit(int sig)
5757
printf("bpf_get_link_xdp_id failed\n");
5858
exit(1);
5959
}
60-
if (prog_id == curr_prog_id)
60+
if (dummy_prog_id == curr_prog_id)
6161
bpf_set_link_xdp_fd(ifindex_out, -1, xdp_flags);
6262
else if (!curr_prog_id)
6363
printf("couldn't find a prog id on iface OUT\n");

samples/bpf/xdp_redirect_user.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static void int_exit(int sig)
5757
printf("bpf_get_link_xdp_id failed\n");
5858
exit(1);
5959
}
60-
if (prog_id == curr_prog_id)
60+
if (dummy_prog_id == curr_prog_id)
6161
bpf_set_link_xdp_fd(ifindex_out, -1, xdp_flags);
6262
else if (!curr_prog_id)
6363
printf("couldn't find a prog id on iface OUT\n");

0 commit comments

Comments
 (0)