Fall back to using the interface address if get_srcaddr fails.

Since r24413, we have tried "connecting" a UDP socket and using
getsockname in order to infer our source address. This replaced previous
behavior of always using the interface address. However, this appears to
fail when scnning certain *.0 addresses on Windows XP. So fall back to
the old behavior.

http://seclists.org/nmap-dev/2012/q2/464
This commit is contained in:
david 2012-06-07 23:59:09 +00:00
parent f1d230b491
commit 18faddcc96

View file

@ -3293,7 +3293,7 @@ static int route_dst_generic(const struct sockaddr_storage *dst,
/* But the source address we want to use is the target address. */
if (!spoofss) {
if (get_srcaddr(dst, &rnfo->srcaddr) == -1)
return 0;
rnfo->srcaddr = ifaces[i].addr;
}
return 1;
@ -3318,7 +3318,7 @@ static int route_dst_generic(const struct sockaddr_storage *dst,
sockaddr_equal(&routes[i].gw, dst));
if (!spoofss) {
if (get_srcaddr(dst, &rnfo->srcaddr) == -1)
return 0;
rnfo->srcaddr = ifaces[i].addr;
}
rnfo->nexthop = routes[i].gw;
@ -3336,7 +3336,7 @@ static int route_dst_generic(const struct sockaddr_storage *dst,
rnfo->direct_connect = 1;
if (!spoofss) {
if (get_srcaddr(dst, &rnfo->srcaddr) == -1)
return 0;
rnfo->srcaddr = ifaces[i].addr;
}
return 1;