[PATCH 09/12] batctl: netlink: detect receive errors in netlink_simple_request
Sven Eckelmann <[email protected]> Wed, 08 Jul 2026 22:00:15 +0200
| Newsgroups | org.open-mesh.lists.batman |
|---|---|
| Message-ID | <[email protected]> |
netlink_simple_request() ignores the return value of nl_recvmsgs(). Once
nl_send_auto_complete() succeeds, the local err stays 0 no matter what
happens while receiving the RTM_GETLINK dump, so a failed or truncated dump
is reported as success.
Set err to -EIO on an receive error to let the caller handle it as actual
error.
Fixes: dd2bbe182780 ("batctl: Add command to create/destroy batman-adv interface")
Signed-off-by: Sven Eckelmann <[email protected]>
---
functions.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/functions.c b/functions.c
index f3ad560..36cae49 100644
--- a/functions.c
+++ b/functions.c
@@ -561,7 +561,9 @@ int netlink_simple_request(struct nl_msg *msg)
// ack_errno_handler sets err on errors
err = 0;
- nl_recvmsgs(sock, cb);
+ ret = nl_recvmsgs(sock, cb);
+ if (ret < 0)
+ err = ret;
err_free_cb:
nl_cb_put(cb);
--
2.47.3