From 18faddcc96395b8b09fd19422ac1f4251c1c882c Mon Sep 17 00:00:00 2001 From: david Date: Thu, 7 Jun 2012 23:59:09 +0000 Subject: [PATCH] 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 --- libnetutil/netutil.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libnetutil/netutil.cc b/libnetutil/netutil.cc index 5d0bf90fa..6177f513e 100644 --- a/libnetutil/netutil.cc +++ b/libnetutil/netutil.cc @@ -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;