[PATCH 1/2] batctl: interface: report rtnl query failures
Sven Eckelmann <[email protected]> Sun, 05 Jul 2026 15:04:26 +0200
| Newsgroups | org.open-mesh.lists.batman |
|---|---|
| Message-ID | <[email protected]> |
print_interfaces() ignores the query_rtnl_link() result. When the rtnl
socket setup or the dump request fails, batctl interface prints nothing and
exits with EXIT_SUCCESS. This is indistinguishable from a
meshif without any slave interfaces.
Check the result and fail with an error message instead.
Fixes: 60e519bfeaa3 ("batctl: Use rtnl to query list of softif devices")
Signed-off-by: Sven Eckelmann <[email protected]>
---
interface.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/interface.c b/interface.c
index 7d3897c..c734eda 100644
--- a/interface.c
+++ b/interface.c
@@ -164,11 +164,17 @@ static int print_interfaces(struct state *state)
if (ret < 0)
return EXIT_FAILURE;
- query_rtnl_link(state->mesh_ifindex, print_interfaces_rtnl_parse,
- state);
+ ret = query_rtnl_link(state->mesh_ifindex, print_interfaces_rtnl_parse,
+ state);
netlink_destroy(state);
+ if (ret < 0) {
+ fprintf(stderr, "Error - could not query interfaces: %s\n",
+ strerror(-ret));
+ return EXIT_FAILURE;
+ }
+
return EXIT_SUCCESS;
}
--
2.47.3