Handle ARPHRD_VOID in addr_ston.

This type is used by OpenVZ venet interfaces. We "handle" such an
address type just by blanking the MAC address field.

Lack of support for this type of interface was preventing Nmap from
working on certain systems.

http://seclists.org/nmap-dev/2012/q2/763

An earlier message about this same type of interface is

http://seclists.org/nmap-dev/2009/q3/303
This commit is contained in:
david 2012-07-21 07:35:41 +00:00
parent 3c805ed8c1
commit 48ff61a710
4 changed files with 37 additions and 0 deletions

View file

@ -1,5 +1,9 @@
# Nmap Changelog ($Id$); -*-text-*-
o Fixed a bug that prevented Nmap from finding any interfaces when any
interface had the type ARPHRD_VOID; this was the case for OpenVZ
venet interfaces. [Djalal Harouni, David Fifield]
o [Zenmap] Fixed a crash when using the en_NG locale: "ValueError:
unknown locale: en_NG" [David Fifield]

View file

@ -1096,3 +1096,32 @@ Index: libdnet-stripped/src/addr.c
a->addr_type = ADDR_TYPE_ETH;
a->addr_bits = ETH_ADDR_BITS;
memcpy(&a->addr_eth, sa->sa_data, ETH_ADDR_LEN);
o Added addr_ston support for ARPHRD_VOID devices.
diff --git libdnet-stripped/include/dnet/arp.h libdnet-stripped/include/dnet/arp.h
index 2f3d0bf..ec020b4 100644
--- libdnet-stripped/include/dnet/arp.h
+++ libdnet-stripped/include/dnet/arp.h
@@ -40,6 +40,7 @@ struct arp_hdr {
#define ARP_HRD_IEEE802 0x0006 /* IEEE 802 hardware */
#define ARP_HRD_IEEE80211_RADIOTAP 0x0323 /* IEEE 802.11 + radiotap header */
+#define ARP_HRD_VOID 0xFFFF /* Void type, nothing is known */
/*
* Protocol address format
diff --git libdnet-stripped/src/addr.c libdnet-stripped/src/addr.c
index 392d44f..bf3e9e7 100644
--- libdnet-stripped/src/addr.c
+++ libdnet-stripped/src/addr.c
@@ -343,6 +343,9 @@ addr_ston(const struct sockaddr *sa, struct addr *a)
a->addr_bits = IP_ADDR_BITS;
a->addr_ip = so->sin.sin_addr.s_addr;
break;
+ case ARP_HRD_VOID:
+ memset(&a->addr_eth, 0, ETH_ADDR_LEN);
+ break;
default:
errno = EINVAL;
return (-1);

View file

@ -40,6 +40,7 @@ struct arp_hdr {
#define ARP_HRD_IEEE802 0x0006 /* IEEE 802 hardware */
#define ARP_HRD_IEEE80211_RADIOTAP 0x0323 /* IEEE 802.11 + radiotap header */
#define ARP_HRD_VOID 0xFFFF /* Void type, nothing is known */
/*
* Protocol address format

View file

@ -343,6 +343,9 @@ addr_ston(const struct sockaddr *sa, struct addr *a)
a->addr_bits = IP_ADDR_BITS;
a->addr_ip = so->sin.sin_addr.s_addr;
break;
case ARP_HRD_VOID:
memset(&a->addr_eth, 0, ETH_ADDR_LEN);
break;
default:
errno = EINVAL;
return (-1);