1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-15 20:29:03 +00:00
Commit Graph

140 Commits

Author SHA1 Message Date
dmiller
37d517b32e Use XP compatibility SDK, because users are complaining 2015-11-10 16:47:35 +00:00
dmiller
54bd372ccf CHANGELOG and mod patches for mutex change 2015-09-20 19:06:12 +00:00
dmiller
3d9e348832 Use a mutex on Windows to avoid a hang when accessing WinPCAP driver
Reported by multiple users on Windows 8.1 and Windows Server 2012 R2.
Seems to hang when the WinPCAP driver is accessed via OpenServiceA by
multiple processes at once. Users report that this change, which uses a
mutex to avoid concurrent access, fixes the hang.
2015-09-20 19:06:11 +00:00
dmiller
0f602cbd38 Fix address detection on Solaris. Fixes #124 2015-05-23 13:22:29 +00:00
dmiller
ee1156eb51 Fix a NULL pointer dereference in libdnet-stripped
Reported and diagnosed by Gisle Vanem.

Fixes #70
2015-03-05 22:09:49 +00:00
dmiller
a86b679404 Fix WinPcap crash on pcap_findalldevs error
See http://seclists.org/nmap-dev/2015/q1/176

Fixes #15
2015-02-12 16:52:02 +00:00
dmiller
17a5e77e0a Add ARP_HRD_IEEE80211_PRISM identifier 2015-01-27 02:31:11 +00:00
dmiller
0952bed032 Merge final changes to support VS2013 build
Changes:

* Fix a collision of the name PS_NONE with a different constant in shlobj.h
* Update solution and project files for VS2013
* Update the NSIS installer to reference the VC 2013 redistributable
2015-01-17 04:35:01 +00:00
dmiller
c22c1119e9 Note last commit in libdnet/NMAP_MODIFICATIONS 2014-09-09 21:19:09 +00:00
dmiller
73275cc872 dnet: Fix hw address getting on AIX 2014-09-09 21:19:08 +00:00
dmiller
48dfb446d2 Only use RT_ROUNDUP on NetBSD
AIX's version breaks things: http://seclists.org/nmap-dev/2014/q3/405
2014-09-08 20:50:51 +00:00
david
02cb2931aa Fix rt_msghdr padding on NetBSD.
NetBSD uses a fixed 64-bit padding, unlike OS X (32-bit), and unlike
other platforms (sizeof(unsigned long)). There is an RT_ROUNDUP macro
that does the right alignment; use that when available.

http://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/lib/libc/net/getifaddrs.c
http://fxr.watson.org/fxr/source/net/route.h?v=NETBSD#L270

Rounding to 4 bytes was breaking with IPv6 addresses, which are 28
bytes. The pointer was being advanced by 28 instead of 32. Compare to
r29739, somewhat similar.

Reported by Fredrik Pettai.
http://seclists.org/nmap-dev/2013/q1/384
2013-06-01 16:28:44 +00:00
henri
4a261dd5f2 Updated libdnet to not SIOCIFNETMASK before SIOCIFADDR on OpenBSD. This was
reported to break on -current as of May 2013. [Giovanni Bechis]
2013-05-17 21:38:08 +00:00
dmiller
14c40b6281 Handle AppleTalk devices
Fixed a bug that prevented Nmap from finding any interfaces when one
of them had the type ARP_HDR_APPLETALK; this was the case for
AppleTalk interfaces. However, This support is not complete
since AppleTalk interfaces use different size hardware addresses
than Ethernet. Nmap IP level scans should work without any problem,
please refer to the '--send-ip' switch and to the following thread:
http://seclists.org/nmap-dev/2013/q1/214
This bug was reported by Steven Gregory Johnson on IRC.
2013-02-14 23:32:52 +00:00
david
ce51d8c4da Use the default value of MultiThreadedDLL where possible. 2013-02-09 20:30:01 +00:00
david
6b095f42d2 Use MultiThreadedDebugDLL (/MDd) in place of MultiThreadedDebug (/MTd).
This is to match r8507, which did the analogous thing for the Release
configuration.
http://seclists.org/nmap-dev/2013/q1/120
2013-02-09 20:29:55 +00:00
david
f55171a088 Add metric to struct route_entry.
Actually getting a nonzero value for the metric is supported only on
Linux and Windows.
2013-02-01 05:01:56 +00:00
david
5fd515b039 Get rid of ntohs in ip6_ntop.
Byte-swapping is handled by the initial loop that reads into an array of
16-bit integers. That initial loop was added by me in r29708.
2013-01-30 08:47:24 +00:00
david
e7a4a8a364 Set sa.sndd_8022_ethertype to 0 in eth-ndd.c.
This file is used for Ethernet handles on AIX. We had a report from
Peter O'Gorman that setting this member to 0 rather than ETH_TYPE_IP was
necessary to avoid an EEXIST error on bind.

http://seclists.org/nmap-dev/2011/q4/349
http://seclists.org/nmap-dev/2011/q4/353
http://seclists.org/nmap-dev/2011/q4/att-353/aix.patch
https://code.google.com/p/libdnet/issues/detail?id=23

