When nl_send_auto_complete() failed, query_rtnl_link() jumped to the
cleanup path without setting err. The function then returned 0 and the
caller assumed a successful interface query even though no request was ever
sent to the kernel.

Handle this as EIO error because nl_send_auto_complete uses an internal
error code which cannot be translated easily in errno codes.

Fixes: a34f044de561 ("alfred: vis: Use rtnl to query list of hardifs of meshif")
Signed-off-by: Sven Eckelmann <[email protected]>
---
 vis/vis.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/vis/vis.c b/vis/vis.c
index 97c6093..d529583 100644
--- a/vis/vis.c
+++ b/vis/vis.c
@@ -316,8 +316,10 @@ static int query_rtnl_link(int ifindex, 
nl_recvmsg_msg_cb_t func, void *arg)
        }
 
        ret = nl_send_auto_complete(sock, msg);
-       if (ret < 0)
+       if (ret < 0) {
+               err = -EIO;
                goto err_free_msg;
+       }
 
        nl_recvmsgs(sock, cb);
 

-- 
2.47.3

Reply via email to