Update to libpcap-1.7.2

Resolves: #1201078
This commit is contained in:
Michal Sekletar 2015-03-13 18:11:19 +01:00
parent 0fe9e420bd
commit e659b3950b
4 changed files with 7 additions and 75 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@ libpcap-1.1.1.tar.gz
/libpcap-1.5.1.tar.gz
/libpcap-1.5.3.tar.gz
/libpcap-1.6.2.tar.gz
/libpcap-1.7.2.tar.gz

View File

@ -1,71 +0,0 @@
From 6a9c2cb19cb7eebdab8d2fa7a592d39130f8bf61 Mon Sep 17 00:00:00 2001
From: Guy Harris <guy@alum.mit.edu>
Date: Mon, 1 Dec 2014 13:53:01 -0800
Subject: [PATCH] Fix scaling of time stamps.
Addresses GitHub issue #396.
---
sf-pcap-ng.c | 29 +++++++++++++++++++++--------
1 file changed, 21 insertions(+), 8 deletions(-)
diff --git a/sf-pcap-ng.c b/sf-pcap-ng.c
index fae4086..ea62157 100644
--- a/sf-pcap-ng.c
+++ b/sf-pcap-ng.c
@@ -1210,10 +1210,16 @@ found:
}
/*
- * Convert the time stamp to a struct timeval.
+ * Convert the time stamp to seconds and fractions of a second,
+ * with the fractions being in units of the file-supplied resolution.
*/
sec = t / ps->ifaces[interface_id].tsresol + ps->ifaces[interface_id].tsoffset;
frac = t % ps->ifaces[interface_id].tsresol;
+
+ /*
+ * Convert the fractions from units of the file-supplied resolution
+ * to units of the user-requested resolution.
+ */
switch (ps->ifaces[interface_id].scale_type) {
case PASS_THROUGH:
@@ -1227,21 +1233,28 @@ found:
case SCALE_DOWN:
/*
* The interface resolution is different from what the
- * user wants; scale up or down to that resolution.
+ * user wants; convert the fractions to units of the
+ * resolution the user requested by multiplying by the
+ * quotient of the user-requested resolution and the
+ * file-supplied resolution. We do that by multiplying
+ * by the user-requested resolution and dividing by the
+ * file-supplied resolution, as the quotient might not
+ * fit in an integer.
*
* XXX - if ps->ifaces[interface_id].tsresol is a power
* of 10, we could just multiply by the quotient of
- * ps->ifaces[interface_id].tsresol and ps->user_tsresol
- * in the scale-up case, and divide by the quotient of
* ps->user_tsresol and ps->ifaces[interface_id].tsresol
- * in the scale-down case, as we know those are integers,
- * which would involve fewer arithmetic operations.
+ * in the scale-up case, and divide by the quotient of
+ * ps->ifaces[interface_id].tsresol and ps->user_tsresol
+ * in the scale-down case, as we know those will be integers.
+ * That would involve fewer arithmetic operations, and
+ * would run less risk of overflow.
*
* Is there something clever we could do if
* ps->ifaces[interface_id].tsresol is a power of 2?
*/
- frac *= ps->ifaces[interface_id].tsresol;
- frac /= ps->user_tsresol;
+ frac *= ps->user_tsresol;
+ frac /= ps->ifaces[interface_id].tsresol;
break;
}
hdr->ts.tv_sec = sec;
--
1.8.3.1

View File

@ -1,7 +1,7 @@
Name: libpcap
Epoch: 14
Version: 1.6.2
Release: 2%{?dist}
Version: 1.7.2
Release: 1%{?dist}
Summary: A system-independent interface for user-level packet capture
Group: Development/Libraries
License: BSD with advertising
@ -14,7 +14,6 @@ Patch0001: 0001-man-tcpdump-and-tcpslice-have-manpages-in-man8.patch
Patch0002: 0002-pcap-config-mitigate-multilib-conflict.patch
Patch0003: 0003-pcap-linux-apparently-ctc-interfaces-on-s390-has-eth.patch
Patch0004: 0004-pcap-linux-don-t-use-TPACKETV3-for-memory-mmapped-ca.patch
Patch0005: 0005-Fix-scaling-of-time-stamps.patch
%description
Libpcap provides a portable framework for low-level network
@ -84,6 +83,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libpcap.a
%{_mandir}/man5/pcap*.5*
%changelog
* Fri Mar 13 2015 Michal Sekletar <msekleta@redhat.com> - 14:1.7.2-1
- update to 1.7.2 (#1201078)
* Mon Feb 23 2015 Michal Sekletar <msekleta@redhat.com> - 14:1.6.2-2
- fix scaling of pcap-ng timestamps (#1169322)
- remove kernel-devel from buildrequires

View File

@ -1 +1 @@
5f14191c1a684a75532c739c2c4059fa libpcap-1.6.2.tar.gz
4747281d4e3ebdb78bc88cdccd3ca5f7 libpcap-1.7.2.tar.gz