Fwd: netmap support for libpcap now available

Luigi Rizzo rizzo at iet.unipi.it
Tue Jan 14 20:12:12 UTC 2014


FYI.

---------- Forwarded message ----------
From: Luigi Rizzo <rizzo at iet.unipi.it>
Date: Tue, Jan 14, 2014 at 12:08 PM
Subject: netmap support for libpcap now available
To: tcpdump-workers at lists.tcpdump.org


since there were no takers i went ahead and did it.

The repo at  http://code.google.com/p/netmap/ has been
updated with a newer version of netmap, and the extra/
directory contains a netmap backend for libpcap
https://code.google.com/p/netmap/source/browse/extra/libpcap-netmap.diff

which works against a recent (Jan11) libpcap version from github

https://github.com/the-tcpdump-group/libpcap/commits/master

commit fd04c4ff9f9a6b50fccec7afb18af64433730a2b
Author: Guy Harris <guy at alum.mit.edu>
Date:   Sat Jan 11 20:38:02 2014 -0800

For some quick testing (linux; FreeBSD is similar):

- download the netmap code from code.google.com/p/netmap/

- compile just the netmap module and the examples

   (cd LINUX; make NODRIVERS=1 )
   (cd examples; make)

- install the module
   (cd LINUX; sudo insmod ./netmap_lin.ko)
  (either change access privs to /dev/netmap, or
  run netmap clients with root privs)

- fetch the pcap code

- patch with the netmap support files

   cd pcap-base-code;
   patch -p1 < /wherever/is/the/netmap-base-dir/extra/libpcap-netmap-diff )

- make sure the netmap headers are accessible and rebuild libpcap

   export CFLAGS=-I/wherever/is/the/netmap-base-dir/sys
   ./configure
   make

- create a link so ld will find it
   ln -s libpcap.so.1.6.0-PRE-GIT libpcap.so.0.8

- and now you can run tcpdump using the current library
  (depending on the OS you may need to tell apparmor to
  allow the library override for tcpdump, or make a non suid
  copy of tcpdump)

   LD_LIBRARY_PATH=. tcpdump -ni valexx:yy

   while in another window you run a netmap traffic generator

   /wherever/is/the/netmap-base-dir/pkt-gen -i valexx:zz -f tx

You can access an ordinary interface in emulated netmap mode by
prefixing the name with netmap: , but BEWARE:
*** in this mode the interface is only used for capture,
*** and goes back to regular mode when you exit the tcpdump

   LD_LIBRARY_PATH=. tcpdump -ni netmap:eth0

cheers
luigi


More information about the freebsd-net mailing list