From owner-freebsd-net@FreeBSD.ORG Tue Jan 14 20:12:12 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 274C8AF4 for ; Tue, 14 Jan 2014 20:12:12 +0000 (UTC) Received: from mail-la0-x22d.google.com (mail-la0-x22d.google.com [IPv6:2a00:1450:4010:c03::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 91E581E79 for ; Tue, 14 Jan 2014 20:12:11 +0000 (UTC) Received: by mail-la0-f45.google.com with SMTP id b8so702695lan.4 for ; Tue, 14 Jan 2014 12:12:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=O1mUlO5hiHY3+Yy9xypmitThsd7kmS+CvIPkaKCPhNc=; b=a76j3aEJCiIiygErq4IzuAbdsiUIkUP+bMNriaGF/Xdn1+bRY4KoB+lq+D8CiyK8Zd v3C2amfER/TbmXqBShDI23GWGGaLs5CnOiyeL8xaBmfQSp5F90ScV4mhmFGEQiYjYKhg 8CJSTSqQQLuOvZQUHkxywlHrEVMKJdGqY9OTE0Aly/nToSa0lCxZ+addhB21BmlmPwf1 d2Dn54OJAVJkFSrYAza/TWZtKTX/KMqFcWhHG3Dr0pXx6YoWMNPzF1hpDqfZvmYOwklX pnlXEAWxQDrUeW+faSXduAy6cK3n/RCshR4bbrqtWEex4aLg6q3lboZdUB8u3XAiVg04 9qYA== MIME-Version: 1.0 X-Received: by 10.152.22.228 with SMTP id h4mr1603218laf.71.1389730329512; Tue, 14 Jan 2014 12:12:09 -0800 (PST) Sender: rizzo.unipi@gmail.com Received: by 10.114.175.180 with HTTP; Tue, 14 Jan 2014 12:12:09 -0800 (PST) Date: Tue, 14 Jan 2014 12:12:09 -0800 X-Google-Sender-Auth: whfPmnVAjBujD9lWgKouXnOjDS0 Message-ID: Subject: Fwd: netmap support for libpcap now available From: Luigi Rizzo To: "freebsd-net@freebsd.org" Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.17 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jan 2014 20:12:12 -0000 FYI. ---------- Forwarded message ---------- From: Luigi Rizzo Date: Tue, Jan 14, 2014 at 12:08 PM Subject: netmap support for libpcap now available To: tcpdump-workers@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 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