diff options
author | rstone <rstone@FreeBSD.org> | 2015-09-17 16:56:49 +0000 |
---|---|---|
committer | rstone <rstone@FreeBSD.org> | 2015-09-17 16:56:49 +0000 |
commit | 24d3763284f56d94ba5d5c3529c4a8b9cb9f5726 (patch) | |
tree | 7d70074e4ce3bc3aec9d53f7ae6a48ea28908636 /sbin | |
parent | f09841e04ba5b833e9fefb1a1b7d1413c1e69ba8 (diff) | |
download | FreeBSD-src-24d3763284f56d94ba5d5c3529c4a8b9cb9f5726.zip FreeBSD-src-24d3763284f56d94ba5d5c3529c4a8b9cb9f5726.tar.gz |
Fix /sbin/route to never look up (invalid) interface names through DNS
/sbin/route has a bug where if it is passed an interface name that does
not exist, it falls through and winds up interpreting it as a hostname.
It fails out eventually, but on a system where DNS lookup is broken you
can end up waiting for up to 60 seconds waiting for the DNS lookup to
timeout. I'm not quite sure what happens if the DNS lookup somehow
succeeds but I doubt that can end well.
Reviewed by: markj, cem
MFC after: 2 weeks
Sponsored by: EMC/Isilon Storage Division
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/route/route.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sbin/route/route.c b/sbin/route/route.c index 1bce41e..a357a4d 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, + "interface '%s' does not exist", str); } break; case RTAX_IFP: |