Skip to content

Commit

Permalink
samples: bpf: Allow for -ENETDOWN in xdpsock
Browse files Browse the repository at this point in the history
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: 248c7f9 ("samples/bpf: convert xdpsock to use libbpf for AF_XDP access")
Reported-by: Cameron Elliott <[email protected]>
Signed-off-by: Maciej Fijalkowski <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Acked-by: Björn Töpel <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
  • Loading branch information
mfijalko authored and borkmann committed Feb 5, 2020
1 parent 32c92c1 commit 8ed47e1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion samples/bpf/xdpsock_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 8ed47e1

Please sign in to comment.