Skip to content

Commit

Permalink
Adds required libnet check to enable tcpkill
Browse files Browse the repository at this point in the history
Incorporated an unsophisticated check for libnet_init_packet before
enabling the option.  Requires that `libnet-config` be in your path and
`libnet` and its headers are in the configured path (either system-wide,
or via `configure` options).
  • Loading branch information
jpr5 committed Sep 3, 2015
1 parent 673a400 commit a39256b
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
47 changes: 47 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -3430,6 +3430,53 @@ fi
# Check whether --enable-tcpkill was given.
if test "${enable_tcpkill+set}" = set; then :
enableval=$enable_tcpkill;
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libnet_init_packet in -lnet" >&5
$as_echo_n "checking for libnet_init_packet in -lnet... " >&6; }
if ${ac_cv_lib_net_libnet_init_packet+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lnet $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char libnet_init_packet ();
int
main ()
{
return libnet_init_packet ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_net_libnet_init_packet=yes
else
ac_cv_lib_net_libnet_init_packet=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_net_libnet_init_packet" >&5
$as_echo "$ac_cv_lib_net_libnet_init_packet" >&6; }
if test "x$ac_cv_lib_net_libnet_init_packet" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBNET 1
_ACEOF
LIBS="-lnet $LIBS"
else
echo !!! error: tcpkill feature enabled but no libnet found; exit
fi
USE_TCPKILL="1"
EXTRA_OBJS="$EXTRA_OBJS tcpkill.o"
EXTRA_DEFINES="$EXTRA_DEFINES $(libnet-config --defines)"
Expand Down
1 change: 1 addition & 0 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ dnl
AC_ARG_ENABLE(tcpkill,
[ --enable-tcpkill enable connection killing support],
[
AC_CHECK_LIB(net, libnet_init_packet,,echo !!! error: tcpkill feature enabled but no libnet found; exit)
USE_TCPKILL="1"
EXTRA_OBJS="$EXTRA_OBJS tcpkill.o"
EXTRA_DEFINES="$EXTRA_DEFINES $(libnet-config --defines)"
Expand Down

0 comments on commit a39256b

Please sign in to comment.