1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-18 20:29:02 +00:00

Ignore RTN_UNREACHABLE routes in route_dst_netlink.

According to rtnetlink(7), such routes are "an unreachable destination."
I get such a route when I ifdown my he-ipv6 interface:

$ /sbin/route -n -A inet6
Kernel IPv6 routing table
Destination                    Next Hop                   Flag Met Ref Use If
::/0                           ::                         !n   -1  1 26122 lo

The problem with not ignoring such routes is that Nmap will think that
the interface to use is lo, and consequently that all the targets are
localhost addresses. Ping scan will succeed with a localhost-response,
but trying to send any packets will fail with "destination unreachable."

Maybe we should do the same thing for these additional values of
rtm_type?

              RTN_BLACKHOLE     a packet dropping route
              RTN_PROHIBIT      a packet rejection route
This commit is contained in:
david
2012-07-24 00:24:11 +00:00
parent df55d1380a
commit f4e06ca3d7
2 changed files with 6 additions and 0 deletions

View File

@@ -1,5 +1,7 @@
# Nmap Changelog ($Id$); -*-text-*-
o Linux unreachable routes are now properly ignored. [David Fifield]
o [NSE] Added smb-vuln-ms10-054 script which check the target system for MS10-054
vulnerability in SMB. [Aleksandar]

View File

@@ -3093,6 +3093,10 @@ static int route_dst_netlink(const struct sockaddr_storage *dst,
netutil_fatal("%s: wrong size reply in recvmsg", __func__);
len -= NLMSG_LENGTH(sizeof(*nlmsg));
/* See rtnetlink(7). Anything matching this route is actually unroutable. */
if (rtmsg->rtm_type == RTN_UNREACHABLE)
return 0;
/* Default values to be possibly overridden. */
rnfo->direct_connect = 1;
rnfo->nexthop.ss_family = AF_UNSPEC;