1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-15 04:09:01 +00:00
Files
nmap/libnetutil/netutil.cc
david 62c2276755 Properly match up directly connect routes with alias interface addresses
in getsysroutes_proc. This was already being done for non–directly
connected routes, those with a gateway. Victor Rudnev reported this bug.

The /proc/net/route file doesn't contain alias qualifications so we must
match them up after the fact with the interface table. When the gateway
address isn't set, use the route destination for matching instead.

For example, with these interfaces and routing table,

eth0      Link encap:Ethernet  HWaddr 00:50:BF:16:11:61
          inet addr:192.168.1.21  Bcast:192.168.1.255 Mask:255.255.255.0

eth0:1    Link encap:Ethernet  HWaddr 00:50:BF:16:11:61
          inet addr:192.168.0.21  Bcast:192.168.0.255 Mask:255.255.255.0

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

nmap --iflist before this commit:

DEV    (SHORT) IP/MASK         TYPE     UP MAC
eth0   (eth0)  192.168.1.21/24 ethernet up 00:50:BF:16:11:61
eth0:1 (eth0)  192.168.0.21/24 ethernet up 00:50:BF:16:11:61

DST/MASK       DEV    GATEWAY
192.168.1.0/24 eth0
192.168.0.0/24 eth0

nmap --iflist after this commit:

DEV    (SHORT) IP/MASK         TYPE     UP MAC
eth0   (eth0)  192.168.1.21/24 ethernet up 00:50:BF:16:11:61
eth0:1 (eth0)  192.168.0.21/24 ethernet up 00:50:BF:16:11:61

DST/MASK       DEV    GATEWAY
192.168.1.0/24 eth0
192.168.0.0/24 eth0:1
2010-07-04 17:42:49 +00:00

125 KiB