From ac606d846f0e11e58ff60ddceca88a5e69e17983 Mon Sep 17 00:00:00 2001 From: david Date: Wed, 3 Oct 2012 21:06:43 +0000 Subject: [PATCH] Fallback check for an AF_UNSPEC interface in route_dst_netlink. When an interface doesn't have an address set, getInterfaceByName can fail because it checks the address family. The fatal error message would be something like route_dst_netlink: can't find interface "tap0" If we can't find an interface with a specific address family, fall back with an AF_UNSPEC search. http://seclists.org/nmap-dev/2012/q4/12 --- libnetutil/netutil.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libnetutil/netutil.cc b/libnetutil/netutil.cc index 8277ea5a2..0d4945e70 100644 --- a/libnetutil/netutil.cc +++ b/libnetutil/netutil.cc @@ -3189,6 +3189,8 @@ static int route_dst_netlink(const struct sockaddr_storage *dst, p = if_indextoname(intf_index, namebuf); assert(p != NULL); ii = getInterfaceByName(namebuf, dst->ss_family); + if (ii == NULL) + ii = getInterfaceByName(namebuf, AF_UNSPEC); if (ii == NULL) netutil_fatal("%s: can't find interface \"%s\"", __func__, namebuf); } else if (rtattr->rta_type == RTA_PREFSRC && rnfo->srcaddr.ss_family == AF_UNSPEC) {