However Ben Lentz more recently tried the patch and said that he still
got an EEXIST on bind.

http://seclists.org/nmap-dev/2012/q4/327
http://seclists.org/nmap-dev/2012/q4/395

So who knows what the right thing to do here is. The messages from IBM
seem to say that setting ETH_TYPE_IP is definitely wrong though.
2012-12-08 11:04:23 +00:00
david
f602ead419 Check some libdnet mallocs for failure.
Patch based on one by Bill Parker.
http://seclists.org/nmap-dev/2012/q4/261
2012-11-22 00:50:18 +00:00
david
11b76a55e2 Route tables rework to libdnet-stripped/NMAP_MODIFICATIONS. 2012-09-30 00:01:20 +00:00
david
049208898b Set intf_name in route-bsd.c, the parts used by OS X.
There are some other #ifdefs that are used on other platforms, in which
code intf_name might nto be set but will continue to be an empty string
as before.
2012-09-30 00:01:17 +00:00
david
0ed5d26bc3 Set intf_name in route-win32.c. 2012-09-30 00:01:16 +00:00
david
98aa8fbe80 Set intf_name in route-linux.c. 2012-09-30 00:01:12 +00:00
david
5bbe36af7a Add intf_name to the route_entry struct.
This is set to an empty string in all functions yielding routes,
particularly route_loop. The code to get the interface pertaining to a
route is different on different platforms, so must be added one by one.
The code setting the intf_name to an empty string is only tested on
Linux.
2012-09-30 00:01:10 +00:00
david
bfea61a51e Put the sscanf count check right after the call to sscanf. 2012-09-27 03:10:28 +00:00
david
06dcb1c138 Check ipv6 route flags and sscanf count as well. 2012-09-27 03:06:22 +00:00
david
95b634d28c We are reading 11, not 10, fields from /proc/net/route. 2012-09-27 02:58:27 +00:00
david
645e0d213f We can only read n - 1 bytes of interface name; sscanf doesn't include
the terminator.

Noticed by Djalal.
2012-09-27 02:58:26 +00:00
djalal
af495cdc49 Fixed a bug that prevented Nmap from finding any interfaces when one
of them had the type ARPHDR_INFINIBAND; this was the case for
IP-over-InfiniBand interfaces. However, This support is not complete
since IPoIB interfaces use 20 bytes for the hardware address, and
currently we only report and handle 6 bytes.
Nmap IP level scans should work without any problem, please refer to
the '--send-ip' switch and to the following thread:
http://seclists.org/nmap-dev/2012/q3/642

This bug was reported by starlight.2012q3.
2012-09-26 09:24:00 +00:00
djalal
e017b7c290 Fixed a bug that prevented Nmap from finding any interfaces when one
of them had the type ARPHDR_IEEE80211; this was the case for wireless
interfaces operating in access point mode. This bug was reported by
Sebastiaan Vileijn.

http://seclists.org/nmap-dev/2012/q3/986
2012-09-26 08:49:22 +00:00
david
0674925f73 Skip over entire ifreq struct in NEXTIFR.
On platforms supporting sa_len, NEXTIFR would skip over sa_len bytes
starting at the beginning of ifr_addr, and assume that was the end of
the struct. (The idea being that a large address such as a sockaddr_in6
could overflow the nominal struct boundary.) This logic was wrong when
there was something else in the union bigger than sa_len; we would
increment into somewhere in the middle of the same struct.

