summaryrefslogtreecommitdiffstats
path: root/samples
diff options
context:
space:
mode:
authorJesper Dangaard Brouer <brouer@redhat.com>2017-05-01 05:26:20 -0400
committerDavid S. Miller <davem@davemloft.net>2017-05-01 10:42:37 -0400
commitf76254a845a661ccdb9fa246ee72197f90a8d3dd (patch)
treeb101f0cb75d4d3d75880286c36d95951ad94edd6 /samples
parent6387d0111ca4740b69a082a92fc373185af11133 (diff)
samples/bpf: fix XDP_FLAGS_SKB_MODE detach for xdp_tx_iptunnel
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@redhat.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Reviewed-by: Andy Gospodarek <andy@greyhouse.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'samples')
-rw-r--r--samples/bpf/xdp_tx_iptunnel_user.c4
1 files 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 @@
25#define STATS_INTERVAL_S 2U 25#define STATS_INTERVAL_S 2U
26 26
27static int ifindex = -1; 27static int ifindex = -1;
28static __u32 xdp_flags = 0;
28 29
29static void int_exit(int sig) 30static void int_exit(int sig)
30{ 31{
31 if (ifindex > -1) 32 if (ifindex > -1)
32 set_link_xdp_fd(ifindex, -1, 0); 33 set_link_xdp_fd(ifindex, -1, xdp_flags);
33 exit(0); 34 exit(0);
34} 35}
35 36
@@ -142,7 +143,6 @@ int main(int argc, char **argv)
142 struct iptnl_info tnl = {}; 143 struct iptnl_info tnl = {};
143 struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY}; 144 struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY};
144 struct vip vip = {}; 145 struct vip vip = {};
145 __u32 xdp_flags = 0;
146 char filename[256]; 146 char filename[256];
147 int opt; 147 int opt;
148 int i; 148 int i;