samples/bpf: Fix dummy program unloading for xdp_redirect samples
Subsystems (4)
PATCH 1/1 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 fd number, and thus refuses to unload them. Fix the comparison to avoid this.
--- samples/bpf/xdp_redirect_map_user.c | 2 +- samples/bpf/xdp_redirect_user.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
samples/bpf/xdp_redirect_map_user.c +1 -1
@@ -57,7 +57,7 @@ static void int_exit(int sig)printf ("bpf_get_link_xdp_id failed\n" );exit (1 ); } -if (prog_id == curr_prog_id) +if (dummy_prog_id == curr_prog_id)bpf_set_link_xdp_fd (ifindex_out,-1 , xdp_flags);else if (!curr_prog_id)printf ("couldn't find a prog id on iface OUT\n" );
samples/bpf/xdp_redirect_user.c +1 -1
@@ -57,7 +57,7 @@ static void int_exit(int sig)printf ("bpf_get_link_xdp_id failed\n" );exit (1 ); } -if (prog_id == curr_prog_id) +if (dummy_prog_id == curr_prog_id)bpf_set_link_xdp_fd (ifindex_out,-1 , xdp_flags);else if (!curr_prog_id)printf ("couldn't find a prog id on iface OUT\n" );
Signature · 1 line
2.20.1
Quoted 30 lines · On Thu, 21 Feb 2019 17:05:39 +0100 Toke Høiland-Jørgensen <[email protected]>…
The
xdp_redirectandxdp_redirect_mapsample programs both load a dummy program onto the egress interfaces. However, the unload code checks these programs against the wrong fd number, and thus refuses to unload them. Fix the comparison to avoid this.Fixes 3b7a8ec2dec3 ("samples/bpf: Check the prog id before exiting")Signed-off-by Toke Høiland-Jørgensen <[email protected]>--- samples/bpf/xdp_redirect_map_user.c | 2 +- samples/bpf/xdp_redirect_user.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)samples/bpf/xdp_redirect_map_user.c +1
-1@@ -57,7 +57,7 @@ static void int_exit(int sig)printf ("bpf_get_link_xdp_id failed\n" );exit (1 ); } -if (prog_id == curr_prog_id) +if (dummy_prog_id == curr_prog_id)bpf_set_link_xdp_fd (ifindex_out,-1 , xdp_flags);else if (!curr_prog_id)printf ("couldn't find a prog id on iface OUT\n" );samples/bpf/xdp_redirect_user.c +0
-0
samples/bpf/xdp_redirect_user.c static void int_exit(int sig) · line 63
Quoted 8 lines
samples/bpf/xdp_redirect_user.c +1
-1@@ -57,7 +57,7 @@ static void int_exit(int sig)printf ("bpf_get_link_xdp_id failed\n" );exit (1 ); } -if (prog_id == curr_prog_id) +if (dummy_prog_id == curr_prog_id)bpf_set_link_xdp_fd (ifindex_out,-1 , xdp_flags);else if (!curr_prog_id)printf ("couldn't find a prog id on iface OUT\n" );
It seems that I confused this in last version of patchset...my bad.
Martin Lau
Acked-byQuoted 6 lines · Maciej Fijalkowski
Quoted 3 lines · On Thu, 21 Feb 2019 17:05:39 +0100 Toke Høiland-Jørgensen <[email protected]>…
The
xdp_redirectandxdp_redirect_mapsample programs both load a dummy program onto the egress interfaces. However, the unload code checks these programs against the wrong fd number, and thus refuses to unload them. Fix
s/fd/id/
Quoted 1 line
Quoted 1 line
the comparison to avoid this.
The change LGTM.
Daniel Borkmann
maintainerQuoted 8 lines · Martin Lau
Quoted 6 lines · Maciej Fijalkowski
Quoted 3 lines · On Thu, 21 Feb 2019 17:05:39 +0100 Toke Høiland-Jørgensen <[email protected]>…
The
xdp_redirectandxdp_redirect_mapsample programs both load a dummy program onto the egress interfaces. However, the unload code checks these programs against the wrong fd number, and thus refuses to unload them. Fixs/fd/id/
Applied and fixed above typo, thanks!
Quoted 5 lines
Quoted 1 line
Quoted 1 line
the comparison to avoid this.
The change LGTM.
Acked-by Martin KaFai Lau <[email protected]>