summaryrefslogtreecommitdiff
path: root/samples/bpf/xdp_tx_iptunnel_user.c
diff options
context:
space:
mode:
authorAndrii Nakryiko <andrii@kernel.org>2022-01-20 09:14:22 +0300
committerAlexei Starovoitov <ast@kernel.org>2022-01-21 08:22:02 +0300
commitd4e34bfcbe880493cabd726453b3f52715756616 (patch)
tree0765e092317f43977888061284ae78afaa9c0f65 /samples/bpf/xdp_tx_iptunnel_user.c
parent544356524dd6ff5b0bb9099861ab8493a4387def (diff)
downloadlinux-d4e34bfcbe880493cabd726453b3f52715756616.tar.xz
samples/bpf: adapt samples/bpf to bpf_xdp_xxx() APIs
Use new bpf_xdp_*() APIs across all XDP-related BPF samples. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/r/20220120061422.2710637-5-andrii@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'samples/bpf/xdp_tx_iptunnel_user.c')
-rw-r--r--samples/bpf/xdp_tx_iptunnel_user.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/samples/bpf/xdp_tx_iptunnel_user.c b/samples/bpf/xdp_tx_iptunnel_user.c
index 1d4f305d02aa..7370c03c96fc 100644
--- a/samples/bpf/xdp_tx_iptunnel_user.c
+++ b/samples/bpf/xdp_tx_iptunnel_user.c
@@ -32,12 +32,12 @@ static void int_exit(int sig)
__u32 curr_prog_id = 0;
if (ifindex > -1) {
- if (bpf_get_link_xdp_id(ifindex, &curr_prog_id, xdp_flags)) {
- printf("bpf_get_link_xdp_id failed\n");
+ if (bpf_xdp_query_id(ifindex, xdp_flags, &curr_prog_id)) {
+ printf("bpf_xdp_query_id failed\n");
exit(1);
}
if (prog_id == curr_prog_id)
- bpf_set_link_xdp_fd(ifindex, -1, xdp_flags);
+ bpf_xdp_detach(ifindex, xdp_flags, NULL);
else if (!curr_prog_id)
printf("couldn't find a prog id on a given iface\n");
else
@@ -288,7 +288,7 @@ int main(int argc, char **argv)
}
}
- if (bpf_set_link_xdp_fd(ifindex, prog_fd, xdp_flags) < 0) {
+ if (bpf_xdp_attach(ifindex, prog_fd, xdp_flags, NULL) < 0) {
printf("link set xdp fd failed\n");
return 1;
}
@@ -302,7 +302,7 @@ int main(int argc, char **argv)
poll_stats(kill_after_s);
- bpf_set_link_xdp_fd(ifindex, -1, xdp_flags);
+ bpf_xdp_detach(ifindex, xdp_flags, NULL);
return 0;
}