Hello community,

here is the log from the commit of package libpcap for openSUSE:Factory
checked in at Fri May 20 14:47:01 CEST 2011.



--------
--- libpcap/libpcap.changes     2011-05-12 09:08:16.000000000 +0200
+++ /mounts/work_src_done/STABLE/libpcap/libpcap.changes        2011-05-19 
16:13:33.000000000 +0200
@@ -1,0 +2,6 @@
+Thu May 19 14:12:36 UTC 2011 - pu...@novell.com
+
+- add libpcap-fix-calculation-of-frame-size.patch (bnc#694779)
+- clean up specfile
+
+-------------------------------------------------------------------

calling whatdependson for head-i586


New:
----
  libpcap-fix-calculation-of-frame-size.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libpcap.spec ++++++
--- /var/tmp/diff_new_pack.h2lAIY/_old  2011-05-20 14:46:26.000000000 +0200
+++ /var/tmp/diff_new_pack.h2lAIY/_new  2011-05-20 14:46:26.000000000 +0200
@@ -15,16 +15,15 @@
 # Please submit bugfixes or comments via http://bugs.opensuse.org/
 #
 
-# norootforbuild
 
 
 Name:           libpcap
 Version:        1.1.1
-Release:        7
-Group:          System/Libraries
+Release:        9
 License:        BSD3c(or similar)
-Url:            http://www.tcpdump.org/
 Summary:        A Library for Network Sniffers
+Url:            http://www.tcpdump.org/
+Group:          System/Libraries
 Source:         %{name}-%{version}.tar.bz2
 Source2:        baselibs.conf
 Patch0:         libpcap-1.0.0-filter-fix.patch
@@ -35,10 +34,11 @@
 Patch5:         libpcap-1.0.0-man.patch
 Patch6:         libpcap-1.0.0-mac_syntax.patch
 Patch7:         libpcap-1.1.1-scanif.patch
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+Patch8:         libpcap-fix-calculation-of-frame-size.patch
 BuildRequires:  bison
 BuildRequires:  bluez-devel
 BuildRequires:  flex
+BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 
 %description
 libpcap is a library used by packet sniffer programs. It provides an
@@ -46,21 +46,6 @@
 This package is only needed if you plan to compile or write such a
 program yourself.
 
-
-
-Authors:
---------
-    Bill Fenner <fen...@research.att.com>
-    Assar Westerlund <as...@sics.se>
-    Alexei <kuz...@ms2.inr.ac.ru>
-    Jun-ichiro itojun Hagino <ito...@iijlab.net>
-    Guy Harris <ghar...@flashcom.net>
-    Torsten Landschoff <t.landsch...@gmx.net>
-    Michael Richardson <m...@sandelman.ottawa.on.ca>
-    Steve McCanne
-    Craig Leres
-    Van Jacobson
-
 %package -n libpcap1
 License:        BSD3c(or similar)
 Summary:        A Library for Network Sniffers
@@ -81,21 +66,6 @@
 This package is only needed if you plan to compile or write such a
 program yourself.
 
-
-
-Authors:
---------
-    Bill Fenner <fen...@research.att.com>
-    Assar Westerlund <as...@sics.se>
-    Alexei <kuz...@ms2.inr.ac.ru>
-    Jun-ichiro itojun Hagino <ito...@iijlab.net>
-    Guy Harris <ghar...@flashcom.net>
-    Torsten Landschoff <t.landsch...@gmx.net>
-    Michael Richardson <m...@sandelman.ottawa.on.ca>
-    Steve McCanne
-    Craig Leres
-    Van Jacobson
-
 %package devel
 License:        BSD3c(or similar)
 Summary:        A Library for Network Sniffers
@@ -108,21 +78,6 @@
 This package is only needed if you plan to compile or write such a
 program yourself.
 
-
-
-Authors:
---------
-    Bill Fenner <fen...@research.att.com>
-    Assar Westerlund <as...@sics.se>
-    Alexei <kuz...@ms2.inr.ac.ru>
-    Jun-ichiro itojun Hagino <ito...@iijlab.net>
-    Guy Harris <ghar...@flashcom.net>
-    Torsten Landschoff <t.landsch...@gmx.net>
-    Michael Richardson <m...@sandelman.ottawa.on.ca>
-    Steve McCanne
-    Craig Leres
-    Van Jacobson
-
 %prep
 %setup -q
 %patch0
@@ -133,6 +88,7 @@
 %patch5
 %patch6
 %patch7
+%patch8 -p1
 
 %build
 %ifarch %sparc
@@ -140,17 +96,17 @@
 %else
 pic="pic"
 %endif
-export CFLAGS="$RPM_OPT_FLAGS -f$pic" CXXFLAGS="$RPM_OPT_FLAGS -f$pic"
+export CFLAGS="%{optflags} -f$pic" CXXFLAGS="%{optflags} -f$pic"
 %configure \
   --enable-ipv6
 make %{?_smp_mflags} all shared
 
 %install
-mkdir -p $RPM_BUILD_ROOT%{_bindir}
-make DESTDIR=$RPM_BUILD_ROOT install install-shared
+mkdir -p %{buildroot}%{_bindir}
+make DESTDIR=%{buildroot} install install-shared
 
 %clean
-rm -rf $RPM_BUILD_ROOT
+rm -rf %{buildroot}
 
 %post -n libpcap1 -p /sbin/ldconfig
 

++++++ libpcap-fix-calculation-of-frame-size.patch ++++++
>From ea9432fabdf4b33cbc76d9437200e028f1c47c93 Mon Sep 17 00:00:00 2001
From: Julien Moutinho <j...@savines.alpes.fr.eu.org>
Date: Tue, 22 Mar 2011 23:53:15 -0700
Subject: [PATCH] Fix the calculation of the frame size in memory-mapped 
captures.

The old calculation truncated packets to a smaller value than the
snapshot length.
---
 pcap-linux.c |   51 ++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 48 insertions(+), 3 deletions(-)

Index: libpcap-1.1.1/pcap-linux.c
===================================================================
--- libpcap-1.1.1.orig/pcap-linux.c
+++ libpcap-1.1.1/pcap-linux.c
@@ -3083,15 +3083,58 @@ create_ring(pcap_t *handle)
 {
        unsigned i, j, frames_per_block;
        struct tpacket_req req;
+       socklen_t len;
+       unsigned int sk_type, tp_reserve, maclen, tp_hdrlen, netoff, macoff;
 
        /* Note that with large snapshot (say 64K) only a few frames 
         * will be available in the ring even with pretty large ring size
         * (and a lot of memory will be unused). 
         * The snap len should be carefully chosen to achive best
         * performance */
-       req.tp_frame_size = TPACKET_ALIGN(handle->snapshot +
-                                         TPACKET_ALIGN(handle->md.tp_hdrlen) +
-                                         sizeof(struct sockaddr_ll));
+       
+       /* NOTE: calculus matching those in tpacket_rcv()
+        * in linux-2.6/net/packet/af_packet.c
+        */
+       len = sizeof(sk_type);
+       if (getsockopt(handle->fd, SOL_SOCKET, SO_TYPE, &sk_type, &len) < 0) {
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "getsockopt: %s", 
pcap_strerror(errno));
+               return -1;
+       }
+       len = sizeof(tp_reserve);
+       if (getsockopt(handle->fd, SOL_PACKET, PACKET_RESERVE, &tp_reserve, 
&len) < 0) {
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "getsockopt: %s", 
pcap_strerror(errno));
+               return -1;
+       }
+       maclen = (sk_type == SOCK_DGRAM) ? 0 : MAX_LINKHEADER_SIZE;
+               /* XXX: in the kernel maclen is calculated from
+                * LL_ALLOCATED_SPACE(dev) and vnet_hdr.hdr_len
+                * in:  packet_snd()           in 
linux-2.6/net/packet/af_packet.c
+                * then packet_alloc_skb()     in 
linux-2.6/net/packet/af_packet.c
+                * then sock_alloc_send_pskb() in linux-2.6/net/core/sock.c
+                * but I see no way to get those sizes in userspace,
+                * like for instance with an ifreq ioctl();
+                * the best thing I've found so far is MAX_HEADER in the kernel
+                * part of linux-2.6/include/linux/netdevice.h
+                * which goes up to 128+48=176; since pcap-linux.c defines
+                * a MAX_LINKHEADER_SIZE of 256 which is greater than that,
+                * let's use it.. maybe is it even large enough to directly
+                * replace macoff..
+                */
+       tp_hdrlen = TPACKET_ALIGN(handle->md.tp_hdrlen) + sizeof(struct 
sockaddr_ll) ;
+       netoff = TPACKET_ALIGN(tp_hdrlen + (maclen < 16 ? 16 : maclen)) + 
tp_reserve;
+               /* NOTE: AFAICS tp_reserve may break the TPACKET_ALIGN of
+                * netoff, which contradicts
+                * linux-2.6/Documentation/networking/packet_mmap.txt
+                * documenting that:
+                * "- Gap, chosen so that packet data (Start+tp_net)
+                * aligns to TPACKET_ALIGNMENT=16"
+                */
+               /* NOTE: in linux-2.6/include/linux/skbuff.h:
+                * "CPUs often take a performance hit
+                *  when accessing unaligned memory locations"
+                */
+       macoff = netoff - maclen;
+       req.tp_frame_size = TPACKET_ALIGN(macoff + handle->snapshot);
        req.tp_frame_nr = handle->opt.buffer_size/req.tp_frame_size;
 
        /* compute the minumum block size that will handle this frame. 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Remember to have fun...

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to