libpcap: import current stable from upstream Gentoo
BUG=None
TEST=rebuilt x86-alex/amd64-generic; booted x86-alex
Change-Id: Ifb904eaf4c0a0f931444d204233c499da3bfbbd3
Reviewed-on: http://gerrit.chromium.org/gerrit/7098
Reviewed-by: Nathan J. Williams <njw@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/net-libs/libpcap/files/libpcap-1.1-cross-linux.patch b/net-libs/libpcap/files/libpcap-1.1-cross-linux.patch
new file mode 100644
index 0000000..5a35a89
--- /dev/null
+++ b/net-libs/libpcap/files/libpcap-1.1-cross-linux.patch
@@ -0,0 +1,30 @@
+=== modified file 'configure.in'
+--- configure.in 2010-04-02 04:52:17 +0000
++++ configure.in 2010-04-02 04:52:22 +0000
+@@ -291,7 +291,12 @@
+ dnl XXX This could be done for cross-compiling, but for now it's not.
+ dnl
+ if test -z "$with_pcap" && test "$cross_compiling" = yes; then
+- AC_MSG_ERROR(pcap type not determined when cross-compiling; use --with-pcap=...)
++ if test -z "$with_pcap" ; then
++ case $host in
++ *-linux*) with_pcap="linux";;
++ *) AC_MSG_ERROR(pcap type not determined when cross-compiling; use --with-pcap=...);;
++ esac
++ fi
+ fi
+ AC_ARG_WITH(pcap,
+ AC_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE]))
+@@ -412,8 +417,10 @@
+ linux)
+ AC_MSG_CHECKING(Linux kernel version)
+ if test "$cross_compiling" = yes; then
++ dnl we could check linux/version.h here, but who runs
++ dnl versions of linux older than 2.0.x anymore to bother ?
+ AC_CACHE_VAL(ac_cv_linux_vers,
+- ac_cv_linux_vers=unknown)
++ ac_cv_linux_vers=2)
+ else
+ AC_CACHE_VAL(ac_cv_linux_vers,
+ ac_cv_linux_vers=`uname -r 2>&1 | \
+
diff --git a/net-libs/libpcap/files/libpcap-1.1.1-ignore-ENODEV.patch b/net-libs/libpcap/files/libpcap-1.1.1-ignore-ENODEV.patch
new file mode 100644
index 0000000..3dcbcae
--- /dev/null
+++ b/net-libs/libpcap/files/libpcap-1.1.1-ignore-ENODEV.patch
@@ -0,0 +1,36 @@
+commit 073a8b37f97b684a34d29800400879e4e902ff63
+Author: andy-1 <andy-1@sourceforge.net>
+Date: Tue Apr 27 23:33:23 2010 -0700
+
+ Ignore /sys/net/dev files if we get ENODEV for them, not just ENXIO.
+
+ Both of them are indications that there's no such interface, so the file
+ probably corresponds to something other than a device.
+
+ Reviewed-By: Guy Harris <guy@alum.mit.edu>
+
+diff --git a/CREDITS b/CREDITS
+index 0d23783..6efc188 100644
+--- a/CREDITS
++++ b/CREDITS
+@@ -15,6 +15,7 @@ Additional people who have contributed patches:
+ Alexey Kuznetsov <kuznet at ms2 dot inr dot ac dot ru>
+ Alon Bar-Lev <alonbl at sourceforge dot net>
+ Andrew Brown <atatat at atatdot dot net>
++ <andy-1 at sourceforge dot net>
+ Antti Kantee <pooka at netbsd dot org>
+ Arien Vijn <arienvijn at sourceforge dot net>
+ Arkadiusz Miskiewicz <misiek at pld dot org dot pl>
+diff --git a/pcap-linux.c b/pcap-linux.c
+index af12543..de3239a 100644
+--- a/pcap-linux.c
++++ b/pcap-linux.c
+@@ -1883,7 +1883,7 @@ scan_sys_class_net(pcap_if_t **devlistp, char *errbuf)
+ */
+ strncpy(ifrflags.ifr_name, name, sizeof(ifrflags.ifr_name));
+ if (ioctl(fd, SIOCGIFFLAGS, (char *)&ifrflags) < 0) {
+- if (errno == ENXIO)
++ if (errno == ENXIO || errno == ENODEV)
+ continue;
+ (void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
+ "SIOCGIFFLAGS: %.*s: %s",
diff --git a/net-libs/libpcap/libpcap-1.1.1-r1.ebuild b/net-libs/libpcap/libpcap-1.1.1-r1.ebuild
new file mode 100644
index 0000000..0493f6c
--- /dev/null
+++ b/net-libs/libpcap/libpcap-1.1.1-r1.ebuild
@@ -0,0 +1,53 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-libs/libpcap/libpcap-1.1.1-r1.ebuild,v 1.4 2011/08/11 02:35:58 vapier Exp $
+
+EAPI=2
+inherit autotools eutils multilib toolchain-funcs
+
+DESCRIPTION="A system-independent library for user-level network packet capture"
+HOMEPAGE="http://www.tcpdump.org/"
+SRC_URI="http://www.tcpdump.org/release/${P}.tar.gz
+ http://www.jp.tcpdump.org/release/${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris"
+IUSE="bluetooth ipv6 libnl"
+
+RDEPEND="bluetooth? ( net-wireless/bluez )
+ libnl? ( dev-libs/libnl )"
+DEPEND="${RDEPEND}
+ sys-devel/flex
+ virtual/yacc"
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-1.1-cross-linux.patch"
+ epatch "${FILESDIR}/${P}-ignore-ENODEV.patch"
+ # Force usbmon device to avoid #318359
+ sed 's:\(ac_usb_dev_name=\).*udevinfo.*:\1"usbmon":' -i configure.in || die
+ eautoreconf
+}
+
+src_configure() {
+ econf $(use_enable ipv6) \
+ $(use_with libnl) \
+ $(use_enable bluetooth)
+}
+
+src_compile() {
+ emake all shared || die "compile problem"
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "emake install failed"
+
+ # We need this to build pppd on G/FBSD systems
+ if [[ "${USERLAND}" == "BSD" ]]; then
+ insinto /usr/include
+ doins pcap-int.h || die "failed to install pcap-int.h"
+ fi
+
+ # We are not installing README.{Win32,aix,hpux,tru64} (bug 183057)
+ dodoc CREDITS CHANGES VERSION TODO README{,.dag,.linux,.macosx,.septel} || die
+}