This exhibited itself on NetBSD, where struct ifreq has a
sockaddr_storage member in its internal union:
struct	ifreq {
	char	ifr_name[IFNAMSIZ];		/* if name, e.g. "en0" */
	union {
		struct	sockaddr ifru_addr;
		struct	sockaddr ifru_dstaddr;
		struct	sockaddr ifru_broadaddr;
		struct	sockaddr_storage ifru_space;

No, we skip over sa_len bytes, or to the nominal end of the struct,
whichever is larger.

Unix Network Programming gets this wrong too; in figure 17.8 they do
ptr += sizeof(ifr->ifr_name) + max(sizeof(struct sockaddr), ifr->ifr_addr.sa_len);
2012-09-10 01:17:28 +00:00
david
f7873c0089 Resolve strict-aliasing problems in ip6_ntop.
addr-util.c:191:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
2012-09-01 03:29:39 +00:00
david
7a9e7c502e Add a missing IFF_IPMP #ifdef guard. 2012-08-26 20:44:32 +00:00
david
48ff61a710 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
2012-07-21 07:35:41 +00:00
djalal
8e7edbd008 o Fixed a bug that caused Nmap to fail to find any network interface when
at least one of them is in the monitor mode. The fix was to define the
  ARP_HRD_IEEE80211_RADIOTAP 802.11 radiotap header identifier in the
  libdnet-stripped code. Network interfaces that are in this mode are used
  by radiotap for 802.11 frame injection and reception. The bug was
  reported by Tom Eichstaedt and Henri Doreau.
  http://seclists.org/nmap-dev/2012/q2/449
  http://seclists.org/nmap-dev/2012/q2/478
  [Djalal Harouni, Henri Doreau]
2012-06-02 19:35:08 +00:00
david
ae2f887af1 Ignore IPMP interfaces in SIOCGLIFCONF intf_loop.
This is a (hopefully temporary) workaround for these virtual interfaces
on Solaris. They don't work for Nmap because they don't allow packet
sniffing, but you can use one of the physical interfaces they're
composed of.
2012-05-24 02:56:08 +00:00
david
4c5022b100 Fix the fd6 condition for SIOCGLIFFLAGS. 2012-05-13 01:20:56 +00:00
david
7cfee5944c Don't let Solaris IPMP devices appear as Ethernet. 2012-05-12 23:27:49 +00:00
david
25fdaf95f3 Use a large initial buffer in the call to GetAdaptersAddresses.
GetAdaptersAddresses is supposed to return ERROR_BUFFER_OVERFLOW and set
len to the required size when len is too small. So normally we would
call the function once with a small len, and then again with the longer
len. But, on Windows 2003, apparently you only get ERROR_BUFFER_OVERFLOW
the *first* time you call the function with a too-small len--the next
time you get ERROR_INVALID_PARAMETER. So this function would fail the
second and later times it is called.

So, make the first call using a large len. On Windows 2003, this will
work the first time as long as there are not too many adapters. (It will
still fail with ERROR_INVALID_PARAMETER if there are too many adapters,
but this will happen infrequently because of the large buffer.) Other
systems that always return ERROR_BUFFER_OVERFLOW when appropriate will
enlarge the buffer if the initial len is too short.
2012-05-10 21:29:54 +00:00
david
cc0f2e1e54 Don't use LIFC_UNDER_IPMP if it's not defined. 2012-05-10 20:45:30 +00:00
david
49aafa4a38 Use LIFC_UNDER_IPMP when enumerating Solaris interfaces.
An IPMP interface is a special kind of interface made up of other
interfaces. The other interfaces are hidden by default unless this flag
is passed to ioctl(SIOCGLIFCONF). This allows me to scan over an IPMP
interface in a simple setup.
2012-05-07 21:41:57 +00:00
david
e819beaaae Make changes for IPv6-only interfaces on Solaris.
First try SIOCGLIFFLAGS with an IPv4 socket, then again with an IPv6 socket if that fails. Use that same socket for the other ioctl queries.

Avoid adding an IPv6 alias address that is the same as an IPv6 primary address. This is the same as an existing check in the IPv4 case.

Fix a loop exit boundary condition check.
2012-04-22 02:13:16 +00:00
david
7cd9a0f2d2 Make some #ifdef guards actually use the symbol they're guarding. 2012-04-20 23:57:43 +00:00
david
b5c1e83471 Substitute on-link routes' gateways with an all-zero address.
On OS X, the code in route_loop in route-bsd.c can get a gateway
sockaddr_dl that looks like this:

$1 = {
  sdl_len = 20 '\024',
  sdl_family = 18 '\022',
  sdl_index = 4,
  sdl_type = 6 '\006',
  sdl_nlen = 0 '\0',
  sdl_alen = 0 '\0',
  sdl_slen = 0 '\0',
  sdl_data = '\0' <repeats 11 times>
}

route_loop would throw these out because there's no hardward address
there. This is a routing table entry that indicates that there is no
gateway, and that packets for this particular destination need to go on
interface #4. It corresponds to this type of line from netstat output:

Destination        Gateway            Flags        Refs      Use   Netif Expire
192.168.0          link#4             UCS             2        0     en0

I've changed it so that instead of throwing out the entry, it creates an
all-zero address of the same type as the destination address, which is a
convention used (by Nmap at least) to indicate an on-link route.
2012-03-26 22:24:55 +00:00
david
d7af8ff3d0 Better factoring and comments in route-bsd.c route_loop. 2012-03-26 22:24:54 +00:00
david
2c7e3f31de Try /dev/net/<iface> after /dev/<iface> with DLPI.
This appears to be a new place on Solaris 11. WIthout this, I get a MAC address of 00:00:00:00:00:00 from --iflist for example.
2012-03-17 12:06:27 +00:00
david
dbf79dafaa SIOCGLIFCONF-based implementation of intf_loop for Solaris 10.
The SIOCG*L*IFCONF interface is mostly like SIOCGIFCONF except that it
uses a sockaddr_storage-based structure that allows handling IPv6 interfaces.
2011-09-30 00:42:45 +00:00
david
399942d759 Add an MIB2_IP6 in addition to the MIB2_IP loop.
This gets IPv6 routes.
2011-09-29 22:23:16 +00:00
david
ddb4829b2b Use SIOCGIFNETMASK6 to get IPv6 interface netmasks.
This is used when SIOCGIFNETMASK_IN6 isn't available.
2011-09-28 06:55:48 +00:00