o Included this file, renamed directory from libpcap-1.0.0 to libpcap. o Added @CFLAGS@ to the CFLAGS definition in Makefile.in to pick up -g if configure determines that it is supported: --- Makefile.in.orig 2009-11-04 11:35:44.000000000 -0700 +++ Makefile.in 2009-11-04 11:50:02.000000000 -0700 @@ -55,7 +55,7 @@ PROG=libpcap # Standard CFLAGS -CFLAGS = $(CCOPT) $(INCLS) $(DEFS) +CFLAGS = @CFLAGS@ $(CCOPT) $(INCLS) $(DEFS) INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ o Eliminated Lex/Yacc requirement and added the generated files: grammar.c scanner.c scanner.h tokdefs.h --- Makefile.in.orig 2009-11-04 11:35:44.000000000 -0700 +++ Makefile.in 2009-11-04 11:46:43.000000000 -0700 @@ -55,21 +55,13 @@ PROG=libpcap # Standard CFLAGS -CFLAGS = $(CCOPT) $(INCLS) $(DEFS) +CFLAGS = @CFLAGS@ $(CCOPT) $(INCLS) $(DEFS) INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ RANLIB = @RANLIB@ -# -# Flex and bison allow you to specify the prefixes of the global symbols -# used by the generated parser. This allows programs to use lex/yacc -# and link against libpcap. If you don't have flex or bison, get them. -# -LEX = @V_LEX@ -YACC = @V_YACC@ - # Explicitly define compilation rule since SunOS 4's make doesn't like gcc. # Also, gcc does not remove the .o before forking 'as', which can be a # problem if you don't own the file but can write to the directory. @@ -122,7 +114,7 @@ TAGFILES = \ $(SRC) $(HDR) $(TAGHDR) -CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c +CLEANFILES = $(OBJ) libpcap.a lex.yy.c MAN1 = pcap-config.1 @@ -313,6 +305,15 @@ all: libpcap.a pcap-config +# Inhibit implicit rule Make seems to have for using yacc/lex to +# recompile new scanner.c/grammar.c -- we ship ones which we want to +# use instead. +grammar.c: + echo "Not rebuilding grammar.c" + +scanner.c: + echo "Not rebuilding scanner.c" + libpcap.a: $(OBJ) @rm -f $@ $(AR) rc $@ $(OBJ) $(LIBS) @@ -344,22 +345,11 @@ -compatibility_version 1 \ -current_version `sed 's/[^0-9.].*$$//' $(srcdir)/VERSION` -scanner.c: $(srcdir)/scanner.l - @rm -f $@ - ./runlex.sh $(LEX) -o$@ $< - scanner.o: scanner.c tokdefs.h $(CC) $(CFLAGS) -c scanner.c pcap.o: version.h -tokdefs.h: grammar.c -grammar.c: $(srcdir)/grammar.y - @rm -f grammar.c tokdefs.h - $(YACC) -d $< - mv y.tab.c grammar.c - mv y.tab.h tokdefs.h - grammar.o: grammar.c @rm -f $@ $(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c --- configure.in.orig 2009-10-27 16:20:34.000000000 -0600 +++ configure.in 2009-10-27 16:14:32.000000000 -0600 @@ -848,24 +848,6 @@ fi -AC_LBL_LEX_AND_YACC(V_LEX, V_YACC, pcap_) -if test "$V_LEX" = lex ; then -# Some versions of lex can't handle the definitions section of scanner.l . -# Try lexing it and complain if it can't deal. - AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex, - if lex -t scanner.l > /dev/null 2>&1; then - tcpdump_cv_capable_lex=yes - else - tcpdump_cv_capable_lex=insufficient - fi) - if test $tcpdump_cv_capable_lex = insufficient ; then - AC_MSG_ERROR([Your operating system's lex is insufficient to compile - libpcap. flex is a lex replacement that has many advantages, including - being able to compile libpcap. For more information, see - http://www.gnu.org/software/flex/flex.html .]) - fi -fi - # # Assume a.out/ELF convention for shared library names (".so"), and # V7/BSD convention for man pages (file formats in section 5, @@ -1004,10 +986,8 @@ AC_SUBST(V_DEFS) AC_SUBST(V_INCLS) AC_SUBST(V_LIBS) -AC_SUBST(V_LEX) AC_SUBST(V_PCAP) AC_SUBST(V_FINDALLDEVS) -AC_SUBST(V_YACC) AC_SUBST(SSRC) AC_SUBST(DYEXT) AC_SUBST(DAGLIBS) o Added a --disable-packet-ring configure option to allow the creation of 32-bit binaries compatible with 64-bit Linux kernels before 2.6.27. Index: configure.in =================================================================== --- configure.in (revision 17694) +++ configure.in (working copy) @@ -1396,6 +1396,24 @@ AC_SUBST(CAN_SRC) fi +dnl The packet ring capture facility of Linux, described in +dnl Documentation/networking/packet_mmap.txt, is not 32/64-bit compatible before +dnl version 2.6.27. A 32-bit kernel requires a 32-bit userland, and likewise for +dnl 64-bit. The effect of this is that a 32-bit libpcap binary will not run +dnl correctly on a 64-bit kernel (the binary will use the wrong offsets into a +dnl kernel struct). This problem was solved in Linux 2.6.27. Use +dnl --disable-packet-ring whenever a 32-bit application must run on a 64-bit +dnl target host, and either the build host or the target host run Linux 2.6.26 +dnl or earlier. +AC_ARG_ENABLE([packet-ring], +[AC_HELP_STRING([--enable-packet-ring],[enable Linux packet ring support @<:@default=yes@:>@])], +,enable_packet_ring=yes) + +if test "x$enable_packet_ring" != "xno" ; then + AC_DEFINE(PCAP_SUPPORT_PACKET_RING, 1, [use Linux packet ring capture if available]) + AC_SUBST(PCAP_SUPPORT_PACKET_RING) +fi + AC_PROG_INSTALL AC_CONFIG_HEADER(config.h) Index: pcap-linux.c =================================================================== --- pcap-linux.c (revision 17694) +++ pcap-linux.c (working copy) @@ -232,17 +232,19 @@ # endif /* PACKET_HOST */ - /* check for memory mapped access avaibility. We assume every needed - * struct is defined if the macro TPACKET_HDRLEN is defined, because it - * uses many ring related structs and macros */ -# ifdef TPACKET_HDRLEN -# define HAVE_PACKET_RING -# ifdef TPACKET2_HDRLEN -# define HAVE_TPACKET2 -# else -# define TPACKET_V1 0 -# endif /* TPACKET2_HDRLEN */ -# endif /* TPACKET_HDRLEN */ +# ifdef PCAP_SUPPORT_PACKET_RING + /* check for memory mapped access avaibility. We assume every needed + * struct is defined if the macro TPACKET_HDRLEN is defined, because it + * uses many ring related structs and macros */ +# ifdef TPACKET_HDRLEN +# define HAVE_PACKET_RING +# ifdef TPACKET2_HDRLEN +# define HAVE_TPACKET2 +# else +# define TPACKET_V1 0 +# endif /* TPACKET2_HDRLEN */ +# endif /* TPACKET_HDRLEN */ +# endif /* PCAP_SUPPORT_PACKET_RING */ #endif /* PF_PACKET */ #ifdef SO_ATTACH_FILTER o Regenerated configure. o Added a memset() call that removes a Valgrind error. More info at: Index: pcap-linux.c =================================================================== --- pcap-linux.c (revision 20314) +++ pcap-linux.c (working copy) @@ -2148,6 +2148,7 @@ struct sock_fprog fcode; int can_filter_in_kernel; int err = 0; + memset(&fcode, 0, sizeof(struct sock_fprog)); #endif if (!handle)