[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170501132845.GA62204@C02RW35GFVH8.dhcp.broadcom.net>
Date: Mon, 1 May 2017 09:28:45 -0400
From: Andy Gospodarek <andy@...yhouse.net>
To: Jesper Dangaard Brouer <brouer@...hat.com>
Cc: dsa@...ulusnetworks.com, netdev@...r.kernel.org,
Daniel Borkmann <borkmann@...earbox.net>,
Alexei Starovoitov <alexei.starovoitov@...il.com>
Subject: Re: [net-next PATCH 2/2] samples/bpf: fix XDP_FLAGS_SKB_MODE detach
for xdp_tx_iptunnel
On Mon, May 01, 2017 at 11:26:20AM +0200, Jesper Dangaard Brouer wrote:
> The xdp_tx_iptunnel program can be terminated in two ways, after
> N-seconds or via Ctrl-C SIGINT. The SIGINT code path does not
> handle detatching the correct XDP program, in-case the program
> was attached with XDP_FLAGS_SKB_MODE.
>
> Fix this by storing the XDP flags as a global variable, which is
> available for the SIGINT handler function.
>
> Fixes: 3993f2cb983b ("samples/bpf: Add support for SKB_MODE to xdp1 and xdp_tx_iptunnel")
> Signed-off-by: Jesper Dangaard Brouer <brouer@...hat.com>
Reviewed-by: Andy Gospodarek <andy@...yhouse.net>
> ---
> samples/bpf/xdp_tx_iptunnel_user.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/samples/bpf/xdp_tx_iptunnel_user.c b/samples/bpf/xdp_tx_iptunnel_user.c
> index 880dd4aebfa4..92b8bde9337c 100644
> --- a/samples/bpf/xdp_tx_iptunnel_user.c
> +++ b/samples/bpf/xdp_tx_iptunnel_user.c
> @@ -25,11 +25,12 @@
> #define STATS_INTERVAL_S 2U
>
> static int ifindex = -1;
> +static __u32 xdp_flags = 0;
>
> static void int_exit(int sig)
> {
> if (ifindex > -1)
> - set_link_xdp_fd(ifindex, -1, 0);
> + set_link_xdp_fd(ifindex, -1, xdp_flags);
> exit(0);
> }
>
> @@ -142,7 +143,6 @@ int main(int argc, char **argv)
> struct iptnl_info tnl = {};
> struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY};
> struct vip vip = {};
> - __u32 xdp_flags = 0;
> char filename[256];
> int opt;
> int i;
Powered by blists - more mailing lists