From 2bd0e305dbcc49234d417ba0dda16f79feab9126 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Aug 01 2017 03:52:51 +0000 Subject: import libpcap-1.5.3-9.el7 --- diff --git a/SOURCES/0006-Bound-tpacketv2-to-64k.patch b/SOURCES/0006-Bound-tpacketv2-to-64k.patch new file mode 100644 index 0000000..10f7614 --- /dev/null +++ b/SOURCES/0006-Bound-tpacketv2-to-64k.patch @@ -0,0 +1,67 @@ +From d8aade59b5787f5d3517fededcd684fe85367afa Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Mon, 29 May 2017 11:54:43 +0200 +Subject: [PATCH] Backport patch to bound tpacketv2 to 64k + +--- + pcap-linux.c | 29 ++++++++++++++++++----------- + 1 file changed, 18 insertions(+), 11 deletions(-) + +diff --git a/pcap-linux.c b/pcap-linux.c +index f7f2aae..d7149d5 100644 +--- a/pcap-linux.c ++++ b/pcap-linux.c +@@ -3600,6 +3600,8 @@ prepare_tpacket_socket(pcap_t *handle) + return 1; + } + ++#define MAX(a,b) ((a)>(b)?(a):(b)) ++ + /* + * Attempt to set up memory-mapped access. + * +@@ -3674,25 +3676,30 @@ create_ring(pcap_t *handle, int *status) + * "packets" bigger than the MTU. */ + frame_size = handle->snapshot; + if (handle->linktype == DLT_EN10MB) { ++ unsigned int max_frame_len; + int mtu; + int offload; + ++ mtu = iface_get_mtu(handle->fd, handle->opt.source, ++ handle->errbuf); ++ if (mtu == -1) { ++ *status = PCAP_ERROR; ++ return -1; ++ } + offload = iface_get_offload(handle); + if (offload == -1) { + *status = PCAP_ERROR; + return -1; + } +- if (!offload) { +- mtu = iface_get_mtu(handle->fd, handle->opt.source, +- handle->errbuf); +- if (mtu == -1) { +- *status = PCAP_ERROR; +- return -1; +- } +- if (frame_size > mtu + 18) +- frame_size = mtu + 18; +- } +- } ++ if (offload) ++ max_frame_len = MAX(mtu, 65535); ++ else ++ max_frame_len = mtu; ++ max_frame_len += 18; ++ ++ if (frame_size > max_frame_len) ++ frame_size = max_frame_len; ++ } + + /* NOTE: calculus matching those in tpacket_rcv() + * in linux-2.6/net/packet/af_packet.c +-- +2.13.0 + diff --git a/SPECS/libpcap.spec b/SPECS/libpcap.spec index ceab764..83588cf 100644 --- a/SPECS/libpcap.spec +++ b/SPECS/libpcap.spec @@ -1,7 +1,7 @@ Name: libpcap Epoch: 14 Version: 1.5.3 -Release: 8%{?dist} +Release: 9%{?dist} Summary: A system-independent interface for user-level packet capture Group: Development/Libraries License: BSD with advertising @@ -26,6 +26,7 @@ Patch14: 0005-Move-the-socket-ops-out-of-gencode.c.patch Patch15: 0001-Add-names-for-DLT_NETLINK.patch Patch16: 0001-Fix-link-type-for-nlmon.patch Patch17: 0001-bpf-make-sure-sll-header-size-if-accounted-for.patch +Patch18: 0006-Bound-tpacketv2-to-64k.patch %description @@ -95,6 +96,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libpcap.a %{_mandir}/man5/pcap*.5* %changelog +* Mon May 29 2017 Martin Sehnoutka - 14:1.5.3-9 +- Bound packet size to 64k + * Tue Sep 15 2015 Michal Sekletar - 14:1.5.3-8 - make sure that sll header size is accounted for (#1176612)