diff --git a/configure b/configure index 06d1304e3..27842e149 100755 --- a/configure +++ b/configure @@ -4718,6 +4718,13 @@ _ACEOF fi + ;; + *-solaris2.1[1-9]*) + $as_echo "#define SOLARIS 1" >>confdefs.h + + # Solaris 11 and later use BPF packet capture rather than DLPI. + $as_echo "#define SOLARIS_BPF_PCAP_CAPTURE 1" >>confdefs.h + ;; *-solaris2.0*) $as_echo "#define STUPID_SOLARIS_CHECKSUM_BUG 1" >>confdefs.h diff --git a/configure.ac b/configure.ac index 9630ae9e5..1712c3059 100644 --- a/configure.ac +++ b/configure.ac @@ -123,6 +123,11 @@ case "$host" in AC_CHECK_LIB(cfg, _system_configuration) AC_CHECK_LIB(crypt, crypt_r) ;; + *-solaris2.1[[1-9]]*) + AC_DEFINE(SOLARIS) + # Solaris 11 and later use BPF packet capture rather than DLPI. + AC_DEFINE(SOLARIS_BPF_PCAP_CAPTURE) + ;; *-solaris2.0*) AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG) AC_DEFINE(SOLARIS) diff --git a/libnetutil/netutil.cc b/libnetutil/netutil.cc index 126925281..1d5b4966e 100644 --- a/libnetutil/netutil.cc +++ b/libnetutil/netutil.cc @@ -857,14 +857,10 @@ void set_ttl(int sd, int ttl) { #endif } -/* This should additionally be true for Solaris version 11 (but not 10 or - earlier), but I haven't found a preprocessor symbol that allows easily - testing that. Solaris 10 used DLPI for packet capture, but what OS X, - FreeBSD, and Solaris 11 have in common is that they use BPF. We can get away - with not having Solaris 11 here because the pcap_selectable_fd_one_to_one - test is true for all Solaris and overrides this function everywhere it is - used. */ -#if defined(WIN32) || defined(MACOSX) || (defined(FREEBSD) && (__FreeBSD_version < 500000)) +/* Other than WIN32, what these systems have in common is that they use BPF for + packet capture. (Solaris 10 and earlier used DLPI and had valid selectable + fds.) */ +#if defined(WIN32) || defined(MACOSX) || (defined(FREEBSD) && (__FreeBSD_version < 500000) || defined(SOLARIS_BPF_PCAP_CAPTURE)) /* Returns whether the system supports pcap_get_selectable_fd() properly */ int pcap_selectable_fd_valid() { return 0; diff --git a/nmap_config.h.in b/nmap_config.h.in index 0033ca8cc..bd2c77640 100644 --- a/nmap_config.h.in +++ b/nmap_config.h.in @@ -158,6 +158,7 @@ #undef HAVE_OPENSSL #undef STUPID_SOLARIS_CHECKSUM_BUG +#undef SOLARIS_BPF_PCAP_CAPTURE #undef SPRINTF_RETURNS_STRING diff --git a/nsock/include/nsock_config.h.in b/nsock/include/nsock_config.h.in index 40af3fb9c..08b4d9658 100644 --- a/nsock/include/nsock_config.h.in +++ b/nsock/include/nsock_config.h.in @@ -70,6 +70,8 @@ #undef NETBSD #undef MACOSX +#undef SOLARIS_BPF_PCAP_CAPTURE + #undef HAVE_NET_BPF_H #undef HAVE_SYS_IOCTL_H diff --git a/nsock/src/configure b/nsock/src/configure index e612ab8b8..01a9f1011 100755 --- a/nsock/src/configure +++ b/nsock/src/configure @@ -2216,6 +2216,13 @@ case "$host" in *-hpux*) $as_echo "#define HPUX 1" >>confdefs.h + ;; + *-solaris2.1[1-9]*) + $as_echo "#define SOLARIS 1" >>confdefs.h + + # Solaris 11 and later use BPF packet capture rather than DLPI. + $as_echo "#define SOLARIS_BPF_PCAP_CAPTURE 1" >>confdefs.h + ;; *-solaris2.0*) $as_echo "#define SOLARIS 1" >>confdefs.h diff --git a/nsock/src/configure.ac b/nsock/src/configure.ac index f9c5374ed..4ff667f10 100644 --- a/nsock/src/configure.ac +++ b/nsock/src/configure.ac @@ -34,6 +34,11 @@ case "$host" in *-hpux*) AC_DEFINE(HPUX) ;; + *-solaris2.1[[1-9]]*) + AC_DEFINE(SOLARIS) + # Solaris 11 and later use BPF packet capture rather than DLPI. + AC_DEFINE(SOLARIS_BPF_PCAP_CAPTURE) + ;; *-solaris2.0*) AC_DEFINE(SOLARIS) ;; diff --git a/nsock/src/nsock_pcap.h b/nsock/src/nsock_pcap.h index 0dce8c63e..d53a5790a 100644 --- a/nsock/src/nsock_pcap.h +++ b/nsock/src/nsock_pcap.h @@ -83,7 +83,7 @@ */ /* Returns whether the system supports pcap_get_selectable_fd() properly */ -#if !defined(WIN32) && !defined(SOLARIS) +#if !defined(WIN32) && !defined(SOLARIS_BPF_PCAP_CAPTURE) #define PCAP_CAN_DO_SELECT 1 #endif