Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not compile PF_RING DNA version of libpcap #81

Closed
fklassen opened this issue May 24, 2014 · 7 comments · Fixed by #116
Closed

Does not compile PF_RING DNA version of libpcap #81

fklassen opened this issue May 24, 2014 · 7 comments · Fixed by #116
Assignees
Milestone

Comments

@fklassen
Copy link
Member

As per Luca Deri, the patch below should allow wire-rate TX with PF_RING DNA via the following sample command:

configure --with-libpcap=3D$HOME/PF_RING/userland/libpcap-1.1.1-ring
deri@iMacLuca 183> diff configure.ac ~/tcpreplay-4.0.3/configure.ac=20
290a291,294
> dnl Force libpcap usage
> force_pcap=3Dno
> AC_ARG_ENABLE(force_pcap, AC_HELP_STRING([--enable-force_pcap], [Force li=
bpcap usage]))
>=20
376a381
>     force_pcap=3Dyes
858a864
> if test "${force_pcap}" =3D "no"; then :
946a953,954
> fi
> =
@fklassen fklassen added this to the 4.0.5 milestone May 24, 2014
@fklassen fklassen self-assigned this May 24, 2014
@fklassen fklassen changed the title Does not compile PF_RING DNA Does not compile PF_RING DNA version of libpcap May 24, 2014
@fklassen
Copy link
Member Author

Patch from Luca with improved formatting. Also added README for PF_RING install:

git diff configure.ac 
diff --git a/configure.ac b/configure.ac
index b74fb47..1a5a82e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -320,6 +320,9 @@ AC_ARG_ENABLE(force-sendpacket,
     AC_HELP_STRING([--enable-force-sendpacket], [Force using libpcap's pcap_sendpacket() for sending packets]),
     [ AC_DEFINE([FORCE_INJECT_PCAP_SENDPACKET], [1], [Force using libpcap's pcap_sendpacket() for sending packets])])

+force_pcap=no
+AC_ARG_ENABLE(force_pcap, AC_HELP_STRING([--enable-force_pcap], [Force libpcap usage]))
+
 dnl Dynamic link libraries
 dynamic_link=no
 AC_ARG_ENABLE(dynamic-link,
@@ -374,6 +377,7 @@ AC_ARG_WITH(libpcap,
     AC_HELP_STRING([--with-libpcap=DIR], 
         [Use libpcap in DIR]),
 [
+    force_pcap=yes
     trypcapdir=$withval
     for testdir in ${withval} ${withval}/include ; do
            if test -f "${testdir}/pcap.h" -a $foundpcap = no ; then
@@ -896,6 +900,7 @@ if test "$have_netmap" != no ; then
 fi
 CPPFLAGS="$OLDCPPFLAGS"

+if test "${force_pcap}" = "no"; then :
 have_pf=no
 dnl Check for linux PF_PACKET support
 AC_MSG_CHECKING(for PF_PACKET socket sending support)
@@ -983,6 +988,7 @@ if test $have_bpf = yes ; then
     AC_DEFINE([HAVE_BPF], [1], 
             [Do we have BPF device support?])
 fi
+fi

 dnl ##################################################
 dnl # Check for libdnet, but only if not Cygwin! 
How to compile tcpreply with PF_RING
------------------------------------

1. Download and compile PF_RING. We assume that you have stored
   into /home/user/ (i.e. /home/user/PF_RING/....)

2. Create a "fat" libpcap library that contains both the pcap and pf_ring library
   cd /home/user/PF_RING/userland/libpcap
   ./mkFatLibpcap.sh

3. Make sure you have installed the libnl-dev required by libpcap.
   Example on Ubuntu/Debian do: apt-get install libnl-dev

4. In your tcpreplay directory do
   ./autogen.sh 
   ./configure --with-libpcap=/home/user/PF_RING/userland/libpcap-1.1.1-ring/

@fklassen
Copy link
Member Author

Update configure.ac to automatically detect PF_RING version of libpcap, compile properly. Added updates to include proper PF_RING in version info.

@fklassen
Copy link
Member Author

fklassen commented Aug 9, 2014

Report from nTop dev team:

Using the libpcap of pfring svn code from http://www.ntop.org/get-started/download/:

cd PF_RING/userland/libpcap
make 
make install

and then

checking for numa_available in -lnuma... yes
checking for pthread_create in -lpthread... yes
checking for library containing pcap_get_pfring_id... no
checking for library containing pcap_close... no
configure: error: Unable to link libpcap in /usr/local

@nickwallen
Copy link

Are up-to-date instructions documented anywhere else besides this issue? I have been looking, but have not found any.

@fklassen
Copy link
Member Author

No need to document different flavors oflibpcap. PF_RING implemented in libpcap makes its use transparent.

Help for the ./configure --with-libpcap= is available with ./configure -h

@nickwallen
Copy link

Many thanks @fklassen. I opened #395 with a more detailed question on this topic.

@nickwallen
Copy link

@fklassen Even if the documentation says something to that effect, it would be helpful to users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants