mirror of
https://github.com/nmap/nmap.git
synced 2026-08-04 06:40:48 +00:00
Make the Autoconf check for PF_PACKET support Linux-specific. Recent
versions of OpenSolaris (I tested snv_134) also support PF_PACKET, but not in an entirely compatible way. The configure check was making the build use eth-linux.c, which doesn't compile under OpenSolaris. This change makes OpenSolaris fall back to eth-dlpi.c, which works. The report about this was sent by Darren Reed.
This commit is contained in:
parent
41fabf30f8
commit
d4ff5e9688
3 changed files with 107 additions and 15 deletions
|
|
@ -253,6 +253,41 @@ Index: src/eth-dlpi.c
|
|||
return (eth_close(e));
|
||||
}
|
||||
|
||||
o Made the Autoconf check for PF_PACKET Linux-specific. Recent versions
|
||||
of OpenSolaris also support PF_PACKET, but the code in eth-linux.c
|
||||
only works under Linux.
|
||||
|
||||
Index: config/acinclude.m4
|
||||
===================================================================
|
||||
--- config/acinclude.m4 (revision 17391)
|
||||
+++ config/acinclude.m4 (working copy)
|
||||
@@ -135,14 +135,18 @@
|
||||
dnl usage: AC_DNET_LINUX_PF_PACKET
|
||||
dnl results: HAVE_LINUX_PF_PACKET
|
||||
dnl
|
||||
+dnl This is a Linux-specific check, even though other operating systems
|
||||
+dnl (OpenSolaris) may have the PF_PACKET interface. The eth-linux.c code
|
||||
+dnl activated by this check is specific to Linux.
|
||||
AC_DEFUN(AC_DNET_LINUX_PF_PACKET,
|
||||
- [AC_MSG_CHECKING(for Linux PF_PACKET sockets)
|
||||
- AC_CACHE_VAL(ac_cv_dnet_linux_pf_packet,
|
||||
- if test -f /usr/include/netpacket/packet.h ; then
|
||||
- ac_cv_dnet_linux_pf_packet=yes
|
||||
- else
|
||||
- ac_cv_dnet_linux_pf_packet=no
|
||||
- fi)
|
||||
+ [AC_CHECK_DECL([ETH_P_ALL],
|
||||
+ ac_cv_dnet_linux_pf_packet=yes,
|
||||
+ ac_cv_dnet_linux_pf_packet=no,
|
||||
+ [
|
||||
+#include <netpacket/packet.h>
|
||||
+#include <linux/if_ether.h>
|
||||
+])
|
||||
+ AC_MSG_CHECKING(for Linux PF_PACKET sockets)
|
||||
AC_MSG_RESULT($ac_cv_dnet_linux_pf_packet)
|
||||
if test $ac_cv_dnet_linux_pf_packet = yes ; then
|
||||
AC_DEFINE(HAVE_LINUX_PF_PACKET, 1,
|
||||
|
||||
===CHANGES ALREADY MERGED TO UPSTREAM LIBDNET GO BELOW THIS LINE===
|
||||
o Made some code changes to intf.c (the patch below). This does the following:
|
||||
|
||||
|
|
|
|||
|
|
@ -135,14 +135,18 @@ dnl
|
|||
dnl usage: AC_DNET_LINUX_PF_PACKET
|
||||
dnl results: HAVE_LINUX_PF_PACKET
|
||||
dnl
|
||||
dnl This is a Linux-specific check, even though other operating systems
|
||||
dnl (OpenSolaris) may have the PF_PACKET interface. The eth-linux.c code
|
||||
dnl activated by this check is specific to Linux.
|
||||
AC_DEFUN(AC_DNET_LINUX_PF_PACKET,
|
||||
[AC_MSG_CHECKING(for Linux PF_PACKET sockets)
|
||||
AC_CACHE_VAL(ac_cv_dnet_linux_pf_packet,
|
||||
if test -f /usr/include/netpacket/packet.h ; then
|
||||
ac_cv_dnet_linux_pf_packet=yes
|
||||
else
|
||||
ac_cv_dnet_linux_pf_packet=no
|
||||
fi)
|
||||
[AC_CHECK_DECL([ETH_P_ALL],
|
||||
ac_cv_dnet_linux_pf_packet=yes,
|
||||
ac_cv_dnet_linux_pf_packet=no,
|
||||
[
|
||||
#include <netpacket/packet.h>
|
||||
#include <linux/if_ether.h>
|
||||
])
|
||||
AC_MSG_CHECKING(for Linux PF_PACKET sockets)
|
||||
AC_MSG_RESULT($ac_cv_dnet_linux_pf_packet)
|
||||
if test $ac_cv_dnet_linux_pf_packet = yes ; then
|
||||
AC_DEFINE(HAVE_LINUX_PF_PACKET, 1,
|
||||
|
|
|
|||
69
libdnet-stripped/configure
vendored
69
libdnet-stripped/configure
vendored
|
|
@ -14378,18 +14378,71 @@ cat >>confdefs.h <<\_ACEOF
|
|||
_ACEOF
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:$LINENO: checking for Linux PF_PACKET sockets" >&5
|
||||
$as_echo_n "checking for Linux PF_PACKET sockets... " >&6; }
|
||||
if test "${ac_cv_dnet_linux_pf_packet+set}" = set; then
|
||||
{ $as_echo "$as_me:$LINENO: checking whether ETH_P_ALL is declared" >&5
|
||||
$as_echo_n "checking whether ETH_P_ALL is declared... " >&6; }
|
||||
if test "${ac_cv_have_decl_ETH_P_ALL+set}" = set; then
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test -f /usr/include/netpacket/packet.h ; then
|
||||
ac_cv_dnet_linux_pf_packet=yes
|
||||
else
|
||||
ac_cv_dnet_linux_pf_packet=no
|
||||
fi
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
#include <netpacket/packet.h>
|
||||
#include <linux/if_ether.h>
|
||||
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
#ifndef ETH_P_ALL
|
||||
(void) ETH_P_ALL;
|
||||
#endif
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest.$ac_objext; then
|
||||
ac_cv_have_decl_ETH_P_ALL=yes
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_have_decl_ETH_P_ALL=no
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_ETH_P_ALL" >&5
|
||||
$as_echo "$ac_cv_have_decl_ETH_P_ALL" >&6; }
|
||||
if test "x$ac_cv_have_decl_ETH_P_ALL" = x""yes; then
|
||||
ac_cv_dnet_linux_pf_packet=yes
|
||||
else
|
||||
ac_cv_dnet_linux_pf_packet=no
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:$LINENO: checking for Linux PF_PACKET sockets" >&5
|
||||
$as_echo_n "checking for Linux PF_PACKET sockets... " >&6; }
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_cv_dnet_linux_pf_packet" >&5
|
||||
$as_echo "$ac_cv_dnet_linux_pf_packet" >&6; }
|
||||
if test $ac_cv_dnet_linux_pf_packet = yes ; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue