Skip to content

eBPF-based security platform

xdp: report a netlink timeout as one, not as an interrupted dump

John Fastabendcecf8ed08959
diff --git a/Documentation/upatches/write/attach-kinds.rst b/Documentation/upatches/write/attach-kinds.rst
index e394b003..53e3aaa2 100644
--- a/Documentation/upatches/write/attach-kinds.rst
+++ b/Documentation/upatches/write/attach-kinds.rst
@@ -297,7 +297,8 @@ Pairs entirely outside the initial namespace are excluded. Discovery
tolerates interfaces changing under it: a snapshot the kernel reports
as interrupted is retried, and an interface renamed or removed during
the snapshot, or a veth whose peer is not in it, is left out rather than
-failing the load.
+failing the load. A kernel that does not answer a netlink request within
+5 seconds fails the load with ``ETIMEDOUT``, and is not asked again.
Links use ``XDP_FLAGS_DRV_MODE``. A device without native XDP, which
refuses with ``EOPNOTSUPP`` and reports no XDP features, such as a
diff --git a/util/xdp.c b/util/xdp.c
index 8205ecc1..4ec419a6 100644
--- a/util/xdp.c
+++ b/util/xdp.c
@@ -157,7 +157,8 @@ static int nl_exchange(int protocol, struct nl_request *req,
n = recvmsg(fd, &msg, 0);
if (n < 0) {
- ret = -errno;
+ /* EAGAIN is SO_RCVTIMEO, not a dump to start again. */
+ ret = errno == EAGAIN ? -ETIMEDOUT : -errno;
goto out;
}
if (!n || msg.msg_flags & (MSG_TRUNC | MSG_CTRUNC) ||