summaryrefslogtreecommitdiffstats
path: root/samples
diff options
context:
space:
mode:
authorMaciej Fijalkowski <maciej.fijalkowski@intel.com>2020-02-05 05:58:34 +0100
committerDaniel Borkmann <daniel@iogearbox.net>2020-02-05 22:06:09 +0100
commit8ed47e140867a6e7d56170f325c8d4fdee6d6b66 (patch)
treed664c62878db152984cb9317a94e5d858515542b /samples
parent32c92c15ad3dca6f7cca8643766ad79fa3ab3d17 (diff)
downloadlinux-8ed47e140867a6e7d56170f325c8d4fdee6d6b66.tar.bz2
samples: bpf: Allow for -ENETDOWN in xdpsock
ndo_xsk_wakeup() can return -ENETDOWN and there's no particular reason to bail the whole application out on that case. Let's check in kick_tx() whether errno was set to mentioned value and basically allow application to further process frames. Fixes: 248c7f9c0e21 ("samples/bpf: convert xdpsock to use libbpf for AF_XDP access") Reported-by: Cameron Elliott <cameron@cameronelliott.com> Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Björn Töpel <bjorn.topel@intel.com> Link: https://lore.kernel.org/bpf/20200205045834.56795-4-maciej.fijalkowski@intel.com
Diffstat (limited to 'samples')
-rw-r--r--samples/bpf/xdpsock_user.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_user.c
index bab7a850e864..c91e91362a0c 100644
--- a/samples/bpf/xdpsock_user.c
+++ b/samples/bpf/xdpsock_user.c
@@ -788,7 +788,8 @@ static void kick_tx(struct xsk_socket_info *xsk)
int ret;
ret = sendto(xsk_socket__fd(xsk->xsk), NULL, 0, MSG_DONTWAIT, NULL, 0);
- if (ret >= 0 || errno == ENOBUFS || errno == EAGAIN || errno == EBUSY)
+ if (ret >= 0 || errno == ENOBUFS || errno == EAGAIN ||
+ errno == EBUSY || errno == ENETDOWN)
return;
exit_with_error(errno);
}