Permalink
Browse files

Allow VLAN hack to be disabled at compile

  • Loading branch information...
jpr5 committed Sep 7, 2017
1 parent eb9a5e5 commit 35527b42bca51985385a3e8a005abbfd8faaf6dd
Showing with 51 additions and 1 deletion.
  1. +1 −0 config.h.in
  2. +30 −0 configure
  3. +19 −0 configure.in
  4. +1 −1 ngrep.c
View
@@ -8,6 +8,7 @@
#define USE_PCRE @USE_PCRE@
#define USE_IPv6 @USE_IPv6@
#define USE_TCPKILL @USE_TCPKILL@
#define USE_VLAN_HACK @USE_VLAN_HACK@
#define HAVE_DLT_RAW @HAVE_DLT_RAW@
#define HAVE_DLT_PFLOG @HAVE_DLT_PFLOG@
View
@@ -666,6 +666,7 @@ enable_ipv6
enable_pcap_restart
enable_pcre
enable_tcpkill
enable_vlan_hack
with_pcap_includes
'
ac_precious_vars='build_alias
@@ -1305,6 +1306,7 @@ Optional Features:
--enable-pcap-restart enable BPF lexer restart bugfix for older versions of PCAP (default off)
--enable-pcre use PCRE instead of GNU regex (default GNU)
--enable-tcpkill enable connection killing support (default off)
--disable-vlan-hack disable automatic inclusion of VLAN frames (default on)
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -3514,6 +3516,21 @@ else
fi
# Check whether --enable-vlan-hack was given.
if test "${enable_vlan_hack+set}" = set; then :
enableval=$enable_vlan_hack; use_vlan_hack="$enableval"
else
use_vlan_hack="yes"
fi
if test $use_vlan_hack = yes; then
USE_VLAN_HACK="1"
else
USE_VLAN_HACK="0"
fi
# Check whether --with-pcap-includes was given.
if test "${with_pcap_includes+set}" = set; then :
@@ -4075,6 +4092,11 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
cat >>confdefs.h <<_ACEOF
#define USE_VLAN_HACK $USE_VLAN_HACK
_ACEOF
cat >>confdefs.h <<_ACEOF
#define USE_DROPPRIVS $USE_DROPPRIVS
@@ -4170,6 +4192,14 @@ else
$as_echo "CONFIG: tcpkill feature disabled" >&6; }
fi
if test "$USE_VLAN_HACK" = "1"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: CONFIG: automatically including VLAN frames" >&5
$as_echo "CONFIG: automatically including VLAN frames" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: CONFIG: not automatically including VLAN frames" >&5
$as_echo "CONFIG: not automatically including VLAN frames" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5
$as_echo "" >&6; }
View
@@ -189,6 +189,18 @@ else
fi
AC_ARG_ENABLE(vlan-hack,
[ --disable-vlan-hack disable automatic inclusion of VLAN frames (default on)],
[use_vlan_hack="$enableval"],
[use_vlan_hack="yes"])
if test $use_vlan_hack = yes; then
USE_VLAN_HACK="1"
else
USE_VLAN_HACK="0"
fi
AC_ARG_WITH(pcap-includes,
[ --with-pcap-includes=dir specify the pcap include directory],
[PCAP_DIR=$withval],
@@ -467,6 +479,7 @@ AC_DEFINE_UNQUOTED(PCAP_RESTART_FUNC, $PCAP_RESTART_FUNC, [routi
AC_DEFINE_UNQUOTED(USE_PCRE, $USE_PCRE, [whether to use PCRE (default GNU Regex)])
AC_DEFINE_UNQUOTED(USE_IPv6, $USE_IPv6, [whether to use IPv6 (default off)])
AC_DEFINE_UNQUOTED(USE_TCPKILL, $USE_TCPKILL, [whether to enable tcpkill functionality (default off)])
AC_DEFINE_UNQUOTED(USE_VLAN_HACK, $USE_VLAN_HACK, [whether to automatically include VLAN frames (default on)])
AC_DEFINE_UNQUOTED(USE_DROPPRIVS, $USE_DROPPRIVS, [whether to use privileges dropping (default yes)])
AC_DEFINE_UNQUOTED(DROPPRIVS_USER, "$DROPPRIVS_USER", [pseudo-user for running ngrep (default "nobody")])
@@ -523,6 +536,12 @@ else
AC_MSG_RESULT(CONFIG: tcpkill feature disabled)
fi
if test "$USE_VLAN_HACK" = "1"; then
AC_MSG_RESULT(CONFIG: automatically including VLAN frames)
else
AC_MSG_RESULT(CONFIG: NOT automatically including VLAN frames)
fi
dnl
dnl And we're done. ALL YOUR BASE. Don't forget.
dnl
View
@@ -159,7 +159,7 @@ char *filter = NULL, *filter_file = NULL;
char pc_err[PCAP_ERRBUF_SIZE];
uint8_t link_offset;
uint8_t radiotap_present = 0;
uint8_t include_vlan = 1;
uint8_t include_vlan = USE_VLAN_HACK;
pcap_t *pd = NULL, *pd_dumppcap = NULL;
pcap_dumper_t *pd_dump = NULL;

0 comments on commit 35527b4

Please sign in to comment.