pandora-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Pandora] got working pandora with libpcap-0.7


From: Simon Patarin
Subject: Re: [Pandora] got working pandora with libpcap-0.7
Date: Tue, 3 Dec 2002 10:53:29 +0100 (CET)

> Pandora only relies on libpcap's publicly export interface, so it has to
> work (at least I've always hoped so)! However, you are right, it should be
> made easier to use vanilla libpcap, I'll add a configure switch (like
> --disable-internal-libpcap) to do so shortly.

Finally, it is --disable-custom-libpcap. It seems to work (at least for
me) after I have corrected a hidden dependency to my own version of
pcap_fileno (that I could remove now).

Simon

-- 
Here is what I've just committed to head:

Index: configure.ac
===================================================================
RCS file: /cvsroot/pandora/pandora/configure.ac,v
retrieving revision 1.2
diff -u -r1.2 configure.ac
--- configure.ac        24 Oct 2002 13:37:25 -0000      1.2
+++ configure.ac        3 Dec 2002 09:48:27 -0000
@@ -263,6 +263,20 @@
 AC_CHECK_LIB(kstat, kstat_open, LIBLOADAVG="-lkstat")
 AC_CHECK_LIB(kvm, kvm_read, LIBLOADAVG="-lkvm $LIBLOADAVG")

+AC_ARG_ENABLE(custom-libpcap,
+[  --disable-custom-libpcap  do not use custom libpcap [[default=no]]],
+test "x$enableval" = xno || enable_custom_libpcap=yes, 
enable_custom_libpcap=yes)
+if test "x$enable_custom_libpcap" != xyes; then
+   AC_CHECK_LIB(pcap, pcap_read, LIBPCAP="-lpcap", enable_custom_libpcap=yes)
+   if test "x$enable_custom_libpcap" = xyes; then
+   AC_MSG_WARN([libpcap not found, defaulting to custom version])
+   fi
+fi
+if test "$enable_custom_libpcap" = yes; then
+   CUSTOMLIBPCAP="$libpcap_dir/libpcap-pandora.la"
+   LIBPCAPDIR="libpcap"
+fi
+
 dnl **************************************************************************
 dnl Checks for installed packages.
 dnl **************************************************************************
@@ -348,6 +362,10 @@
 AC_SUBST(LIBSNMP)
 AC_SUBST(LIBGUILE)

+AC_SUBST(LIBPCAP)
+AC_SUBST(CUSTOMLIBPCAP)
+AC_SUBST(LIBPCAPDIR)
+
 AC_SUBST(static_flag)
 AC_SUBST(libpcap_dir)
 AC_SUBST(arch)
@@ -355,7 +373,9 @@
 AC_SUBST(LIBTOOL_DEPS)
 AC_SUBST(NM)

-AC_CONFIG_SUBDIRS(libpcap)
+if test "$enable_custom_libpcap" = yes; then
+   AC_CONFIG_SUBDIRS(libpcap)
+fi

 AC_CONFIG_FILES([Makefile rules/Makefile src/Makefile libpandora/Makefile 
libpandora/conf/Makefile pandora_components/Makefile doc/Makefile 
tests/Makefile src/Pandora.pm src/module.mk src/stacks])
 AC_OUTPUT
Index: pandora_components/pcaphandlercomponent.cc
===================================================================
RCS file: /cvsroot/pandora/pandora/pandora_components/pcaphandlercomponent.cc,v
retrieving revision 1.18
diff -u -r1.18 pcaphandlercomponent.cc
--- pandora_components/pcaphandlercomponent.cc  6 Sep 2002 17:44:25 -0000       
1.18
+++ pandora_components/pcaphandlercomponent.cc  3 Dec 2002 09:48:27 -0000
@@ -188,6 +188,7 @@
   bpf_u_int32 localnet, netmask;
   struct bpf_program fcode;
   char *ebuf;
+  bool from_file = false;

   mx.lock(); locked = true;
   ebuf=(char *)xmalloc(PCAP_ERRBUF_SIZE*sizeof(char));
@@ -205,6 +206,7 @@
       pandora_warning(ebuf);
       goto finished;
     }
+    from_file = true;

     localnet = 0;
     netmask = 0;
@@ -265,7 +267,11 @@

   updateStats();

-  return (pd != 0) ? pcap_fileno(pd) : ERROR_FILENO;
+  return ((pd != 0)
+         ? (from_file
+            ? fileno(pcap_file(pd))
+            : pcap_fileno(pd))
+         : ERROR_FILENO);
 }

 bool PcapHandlerComponent::process(void)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]