1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-23 16:09:02 +00:00

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
This commit is contained in:
david
2012-10-03 21:06:43 +00:00
parent 674fefc943
commit ac606d846f

View File

@@ -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) {