All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] batctl: interface bugfixes
@ 2026-07-05 13:04 Sven Eckelmann
  2026-07-05 13:04 ` [PATCH 1/2] batctl: interface: report rtnl query failures Sven Eckelmann
  2026-07-05 13:04 ` [PATCH 2/2] batctl: interface: return fail for non-existing interface Sven Eckelmann
  0 siblings, 2 replies; 3+ messages in thread
From: Sven Eckelmann @ 2026-07-05 13:04 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann

I have now splitted the bugfixes for batctl in topic branches to make it a
little bit easier to review. Similar to the "random bugfixes 2026-06-21"
patchset, they are just various (mostly minor) problems which should be
tackled at some point.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
Sven Eckelmann (2):
      batctl: interface: report rtnl query failures
      batctl: interface: return fail for non-existing interface

 interface.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
---
base-commit: eb9597d4ca6db17c579f5ae9443c51b013e2fe65
change-id: 20260704-bugfixes-interface-6eeb6cf77f4d

Best regards,
--  
Sven Eckelmann <sven@narfation.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] batctl: interface: report rtnl query failures
  2026-07-05 13:04 [PATCH 0/2] batctl: interface bugfixes Sven Eckelmann
@ 2026-07-05 13:04 ` Sven Eckelmann
  2026-07-05 13:04 ` [PATCH 2/2] batctl: interface: return fail for non-existing interface Sven Eckelmann
  1 sibling, 0 replies; 3+ messages in thread
From: Sven Eckelmann @ 2026-07-05 13:04 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] batctl: interface: return fail for non-existing interface
  2026-07-05 13:04 [PATCH 0/2] batctl: interface bugfixes Sven Eckelmann
  2026-07-05 13:04 ` [PATCH 1/2] batctl: interface: report rtnl query failures Sven Eckelmann
@ 2026-07-05 13:04 ` Sven Eckelmann
  1 sibling, 0 replies; 3+ messages in thread
From: Sven Eckelmann @ 2026-07-05 13:04 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann

The add/del loop skips a non-existent interface name with a plain continue
and returns a success when no other error class was detected. Which causes
scripts (depending on the return value) to miss the problem.

Remember that a name could not be resolved and return EXIT_FAILURE at
the end, while still processing the remaining interfaces.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 interface.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/interface.c b/interface.c
index c734eda..03f2e45 100644
--- a/interface.c
+++ b/interface.c
@@ -405,6 +405,7 @@ static int set_master_interface(const char *iface, unsigned int ifmaster)
 static int interface(struct state *state, int argc, char **argv)
 {
 	struct interface_create_params create_params = {};
+	bool iface_error = false;
 	bool manual_mode = false;
 	unsigned int ifmaster;
 	unsigned int ifindex;
@@ -532,6 +533,7 @@ static int interface(struct state *state, int argc, char **argv)
 
 		if (!ifindex) {
 			fprintf(stderr, "Error - interface does not exist: %s\n", rest_argv[i]);
+			iface_error = true;
 			continue;
 		}
 
@@ -562,6 +564,9 @@ static int interface(struct state *state, int argc, char **argv)
 				state->mesh_iface, state->mesh_iface);
 	}
 
+	if (iface_error)
+		return EXIT_FAILURE;
+
 	return EXIT_SUCCESS;
 
 err:

-- 
2.47.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-05 13:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-05 13:04 [PATCH 0/2] batctl: interface bugfixes Sven Eckelmann
2026-07-05 13:04 ` [PATCH 1/2] batctl: interface: report rtnl query failures Sven Eckelmann
2026-07-05 13:04 ` [PATCH 2/2] batctl: interface: return fail for non-existing interface Sven Eckelmann

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.