mirror of
https://github.com/nmap/nmap.git
synced 2026-08-03 22:29:06 +00:00
Apply a patch by Dmitry Levin that uses a network interface's full name,
including alias extension, in several places to avoid this error message when an alias has an IP address but the primary interface doesn't: Failed to lookup subnet/netmask for device (venet0): venet0: no IPv4 address assigned The patch also considers an interface alias if the primary interface does not appear in the list of interfaces (perhaps because it does not have an IP address assigned) when building the table of routes.
This commit is contained in:
parent
6192fbdd31
commit
eac15cb919
5 changed files with 23 additions and 5 deletions
|
|
@ -1,5 +1,12 @@
|
|||
# Nmap Changelog ($Id$); -*-text-*-
|
||||
|
||||
o Nmap now handles the case when a primary network interface (venet0)
|
||||
does not have an address assigned but its aliases do (venet0:1
|
||||
etc.). This could result in the error messages
|
||||
Failed to find device venet0 which was referenced in /proc/net/route
|
||||
Failed to lookup subnet/netmask for device (venet0): venet0: no IPv4 address assigned
|
||||
This was observed particularly under OpenVZ. [Dmitry Levin]
|
||||
|
||||
o [Ncat] The --ssl-cert, --ssl-key, and --ssl-trustfile options now
|
||||
automatically turn on SSL mode. Previously they were ignored if
|
||||
--ssl was not also used. [David]
|
||||
|
|
|
|||
|
|
@ -406,7 +406,7 @@ static void initialize_idleproxy(struct idle_proxy_info *proxy, char *proxyName,
|
|||
Snprintf(filter, sizeof(filter), "tcp and src host %s and dst host %s and src port %hu", p, q, proxy->probe_port);
|
||||
free(p);
|
||||
free(q);
|
||||
set_pcap_filter(proxy->host.deviceName(), proxy->pd, filter);
|
||||
set_pcap_filter(proxy->host.deviceFullName(), proxy->pd, filter);
|
||||
/* Windows nonsense -- I am not sure why this is needed, but I should
|
||||
get rid of it at sometime */
|
||||
|
||||
|
|
|
|||
|
|
@ -3266,7 +3266,7 @@ static void begin_sniffer(HostOsScan *HOS, vector<Target *> &Targets) {
|
|||
filterlen = len;
|
||||
|
||||
if (o.debugging > 2) log_write(LOG_PLAIN, "Pcap filter: %s\n", pcap_filter);
|
||||
set_pcap_filter(Targets[0]->deviceName(), HOS->pd, pcap_filter);
|
||||
set_pcap_filter(Targets[0]->deviceFullName(), HOS->pd, pcap_filter);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5071,7 +5071,7 @@ static void begin_sniffer(UltraScanInfo *USI, vector<Target *> &Targets) {
|
|||
}
|
||||
}else assert(0);
|
||||
if (o.debugging > 2) log_write(LOG_PLAIN, "Pcap filter: %s\n", pcap_filter.c_str());
|
||||
set_pcap_filter(Targets[0]->deviceName(), USI->pd, pcap_filter.c_str());
|
||||
set_pcap_filter(Targets[0]->deviceFullName(), USI->pd, pcap_filter.c_str());
|
||||
/* pcap_setnonblock(USI->pd, 1, NULL); */
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
15
tcpip.cc
15
tcpip.cc
|
|
@ -2721,8 +2721,8 @@ bool setTargetNextHopMAC(Target *target) {
|
|||
/* OK, the last choice is to send our own damn ARP request (and
|
||||
retransmissions if necessary) to determine the MAC */
|
||||
target->SourceSockAddr(&srcss, NULL);
|
||||
if (doArp(target->deviceName(), target->SrcMACAddress(), &srcss, &targetss,
|
||||
mac)) {
|
||||
if (doArp(target->deviceFullName(), target->SrcMACAddress(),
|
||||
&srcss, &targetss, mac)) {
|
||||
NmapArpCache(ARPCACHE_SET, &targetss, mac);
|
||||
target->setNextHopMACAddress(mac);
|
||||
return true;
|
||||
|
|
@ -3202,6 +3202,17 @@ static struct sys_route *getsysroutes_proc(FILE *routefp, int *howmany) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
/* If device name in the route file does not match the full name (including
|
||||
alias extension) of any interface, then try to find at least an alias of
|
||||
the proper interface. */
|
||||
if (i == numifaces) {
|
||||
for(i=0; i < numifaces; i++) {
|
||||
if (!strcmp(iface, ifaces[i].devname)) {
|
||||
routes[numroutes].device = &ifaces[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i == numifaces) {
|
||||
error("Failed to find device %s which was referenced in /proc/net/route", iface);
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue