# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/net-libs/libpcap-ringbuffer/libpcap-ringbuffer-1.0.20050129-r2.ebuild,v 1.2 2005/06/11 13:41:09 dholm Exp $ inherit eutils toolchain-funcs linux-info multilib libtool autotools MY_P=${PN:0:7}-${PV} DESCRIPTION="A libpcap version which supports MMAP mode (ringbuffer) on the linux kernel 2.[46].x" HOMEPAGE="http://public.lanl.gov/cpw/" SRC_URI="${HOMEPAGE}${MY_P}.tar.gz" LICENSE="BSD" SLOT="0" KEYWORDS="~ppc ~x86 ~amd64" IUSE="ipv6" DEPEND="virtual/libc !virtual/libpcap" PROVIDE="virtual/libpcap" S=${WORKDIR}/${MY_P} # Used in linux-info to check minium Kernel support CONFIG_CHECK="PACKET_MMAP" PACKET_MMAP_ERROR="Make sure you have PACKET_MMAP compiled in your kernel to make use of libpcap's ringbuffer feature." src_unpack() { unpack ${A} cd ${S} } src_compile() { cd ${S} econf $(use_enable ipv6) --enable-shared --with-pcap=linux || die "bad configure" emake || die "compile problem" } src_install() { dodir /usr/include dodir /usr/$(get_libdir) emake DESTDIR=${D} install || die "install problem" dodoc CREDITS CHANGES FILES README* VERSION #Provide headders needed for apps like snort and tcpdump insopts -m 644 insinto /usr/include doins pcap.h || die "failed to install pcap.h" insinto /usr/include doins pcap-bpf.h || die "failed to install pcap-bpf.h" insinto /usr/include doins pcap-namedb.h || die "failed to install pcap-namedb.h" #Create symlinks simmular to the ones created by libpcap dosym libpcap-0.9.3.so /usr/$(get_libdir)/libpcap.so.0 dosym libpcap-0.9.3.so /usr/$(get_libdir)/libpcap.so #set PCAP_FRAMES=max echo 'PCAP_FRAMES=32768"' > 77ringbuffer doenvd 77ringbuffer } pkg_postinst() { echo einfo "Use of the ringbuffer requiers that the environment variable" einfo "PCAP_FRAMES= be set. This has automaticly been set to" echo einfo "PCAP_FRAMES=32768" echo einfo "This will set the size of the ring buffer to 32768" einfo "This will tie up at around 51 Mbytes of memory for" einfo "the ring buffer alone when capturing packets with" einfo "tools like tcpdump or snort." echo einfo "To change this, you should first read..." einfo "/usr/share/doc/${PF}/README.ring.gz" echo einfo "You can then change this environment variable by editing" einfo "/etc/env.d/77ringbuffer and then run" echo einfo "'env-update && source /etc/profile'" echo einfo "To continue to use libpcap-ringbuffer without the" einfo "ringbuffer, just set PCAP_FRAMES=0 in" einfo "/etc/env.d/77ringbuffer and then run " echo einfo "'env-update && source /etc/profile'" echo einfo "ethereal/tethereal will not use a ringbuffer. If" einfo "you use ethereal/tethereal you will need to start" einfo "them like so..." echo einfo "'PCAP_FRAMES=0 ethereal' or 'PCAP_FRAMES=0 tethereal'" echo }