diff --git a/CHANGELOG b/CHANGELOG index 98f3029b9..80dd37b84 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,9 @@ # Nmap Changelog ($Id$) +o Patched libdnet to include sys/uio.h in src/tun-linux.c. This is + apparently necessary on some Glibc 2.1 systems. Thanks to Rob Foehl + (rwf(a)loonybin.net) for the patch. + Nmap 3.91 o Fixed a crash on Windows when you -P0 scan an unused IP on a local diff --git a/Makefile.in b/Makefile.in index d54fe4452..f4639d099 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -export NMAP_VERSION = 3.91 +export NMAP_VERSION = 3.92 NMAP_NAME= nmap NMAP_URL= http://www.insecure.org/nmap/ NMAP_PLATFORM=@host@ diff --git a/configure b/configure index 1eaeb4c9f..73de186f6 100755 --- a/configure +++ b/configure @@ -2680,7 +2680,7 @@ echo "$as_me: error: Could not locate a C++ compiler. If it exists, add it to yo { (exit 1); exit 1; }; } fi -nmap_gcc_mayor_version=0 +nmap_gcc_major_version=0 echo "$as_me:$LINENO: checking whether the compiler is gcc 4 or greater" >&5 echo $ECHO_N "checking whether the compiler is gcc 4 or greater... $ECHO_C" >&6 if test x"$GXX" = xno; then @@ -2693,22 +2693,22 @@ else else our_gcc="$ac_cv_prog_CC" fi - # new mayor versions must be added here + # new major versions must be added here case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in *4.) - nmap_gcc_mayor_version=4 + nmap_gcc_major_version=4 ;; - *3) - nmap_gcc_mayor_version=3 + *3.) + nmap_gcc_major_version=3 ;; - *2) - nmap_gcc_mayor_version=2 + *2.) + nmap_gcc_major_version=2 ;; - *1) - nmap_gcc_mayor_version=1 + *1.) + nmap_gcc_major_version=1 ;; esac - if test "$nmap_gcc_mayor_version" -ge 4; then + if test "$nmap_gcc_major_version" -ge 4; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else @@ -2718,7 +2718,7 @@ echo "${ECHO_T}no" >&6 fi # Remember that all following tests will run with this CXXFLAGS by default -if test "$nmap_gcc_mayor_version" -ge 4; then +if test "$nmap_gcc_major_version" -ge 4; then CXXFLAGS="$CXXFLAGS -fno-strict-aliasing" fi diff --git a/configure.ac b/configure.ac index a95bb7b59..804c7a822 100644 --- a/configure.ac +++ b/configure.ac @@ -47,7 +47,7 @@ if test $CXXPROG = "MISSING"; then AC_MSG_ERROR([Could not locate a C++ compiler. If it exists, add it to your PATH or give configure the CXX=path_to_compiler argument. Otherwise, install a C++ compiler such as g++ or install a binary package of Nmap (see http://www.insecure.org/nmap/nmap_download.html ))]) fi -nmap_gcc_mayor_version=0 +nmap_gcc_major_version=0 AC_MSG_CHECKING([whether the compiler is gcc 4 or greater]) if test x"$GXX" = xno; then AC_MSG_RESULT([no]) @@ -58,22 +58,22 @@ else else our_gcc="$ac_cv_prog_CC" fi - # new mayor versions must be added here + # new major versions must be added here case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in *4.) - nmap_gcc_mayor_version=4 + nmap_gcc_major_version=4 ;; - *3) - nmap_gcc_mayor_version=3 + *3.) + nmap_gcc_major_version=3 ;; - *2) - nmap_gcc_mayor_version=2 + *2.) + nmap_gcc_major_version=2 ;; - *1) - nmap_gcc_mayor_version=1 + *1.) + nmap_gcc_major_version=1 ;; esac - if test "$nmap_gcc_mayor_version" -ge 4; then + if test "$nmap_gcc_major_version" -ge 4; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) @@ -81,7 +81,7 @@ else fi # Remember that all following tests will run with this CXXFLAGS by default -if test "$nmap_gcc_mayor_version" -ge 4; then +if test "$nmap_gcc_major_version" -ge 4; then CXXFLAGS="$CXXFLAGS -fno-strict-aliasing" fi diff --git a/libdnet-stripped/src/tun-linux.c b/libdnet-stripped/src/tun-linux.c index 21419597b..22ec26a8c 100644 --- a/libdnet-stripped/src/tun-linux.c +++ b/libdnet-stripped/src/tun-linux.c @@ -13,6 +13,7 @@ #include #include +#include #include #include diff --git a/libpcap/NMAP_MODIFICATIONS b/libpcap/NMAP_MODIFICATIONS index 1b806dc16..5eb369434 100644 --- a/libpcap/NMAP_MODIFICATIONS +++ b/libpcap/NMAP_MODIFICATIONS @@ -247,3 +247,48 @@ Ben Harris (bjh21(a)cam.ac.uk) /* o Removed packaging/pcap.spec because it conflicted with the Nmap spec file when building RPMs from the tarball. + +o Changed the configure.ac to enable -fno-strict-aliasing when GCC 4+ +is in use. Here is that patch: +--- configure.ac (revision 2864) ++++ configure.ac (working copy) +@@ -741,6 +741,39 @@ + + AC_LBL_UNALIGNED_ACCESS + ++pcap_gcc_major_version=0 ++AC_MSG_CHECKING([whether the compiler is gcc 4 or greater]) ++if test x"$GCC" = xno; then ++ AC_MSG_RESULT([no]) ++else ++ # new major versions must be added here ++ case `$CC --version | sed -e 's,\..*,.,' -e q` in ++ *4.) ++ pcap_gcc_major_version=4 ++ ;; ++ *3.) ++ pcap_gcc_major_version=3 ++ ;; ++ *2.) ++ pcap_gcc_major_version=2 ++ ;; ++ *1.) ++ pcap_gcc_major_version=1 ++ ;; ++ esac ++ if test "$pcap_gcc_major_version" -ge 4; then ++ AC_MSG_RESULT([yes]) ++ else ++ AC_MSG_RESULT([no - $pcap_gcc_major_version ; $CC ; $GCC]) ++ fi ++fi ++ ++# Remember that all following tests will run with this CXXFLAGS by default ++if test "$pcap_gcc_major_version" -ge 4; then ++ V_CCOPT="$V_CCOPT -fno-strict-aliasing" ++fi ++ ++ + # + # Makefile.in includes rules to generate version.h, so we assume + # that it will be generated if autoconf is used. diff --git a/libpcap/configure b/libpcap/configure index de7e04896..bd8a1b82a 100755 --- a/libpcap/configure +++ b/libpcap/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Revision: 2862 . +# From configure.ac Revision: 2864 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59. # @@ -6907,6 +6907,43 @@ _ACEOF fi +pcap_gcc_major_version=0 +echo "$as_me:$LINENO: checking whether the compiler is gcc 4 or greater" >&5 +echo $ECHO_N "checking whether the compiler is gcc 4 or greater... $ECHO_C" >&6 +if test x"$GCC" = xno; then + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +else + # new major versions must be added here + case `$CC --version | sed -e 's,\..*,.,' -e q` in + *4.) + pcap_gcc_major_version=4 + ;; + *3.) + pcap_gcc_major_version=3 + ;; + *2.) + pcap_gcc_major_version=2 + ;; + *1.) + pcap_gcc_major_version=1 + ;; + esac + if test "$pcap_gcc_major_version" -ge 4; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no - $pcap_gcc_major_version ; $CC ; $GCC" >&5 +echo "${ECHO_T}no - $pcap_gcc_major_version ; $CC ; $GCC" >&6 + fi +fi + +# Remember that all following tests will run with this CXXFLAGS by default +if test "$pcap_gcc_major_version" -ge 4; then + V_CCOPT="$V_CCOPT -fno-strict-aliasing" +fi + + # # Makefile.in includes rules to generate version.h, so we assume # that it will be generated if autoconf is used. diff --git a/libpcap/configure.ac b/libpcap/configure.ac index c937a9a94..968b7e5c1 100644 --- a/libpcap/configure.ac +++ b/libpcap/configure.ac @@ -741,6 +741,39 @@ AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1 AC_LBL_UNALIGNED_ACCESS +pcap_gcc_major_version=0 +AC_MSG_CHECKING([whether the compiler is gcc 4 or greater]) +if test x"$GCC" = xno; then + AC_MSG_RESULT([no]) +else + # new major versions must be added here + case `$CC --version | sed -e 's,\..*,.,' -e q` in + *4.) + pcap_gcc_major_version=4 + ;; + *3.) + pcap_gcc_major_version=3 + ;; + *2.) + pcap_gcc_major_version=2 + ;; + *1.) + pcap_gcc_major_version=1 + ;; + esac + if test "$pcap_gcc_major_version" -ge 4; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no - $pcap_gcc_major_version ; $CC ; $GCC]) + fi +fi + +# Remember that all following tests will run with this CXXFLAGS by default +if test "$pcap_gcc_major_version" -ge 4; then + V_CCOPT="$V_CCOPT -fno-strict-aliasing" +fi + + # # Makefile.in includes rules to generate version.h, so we assume # that it will be generated if autoconf is used. diff --git a/nmap.cc b/nmap.cc index 8a274cf24..630baf172 100644 --- a/nmap.cc +++ b/nmap.cc @@ -370,6 +370,9 @@ int nmap_main(int argc, char *argv[]) { if (o.host_timeout <= 200) { fatal("host_timeout is given in milliseconds and must be greater than 200"); } + if (o.host_timeout <= 1000) { + error("host_timeout is given in milliseconds, so you specified less than a second (%dms). This is allowed but not recommended.". o.host_timeout); + } } else if (strcmp(long_options[option_index].name, "ttl") == 0) { o.ttl = atoi(optarg); if (o.ttl < 0 || o.ttl > 255) { diff --git a/nmap_winconfig.h b/nmap_winconfig.h index 67ee4a70f..f2ab3802d 100644 --- a/nmap_winconfig.h +++ b/nmap_winconfig.h @@ -104,7 +104,7 @@ #ifndef NMAP_WINCONFIG_H #define NMAP_WINCONFIG_H -#define NMAP_VERSION "3.91" +#define NMAP_VERSION "3.92" #define NMAP_NAME "nmap" #define NMAP_URL "http://www.insecure.org/nmap" #define NMAP_PLATFORM "i686-pc-windows-windows" diff --git a/scripts/Makefile b/scripts/Makefile index 512c51a69..9c1f54314 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -71,19 +71,33 @@ distro: $(MAKE) -C .. clean cd .. && rm -f $(LIBPCAPDIR)/config.cache $(LIBPCAPDIR)/Makefile cd .. && unix2dos README-WIN32 - cd .. && cp -ra $(SRCS) $(DEPS) $(DATAFILES) nmapfe.desktop \ + cd .. && cp -a $(SRCS) $(DEPS) $(DATAFILES) nmapfe.desktop \ configure.ac config.h.in aclocal.m4 nmap_winconfig.h Makefile.in \ configure shtool install-sh config.guess \ nmap-$(NMAP_VERSION)-1.spec config.sub INSTALL README-WIN32 COPYING \ COPYING.OpenSSL CHANGELOG HACKING /usr/tmp/nmap-$(NMAP_VERSION) $(SHTOOL) mkdir /usr/tmp/nmap-$(NMAP_VERSION)/mswin32 - cd ../mswin32; cp -ra *.[hHcC] *.cc ARPA NET NETINET RPC icon1.ico \ - ifaddrlist.h lib libpcap-note.txt nmap.rc \ - nmap_performance.reg nmap.sln nmap.vcproj pcap-include \ - /usr/tmp/nmap-$(NMAP_VERSION)/mswin32 - + cd ../mswin32; cp -a --parents ARPA/NAMESER.H ARPA/TFTP.H icon1.ico \ + ifaddrlist.h IPExport.h lib/Packet.lib lib/Wpcap.lib \ + libpcap-note.txt NET/if_arp.h NETINET/UDP.H NETINET/IF_ETHER.H \ + NETINET/IP.H NETINET/TCPIP.H NETINET/IP_ICMP.H NETINET/IN_SYSTM.H \ + NETINET/TCP.H NETINET/TCP_VAR.H NETINET/UDP_VAR.H NETINET/IP_VAR.H \ + nmap_performance.reg nmap.rc nmap.sln nmap.vcproj packet_types.h \ + pcap-include/remote-ext.h pcap-include/memory_t.h \ + pcap-include/pcap-stdinc.h pcap-include/pcap.h \ + pcap-include/semaphore.h pcap-include/Gnuc.h \ + pcap-include/count_packets.h pcap-include/Devioctl.h \ + pcap-include/bucket_lookup.h pcap-include/ip6_misc.h \ + pcap-include/bittypes.h pcap-include/time_calls.h \ + pcap-include/pthread.h pcap-include/Win32-Extensions.h \ + pcap-include/Packet32.h pcap-include/normal_lookup.h \ + pcap-include/pcap-bpf.h pcap-include/sched.h \ + pcap-include/Ntddpack.h pcap-include/tme.h \ + pcap-include/tcp_session.h pcap-include/pcap-int.h \ + resource.h RPC/Rpc_cut.h winclude.h winfix.cc winfix.h \ + /usr/tmp/nmap-$(NMAP_VERSION)/mswin32 $(SHTOOL) mkdir /usr/tmp/nmap-$(NMAP_VERSION)/$(LIBPCAPDIR) - cd ../$(LIBPCAPDIR); cp -ra --parents acconfig.h aclocal.m4 arcnet.h \ + cd ../$(LIBPCAPDIR); cp -a --parents acconfig.h aclocal.m4 arcnet.h \ atmuni31.h bpf/net/bpf.h bpf/net/bpf_filter.c \ bpf_dump.c bpf_image.c CHANGES \ ChmodBPF/ChmodBPF ChmodBPF/StartupParameters.plist config.guess \ @@ -99,7 +113,7 @@ distro: msdos/pkt_rx1.s msdos/common.dj msdos/makefile msdos/pktdrvr.c \ msdos/readme.dos msdos/ndis_0.asm msdos/makefile.dj nametoaddr.c \ nlpid.h NMAP_MODIFICATIONS optimize.c packaging/pcap.spec.in \ - packaging/pcap.spec pcap1.h pcap.3 pcap-bpf.c pcap-bpf.h pcap.c \ + pcap1.h pcap.3 pcap-bpf.c pcap-bpf.h pcap.c \ pcap-dag.c pcap-dag.h pcap-dlpi.c pcap-dos.c pcap-dos.h \ pcap-enet.c pcap.h pcap-int.h pcap-linux.c pcap-namedb.h \ pcap-nit.c pcap-nit.h pcap-null.c pcap-pf.c pcap-pf.h \ @@ -121,7 +135,7 @@ distro: Win32/Prj/libpcap.dsp \ /usr/tmp/nmap-$(NMAP_VERSION)/$(LIBPCAPDIR) $(SHTOOL) mkdir /usr/tmp/nmap-$(NMAP_VERSION)/docs - cd ../docs; cp -ra README nmap_gpgkeys.txt \ + cd ../docs; cp -a README nmap_gpgkeys.txt \ nmap-fingerprinting-article.txt \ nmap.deprecated.txt nmap.usage.txt nmap_doc.html \ nmap_manpage-de.html nmap_manpage-es.html \ @@ -133,18 +147,18 @@ distro: nmap_spanish.1 nmap_russian.1 xnmap.1 nmap.dtd nmap.xsl \ leet-nmap-ascii-art.txt /usr/tmp/nmap-$(NMAP_VERSION)/docs $(SHTOOL) mkdir /usr/tmp/nmap-$(NMAP_VERSION)/nmapfe - cd ../nmapfe; cp -ra Makefile.in aclocal.m4 configure configure.ac \ + cd ../nmapfe; cp -a Makefile.in aclocal.m4 configure configure.ac \ nmapfe.c nmapfe.h nmapfe_sig.c nmapfe_sig.h \ nmapfe_error.c nmapfe_error.h NmapFE.dsp nmapfe.dsw \ /usr/tmp/nmap-$(NMAP_VERSION)/nmapfe $(SHTOOL) mkdir /usr/tmp/nmap-$(NMAP_VERSION)/nbase - cd ../$(NBASEDIR); cp -ra Makefile.in aclocal.m4 configlocal.m4 \ + cd ../$(NBASEDIR); cp -a Makefile.in aclocal.m4 configlocal.m4 \ nbase.vcproj configure configure.ac nbase_config.h.in \ *.c *.h CHANGELOG /usr/tmp/nmap-$(NMAP_VERSION)/nbase $(SHTOOL) mkdir /usr/tmp/nmap-$(NMAP_VERSION)/libpcre - cd ../libpcre; cp -ra AUTHORS config.guess config.in config.sub \ + cd ../libpcre; cp -a AUTHORS config.guess config.in config.sub \ configure configure.ac dftables.c INSTALL install-sh \ libpcre.vcproj LICENCE Makefile.in makevp.bat mkinstalldirs \ NMAP_MODIFICATIONS NON-UNIX-USE pcre_chartables.c \ @@ -157,28 +171,48 @@ distro: /usr/tmp/nmap-$(NMAP_VERSION)/libpcre $(SHTOOL) mkdir /usr/tmp/nmap-$(NMAP_VERSION)/libdnet-stripped - cd ../$(LIBDNETDIR); cp -ra NMAP_MODIFICATIONS \ - libdnet-stripped.vcproj acconfig.h aclocal.m4 config \ - configure configure.in dnet-config.in include INSTALL \ - libtool LICENSE Makefile Makefile.am Makefile.am.common \ - Makefile.in README src THANKS TODO \ - /usr/tmp/nmap-$(NMAP_VERSION)/libdnet-stripped - + cd ../$(LIBDNETDIR); cp -a --parents acconfig.h aclocal.m4 \ + config/missing config/mkinstalldirs \ + config/acinclude.m4 config/install-sh \ + config/config.sub config/ltmain.sh config/config.guess \ + configure configure.in dnet-config.in include/dnet/rand.h \ + include/dnet/ip6.h include/dnet/ip.h include/dnet/route.h \ + include/dnet/icmp.h include/dnet/blob.h include/dnet/udp.h \ + include/dnet/os.h include/dnet/eth.h include/dnet/fw.h \ + include/dnet/intf.h include/dnet/Makefile.in include/dnet/tcp.h \ + include/dnet/arp.h include/dnet/Makefile.am include/dnet/tun.h \ + include/dnet/addr.h include/Makefile.in include/dnet.h \ + include/stamp-h1 include/dnet_winconfig.h include/Makefile.am \ + include/queue.h include/stamp-h.in include/config.h.in \ + include/err.h INSTALL libdnet-stripped.vcproj LICENSE \ + Makefile.am Makefile.am.common Makefile.in NMAP_MODIFICATIONS \ + README src/fw-ipf.c src/route-none.c src/ip-cooked.c \ + src/arp-win32.c src/ip-util.c src/route-win32.c src/fw-none.c \ + src/eth-linux.c src/route-bsd.c src/route-linux.c src/fw-pf.c \ + src/tun-bsd.c src/strlcat.c src/tun-none.c src/memcmp.c \ + src/route-hpux.c src/addr-util.c src/eth-ndd.c src/ip6.c \ + src/intf.c src/Makefile.in src/addr.c src/eth-dlpi.c \ + src/fw-ipchains.c src/rand.c src/tun-solaris.c src/intf-win32.c \ + src/eth-none.c src/ip.c src/fw-pktfilter.c src/ip-win32.c \ + src/fw-ipfw.c src/arp-ioctl.c src/arp-none.c src/Makefile.am \ + src/eth-bsd.c src/strsep.c src/err.c src/strlcpy.c src/blob.c \ + src/eth-win32.c src/eth-snoop.c src/eth-pfilt.c src/tun-linux.c \ + src/arp-bsd.c THANKS TODO \ + /usr/tmp/nmap-$(NMAP_VERSION)/libdnet-stripped $(SHTOOL) mkdir /usr/tmp/nmap-$(NMAP_VERSION)/nsock $(SHTOOL) mkdir /usr/tmp/nmap-$(NMAP_VERSION)/nsock/include $(SHTOOL) mkdir /usr/tmp/nmap-$(NMAP_VERSION)/nsock/src cp ../nsock/nsock.vcproj /usr/tmp/nmap-$(NMAP_VERSION)/nsock/ - cd ../nsock/include; cp -ra nsock.h /usr/tmp/nmap-$(NMAP_VERSION)/nsock/include/ - cd ../nsock/src; cp -ra aclocal.m4 config.guess config.sub \ - configure configure.ac error.c error.h \ - filespace.c filespace.h gh_list.c gh_list.h \ - install-sh Makefile.in netutils.c netutils.h \ - nsock_config.h.in nsock_connect.c nsock_core.c \ - nsock_event.c nsock_internal.h nsock_iod.c \ - nsock_pool.c nsock_read.c nsock_ssl.h \ - nsock_ssl.c nsock_timers.c \ - nsock_write.c nsock_utils.c nsock_utils.h \ - /usr/tmp/nmap-$(NMAP_VERSION)/nsock/src/ + cd ../nsock; cp -a --parents include/nsock.h nsock.vcproj \ + src/nsock_utils.c src/aclocal.m4 src/error.h src/netutils.c \ + src/gh_list.h src/nsock_internal.h src/nsock_write.c \ + src/nsock_core.c src/nsock_pool.c src/configure src/Makefile.in \ + src/filespace.h src/nsock_utils.h src/install-sh src/config.sub \ + src/nsock_timers.c src/nsock_read.c src/nsock_iod.c \ + src/nsock_ssl.c src/config.guess src/filespace.c src/nsock_ssl.h \ + src/configure.ac src/nsock_config.h.in src/nsock_connect.c \ + src/nsock_event.c src/gh_list.c src/error.c src/netutils.h TODO \ + /usr/tmp/nmap-$(NMAP_VERSION)/nsock/ rm -f /usr/tmp/nmap-$(NMAP_VERSION)/nbase/nbase_config.h # Kill the SVN/CVS crap diff --git a/targets.cc b/targets.cc index 9664ceb6a..4b505faf2 100644 --- a/targets.cc +++ b/targets.cc @@ -414,7 +414,8 @@ if (hs->randomize) { if ((o.sendpref & PACKET_SEND_ETH) && hs->hostbatch[0]->ifType() == devt_ethernet) { for(i=0; i < hs->current_batch_sz; i++) - if (!(hs->hostbatch[i]->flags & HOST_DOWN)) + if (!(hs->hostbatch[i]->flags & HOST_DOWN) && + !hs->hostbatch[i]->timedOut()) if (!setTargetNextHopMAC(hs->hostbatch[i])) fatal("%s: Failed to determine dst MAC address for target %s", __FUNCTION__, hs->hostbatch[hidx]->NameIP()); @@ -425,8 +426,10 @@ if (hs->randomize) { /* Then we do the mass ping (if required - IP-level pings) */ if ((*pingtype == PINGTYPE_NONE && !arpping_done) || hs->hostbatch[0]->ifType() == devt_loopback) { for(i=0; i < hs->current_batch_sz; i++) { - initialize_timeout_info(&hs->hostbatch[i]->to); - hs->hostbatch[i]->flags |= HOST_UP; /*hostbatch[i].up = 1;*/ + if (hs->hostbatch[i]->timedOut()) { + initialize_timeout_info(&hs->hostbatch[i]->to); + hs->hostbatch[i]->flags |= HOST_UP; /*hostbatch[i].up = 1;*/ + } } } else if (!arpping_done) if (*pingtype & PINGTYPE_ARP) /* A host that we can't arp scan ... maybe localhost */