All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Sven Eckelmann <sven@narfation.org>
Subject: [PATCH 1/2] batctl: interface: report rtnl query failures
Date: Sun, 05 Jul 2026 15:04:26 +0200	[thread overview]
Message-ID: <20260705-bugfixes-interface-v1-1-64743906b3d4@narfation.org> (raw)
In-Reply-To: <20260705-bugfixes-interface-v1-0-64743906b3d4@narfation.org>

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 <sven@narfation.org>
---
 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


  reply	other threads:[~2026-07-05 13:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-05 13:04 [PATCH 0/2] batctl: interface bugfixes Sven Eckelmann
2026-07-05 13:04 ` Sven Eckelmann [this message]
2026-07-05 13:04 ` [PATCH 2/2] batctl: interface: return fail for non-existing interface Sven Eckelmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260705-bugfixes-interface-v1-1-64743906b3d4@narfation.org \
    --to=sven@narfation.org \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.