route command will perform DNS lookup of invalid interface name
Ryan Stone
rysto32 at gmail.com
Mon Sep 14 19:47:54 UTC 2015
At $WORK, we have observed that if you attempt to add a route with the
-iface flag, but you specify an incorrect interface name, the route command
will perform a DNS lookup of the interface name. It appears that if the
DNS lookup succeeds that it will treat the parameter to -iface as if it
were a gateway for the route and not an interface.
This appears to be a simple bug. This patch resolves the issue for me, but
I'm a bit worried that the fallback to a DNS lookup might actually be
desired behaviour in some case. Does anybody have any ideas?
diff --git a/sbin/route/route.c b/sbin/route/route.c
index 1bce41e..a447a45 100644
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -1222,6 +1222,9 @@ getaddr(int idx, char *str, struct hostent **hpp, int
nrflags)
freeifaddrs(ifap);
if (sdl != NULL)
return(1);
+ else
+ errx(EX_DATAERR,
+ "inferface '%s' does not exist", str);
}
break;
case RTAX_IFP:
More information about the freebsd-net
mailing list