]> git.baikalelectronics.ru Git - kernel.git/commitdiff
samples: bpf: Allow for -ENETDOWN in xdpsock
authorMaciej Fijalkowski <maciej.fijalkowski@intel.com>
Wed, 5 Feb 2020 04:58:34 +0000 (05:58 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 5 Feb 2020 21:06:09 +0000 (22:06 +0100)
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: 4cb659ee6cb1 ("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
samples/bpf/xdpsock_user.c

index bab7a850e864d5ccc88856a061c7bf923153143b..c91e91362a0c644dcead128fcd43abb43d1d8f73 100644 (file)
@@ -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);
 }