Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 175239 - Large file support in libpcap
Summary: Large file support in libpcap
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Daniel Black (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-19 16:14 UTC by Jeff Mitchell
Modified: 2008-04-01 21:45 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
ebuild patch: adds local useflag "largefiles" and enables libpcap to handle files >2GB (libpcap-0.9.8-r1.ebuild.patch,971 bytes, patch)
2008-01-29 13:36 UTC, Lothar Braun
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Mitchell 2007-04-19 16:14:44 UTC
libpcap, at least as built on a 32-bit, current Gentoo system does not use 64-bit file offsets.  This means that in the case (which is relatively common for me) that I find myself capturing more than 2GB of data, or opening a capture file with more than 2GB of data, tcpdump aborts.  There is an easy fix, and I'm going to propose it to upstream, but I hoped in the meantime it might make it into a Gentoo ebuild, as currently I'm maintaining my own to fix this problem.

Reproducible: Always

Steps to Reproduce:
1.Compile libpcap.  0.9.5 is current and displays this problem.
2.Capture more than 2GB of data (or try to open a >2GB capture file) with tcpdump.
3.tcpdump dies.




I've been fixing this by modifying the src_compile section to be the following...note that this is likely not the best way (a patch of the Makefile after configure is run, maybe?) and I'm not sure that both LARGEFILE_SOURCE and FILE_OFFSET_BITS=64 need to be defined, but it works at least.

src_compile() {
        econf $(use_enable ipv6) || die "bad configure"
        cd {$S}
        sed -i -e '47s/HAVE_CONFIG_H /HAVE_CONFIG_H -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64/' Makefile
        emake || die "compile problem"
Comment 1 Jeff Mitchell 2007-04-27 14:55:50 UTC
Here's a better way of doing this, using the largefile USE flag.  I don't know if that would be the preferred one, but as I have a bug open for the same thing with wireshark as well (as libpcap large file support doesn't affect it), I figure coordination might be good...that's bug #176251:

--- /usr/portage/net-libs/libpcap/libpcap-0.9.5.ebuild  2007-04-22 18:36:12.000000000 -0400
+++ libpcap-0.9.5.ebuild        2007-04-27 10:49:41.000000000 -0400
@@ -2,7 +2,7 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Header: /var/cvsroot/gentoo-x86/net-libs/libpcap/libpcap-0.9.5.ebuild,v 1.12 2007/04/22 22:14:42 kanaka Exp $

-inherit eutils multilib toolchain-funcs
+inherit flag-o-matic eutils multilib toolchain-funcs

 DESCRIPTION="A system-independent library for user-level network packet capture"
 HOMEPAGE="http://www.tcpdump.org/"
@@ -12,7 +12,7 @@
 LICENSE="BSD"
 SLOT="0"
 KEYWORDS="~alpha ~amd64 arm ~hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc ~sparc-fbsd x86 ~x86-fbsd"
-IUSE="ipv6"
+IUSE="ipv6 largefile"

 DEPEND="!virtual/libpcap"
 PROVIDE="virtual/libpcap"
@@ -38,6 +38,12 @@
                        die "LIBPCAP_PCAP is not set"
                fi
        fi
+
+       if use largefile; then
+               elog "Enabling >2GB file support"
+               append-flags -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
+       fi
+
        econf $(use_enable ipv6) ${MY_OPTS} || die "bad configure"
        emake || die "compile problem"
Comment 2 Daniel Black (RETIRED) gentoo-dev 2007-05-18 00:58:51 UTC
a better way is to put AC_SYS_LARGEFILE into configure.{ac|in}
Comment 3 James Pleger 2007-10-05 04:19:00 UTC
I see this on all 32bit installations even on current installs.
Comment 4 Jeff Mitchell 2007-10-26 22:38:16 UTC
Yeah, sucks, don't it.  2GB isn't that much traffic in these days of gigabit Ethernet connections everywhere.
Comment 5 Lothar Braun 2008-01-29 13:36:38 UTC
Created attachment 142115 [details, diff]
ebuild patch: adds local useflag "largefiles" and enables libpcap to handle files >2GB

This patch enables libpcap to handle files larger than 2 GB. I used Daniels tip from #2 (add AC_SYS_LARGEFILE to configure.in)
Comment 6 Peter Volkov (RETIRED) gentoo-dev 2008-01-30 17:46:20 UTC
Why do we need USE flag for largefile support? Why don't let configure to check and enable it if required?

BTW, this was added UPSTREAM:
http://cvs.tcpdump.org/cgi-bin/cvsweb/libpcap/configure.in?r1=1.138.2.4&r2=1.138.2.5
Comment 7 Daniel Black (RETIRED) gentoo-dev 2008-04-01 21:45:23 UTC
fixed in libpcap-0.9.8-r1