Skip to contentSkip to conversation

samples/bpf: xdp_redirect, correctly get dummy program id

PATCH Applied Prashant Bhole 3 participants 3 messages Jun 20, 2019 – Jun 24, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 samples/bpf: xdp_redirect, correctly get dummy program id

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")
---
 samples/bpf/xdp_redirect_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
samples/bpf/xdp_redirect_user.c +1 -1
index e9054c0269ff..1299e0f61dad 100644
@@ -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;
Signature · 1 line
2.20.1
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Prashant Bhole

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")

Huh, I seem to recall fixing this for the other example program, but guess I missed this one.

maintainer Applied
#2 lore raw
In reply to Prashant Bhole
Quoted 9 lines · Prashant Bhole

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")

Applied, thanks!