Nmap Development mailing list archives

Re: [PATCH] make nmap work in certain network setups


From: David Fifield <david () bamsoftware com>
Date: Mon, 27 Jul 2009 13:11:56 -0600

On Thu, Jul 23, 2009 at 10:04:25PM +0400, Dmitry V. Levin wrote:
Looks like nmap fails to run from root user in certain network setups, e.g.
inside OVZ container where main network interface (venet0) has no IP
address and IP addresses are assigned to its aliases (venet0:1, etc.).
In such setup, nmap aborts with the following diagnostics:

Failed to find device venet0 which was referenced in /proc/net/route
Failed to find device venet0 which was referenced in /proc/net/route
nexthost: failed to determine route to [real IP address]
QUITTING!

Proposed patch workarounds this problem by considering interface aliases
when main interface mentioned in the route file has no IP address.

Better fix for this and other routing issues would be to use RTM_GETROUTE
netlink API instead of manual route determination, but such change to the
code is going to be more intrusive.

Another problem with nmap in the aforementioned network setup is that it
fails later with the following diagnostics:

Failed to lookup subnet/netmask for device (venet0): venet0: no IPv4 address assigned
QUITTING!

This happens because pcap_lookupnet() is being called with normalized
device name instead of full device name.  It looks like a bug, and
proposed patch fixes this issue, too.

I was able to reproduce the second error message but not the first with
        ifconfig eth0 0.0.0.0
        ifconfig eth0:1 192.168.0.21
        route add default gw 192.168.0.1

The patch fixes the second error message for me and the first part of it
looks corerct as well. I applied it in r14615.

David Fifield

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


Current thread: