netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf] samples/bpf: xdp_redirect, correctly get dummy program id
@ 2019-06-20  6:58 Prashant Bhole
  2019-06-20 11:57 ` Toke Høiland-Jørgensen
  2019-06-24 14:20 ` Daniel Borkmann
  0 siblings, 2 replies; 3+ messages in thread
From: Prashant Bhole @ 2019-06-20  6:58 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann; +Cc: Prashant Bhole, netdev, bpf

When we terminate xdp_redirect, it ends up with following message:
"Program on iface OUT changed, not removing"
This results in dummy prog still attached to OUT interface.
It is because signal handler checks if the programs are the same that
we had attached. But while fetching dummy_prog_id, current code uses
prog_fd instead of dummy_prog_fd. This patch passes the correct fd.

Fixes: 3b7a8ec2dec3 ("samples/bpf: Check the prog id before exiting")
Signed-off-by: Prashant Bhole <prashantbhole.linux@gmail.com>
---
 samples/bpf/xdp_redirect_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/samples/bpf/xdp_redirect_user.c b/samples/bpf/xdp_redirect_user.c
index e9054c0269ff..1299e0f61dad 100644
--- a/samples/bpf/xdp_redirect_user.c
+++ b/samples/bpf/xdp_redirect_user.c
@@ -197,7 +197,7 @@ int main(int argc, char **argv)
 	}
 
 	memset(&info, 0, sizeof(info));
-	ret = bpf_obj_get_info_by_fd(prog_fd, &info, &info_len);
+	ret = bpf_obj_get_info_by_fd(dummy_prog_fd, &info, &info_len);
 	if (ret) {
 		printf("can't get prog info - %s\n", strerror(errno));
 		return ret;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-24 14:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-20  6:58 [PATCH bpf] samples/bpf: xdp_redirect, correctly get dummy program id Prashant Bhole
2019-06-20 11:57 ` Toke Høiland-Jørgensen
2019-06-24 14:20 ` Daniel Borkmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).