jpr5 / ngrep

ngrep is like GNU grep applied to the network layer. It's a PCAP-based tool that allows you to specify an extended regular or hexadecimal expression to match against data payloads of packets. It understands many kinds of protocols, including IPv4/6, TCP, UDP, ICMPv4/6, IGMP and Raw, across a wide variety of interface types, and understands BPF filter logic in the same fashion as more common packet sniffing tools, such as tcpdump and snoop.
https://github.com/jpr5/ngrep
Other
889 stars 99 forks source link

Building on MacOS with --enable-tcpkill fails #20

Open prawnsalad opened 5 years ago

prawnsalad commented 5 years ago

I'm not the best at compiling things so I could missing something obvious. Trying to compile with tcpkill support on MacOS but it errors with tcpkill feature enabled but no libnet found.

I have /usr/local/Cellar/libnet/1.1.6/bin in my PATH and libnet-config is working.

$ libnet-config --defines
-DHAVE_SOCKADDR_SA_LEN -DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP
$ libnet-config --libs
-lnet
$ ./configure --enable-tcpkill

Configuring System ...

checking build system type... x86_64-apple-darwin17.7.0
checking host system type... x86_64-apple-darwin17.7.0
checking target system type... x86_64-apple-darwin17.7.0
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for prefix by checking for tcpdump... /usr/sbin/tcpdump

Configuring GNU Regular Expression library ...

loading cache ./config.cache
checking host system type... x86_64-apple-darwin17.7.0
checking target system type... x86_64-apple-darwin17.7.0
checking build system type... x86_64-apple-darwin17.7.0
checking for gcc... (cached) gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for a BSD compatible install... (cached) /usr/bin/install -c
checking how to run the C preprocessor... (cached) gcc -E
checking for AIX... no
checking for getmntent in -lseq... (cached) no
checking for POSIXized ISC... no
checking for minix/config.h... (cached) no
checking for ANSI C header files... (cached) yes
checking for string.h... (cached) yes
checking for working alloca.h... (cached) yes
checking for alloca... (cached) yes
checking for working const... (cached) yes
checking for prefix by checking for gcc... (cached) /usr/bin/gcc
creating ./config.status
creating Makefile
creating doc/Makefile
creating test/Makefile
checking for libnet_init_packet in -lnet... no
!!! error: tcpkill feature enabled but no libnet found
xiongjinpeng commented 8 months ago

You can modify the following code in the configure file:

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

Changed to

ac_cv_lib_net_libnet_init_packet=yes