All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] alfred: vis: Fix ifindex check when registering interface
@ 2019-08-02  6:35 Sven Eckelmann
  0 siblings, 0 replies; only message in thread
From: Sven Eckelmann @ 2019-08-02  6:35 UTC (permalink / raw)
  To: b.a.t.m.a.n

The return value of if_nametoindex should be checked before the rtnl query
is send to the kernel. Otherwise we might try to operate on an ifindex
which doesn't exist in the kernel - which will never register any interface.

Fixes: a34f044de561 ("alfred: vis: Use rtnl to query list of hardifs of meshif")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 vis/vis.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vis/vis.c b/vis/vis.c
index 8df3056..cdc5524 100644
--- a/vis/vis.c
+++ b/vis/vis.c
@@ -617,7 +617,7 @@ static int register_interfaces(struct globals *globals)
 	};
 
 	register_arg.ifindex = if_nametoindex(globals->interface);
-	if (!globals->interface)
+	if (!register_arg.ifindex)
 		return EXIT_FAILURE;
 
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-08-02  6:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-02  6:35 [PATCH] alfred: vis: Fix ifindex check when registering 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.