Skip to contentSkip to conversation

alfred: vis: Fix ifindex check when registering interface

PATCH New Sven Eckelmann 1 participant 1 message Aug 2, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 alfred: vis: Fix ifindex check when registering interface

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")
---
 vis/vis.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
vis/vis.c +1 -1
index 8df3056..cdc5524 100644
@@ -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;
 
 
Signature · 1 line
2.20.1