From 6387d0111ca4740b69a082a92fc373185af11133 Mon Sep 17 00:00:00 2001 From: Jesper Dangaard Brouer Date: Mon, 1 May 2017 11:26:15 +0200 Subject: samples/bpf: fix SKB_MODE flag to be a 32-bit unsigned int The kernel side of XDP_FLAGS_SKB_MODE is unsigned, and the rtnetlink IFLA_XDP_FLAGS is defined as NLA_U32. Thus, userspace programs under samples/bpf/ should use the correct type. Fixes: 3993f2cb983b ("samples/bpf: Add support for SKB_MODE to xdp1 and xdp_tx_iptunnel") Signed-off-by: Jesper Dangaard Brouer Acked-by: Daniel Borkmann Reviewed-by: Andy Gospodarek Signed-off-by: David S. Miller --- samples/bpf/xdp1_user.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'samples/bpf/xdp1_user.c') diff --git a/samples/bpf/xdp1_user.c b/samples/bpf/xdp1_user.c index deb05e630d84..378850c70eb8 100644 --- a/samples/bpf/xdp1_user.c +++ b/samples/bpf/xdp1_user.c @@ -20,11 +20,11 @@ #include "libbpf.h" static int ifindex; -static int flags; +static __u32 xdp_flags; static void int_exit(int sig) { - set_link_xdp_fd(ifindex, -1, flags); + set_link_xdp_fd(ifindex, -1, xdp_flags); exit(0); } @@ -75,7 +75,7 @@ int main(int argc, char **argv) while ((opt = getopt(argc, argv, optstr)) != -1) { switch (opt) { case 'S': - flags |= XDP_FLAGS_SKB_MODE; + xdp_flags |= XDP_FLAGS_SKB_MODE; break; default: usage(basename(argv[0])); @@ -103,7 +103,7 @@ int main(int argc, char **argv) signal(SIGINT, int_exit); - if (set_link_xdp_fd(ifindex, prog_fd[0], flags) < 0) { + if (set_link_xdp_fd(ifindex, prog_fd[0], xdp_flags) < 0) { printf("link set xdp fd failed\n"); return 1; } -- cgit v1.2.3-59-g8ed1b