Merged update from upstream sources

This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/libpcap.git#3f9e3fb2c7973198953612b50228c34ada3924cc
This commit is contained in:
DistroBaker 2021-02-11 17:01:01 +00:00
parent c1b5293e32
commit d210a6f8c0
7 changed files with 18 additions and 156 deletions

1
.gitignore vendored
View File

@ -15,3 +15,4 @@ libpcap-1.1.1.tar.gz
/libpcap-1.8.1.tar.gz
/libpcap-1.9.0.tar.gz
/libpcap-1.9.1.tar.gz
/libpcap-1.10.0.tar.gz

View File

@ -1,77 +0,0 @@
From 661a9057b123e794897c8957c29530a5f428ec7b Mon Sep 17 00:00:00 2001
From: Jakub Sitnicki <jsitnicki@gmail.com>
Date: Thu, 26 Mar 2015 22:35:29 +0100
Subject: [PATCH] Fix building Bluetooth Linux Monitor support with BlueZ 5.1+
Starting from version 5.1 BlueZ no longer exports the mgmt.h header
or any other header that declares the structure of packets passed
over HCI sockets set to use the HCI monitor channel.
Declare the structure locally and give it the same name as in the
Linux kernel 3.4+.
---
pcap-bt-monitor-linux.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/pcap-bt-monitor-linux.c b/pcap-bt-monitor-linux.c
index f193e26..b18bdca 100644
--- a/pcap-bt-monitor-linux.c
+++ b/pcap-bt-monitor-linux.c
@@ -34,12 +34,12 @@
#endif
#include <errno.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
-#include <bluetooth/mgmt.h>
#include "pcap/bluetooth.h"
#include "pcap-int.h"
@@ -49,6 +49,16 @@
#define BT_CONTROL_SIZE 32
#define INTERFACE_NAME "bluetooth-monitor"
+/*
+ * Fields and alignment must match the declaration in the Linux kernel 3.4+.
+ * See struct hci_mon_hdr in include/net/bluetooth/hci_mon.h.
+ */
+struct hci_mon_hdr {
+ uint16_t opcode;
+ uint16_t index;
+ uint16_t len;
+} __attribute__((packed));
+
int
bt_monitor_findalldevs(pcap_if_t **alldevsp, char *err_str)
{
@@ -72,12 +82,12 @@ bt_monitor_read(pcap_t *handle, int max_packets _U_, pcap_handler callback, u_ch
ssize_t ret;
struct pcap_pkthdr pkth;
pcap_bluetooth_linux_monitor_header *bthdr;
- struct mgmt_hdr hdr;
+ struct hci_mon_hdr hdr;
bthdr = (pcap_bluetooth_linux_monitor_header*) &handle->buffer[handle->offset];
iv[0].iov_base = &hdr;
- iv[0].iov_len = MGMT_HDR_SIZE;
+ iv[0].iov_len = sizeof(hdr);
iv[1].iov_base = &handle->buffer[handle->offset + sizeof(pcap_bluetooth_linux_monitor_header)];
iv[1].iov_len = handle->snapshot;
@@ -103,7 +113,7 @@ bt_monitor_read(pcap_t *handle, int max_packets _U_, pcap_handler callback, u_ch
return -1;
}
- pkth.caplen = ret - MGMT_HDR_SIZE + sizeof(pcap_bluetooth_linux_monitor_header);
+ pkth.caplen = ret - sizeof(hdr) + sizeof(pcap_bluetooth_linux_monitor_header);
pkth.len = pkth.caplen;
for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
--
2.4.0

View File

@ -10,18 +10,19 @@ Both should be run only by root, hence manpages for them should be located in
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pcap.3pcap.in b/pcap.3pcap.in
index f5a7e0c..f220e68 100644
index 492c227..46a2a4b 100644
--- a/pcap.3pcap.in
+++ b/pcap.3pcap.in
@@ -882,7 +882,7 @@ use an
script or some other configuration script to check whether the libpcap
@@ -1025,8 +1025,8 @@ script or some other configuration script to check whether the libpcap
1.0 APIs are available and use them only if they are.
.SH SEE ALSO
-autoconf(1), tcpdump(1), tcpslice(1), pcap-filter(@MAN_MISC_INFO@), pfconfig(8),
+autoconf(1), tcpdump(8), tcpslice(8), pcap-filter(@MAN_MISC_INFO@), pfconfig(8),
usermod(@MAN_ADMIN_COMMANDS@)
.SH AUTHORS
The original authors of libpcap are:
.BR autoconf (1),
-.BR tcpdump (1),
-.BR tcpslice (1),
+.BR tcpdump (8),
+.BR tcpslice (8),
.BR pcap-filter (@MAN_MISC_INFO@),
.BR pfconfig (8),
.BR usermod (@MAN_ADMIN_COMMANDS@)
--
1.8.3.1

View File

@ -13,7 +13,7 @@ index 900ebbc..58292c3 100644
--- a/pcap-linux.c
+++ b/pcap-linux.c
@@ -3197,6 +3197,10 @@ activate_new(pcap_t *handle)
handle->linktype = DLT_LINUX_SLL;
}
}
+ /* Hack to make things work on s390 ctc interfaces */

View File

@ -1,65 +0,0 @@
From 907070918d5e81a515315b395f334e52589fe0fb Mon Sep 17 00:00:00 2001
From: Guy Harris <guy@alum.mit.edu>
Date: Wed, 18 Dec 2019 15:06:53 -0800
Subject: [PATCH] Check for invalid IPv4 addresses.
This should fix GitHub issue #893.
---
gencode.c | 9 ++++++++-
nametoaddr.c | 9 ++++++++-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/gencode.c b/gencode.c
index bdc35e646..040a55315 100644
--- a/gencode.c
+++ b/gencode.c
@@ -6947,11 +6947,15 @@ gen_mcode(compiler_state_t *cstate, const char *s1, const char *s2,
return (NULL);
nlen = __pcap_atoin(s1, &n);
+ if (nlen < 0)
+ bpf_error(cstate, "invalid IPv4 address '%s'", s1);
/* Promote short ipaddr */
n <<= 32 - nlen;
if (s2 != NULL) {
mlen = __pcap_atoin(s2, &m);
+ if (mlen < 0)
+ bpf_error(cstate, "invalid IPv4 address '%s'", s2);
/* Promote short ipaddr */
m <<= 32 - mlen;
if ((n & ~m) != 0)
@@ -7009,8 +7013,11 @@ gen_ncode(compiler_state_t *cstate, const char *s, bpf_u_int32 v, struct qual q)
vlen = __pcap_atodn(s, &v);
if (vlen == 0)
bpf_error(cstate, "malformed decnet address '%s'", s);
- } else
+ } else {
vlen = __pcap_atoin(s, &v);
+ if (vlen < 0)
+ bpf_error(cstate, "invalid IPv4 address '%s'", s);
+ }
switch (q.addr) {
diff --git a/nametoaddr.c b/nametoaddr.c
index 53070a285..13bf4c683 100644
--- a/nametoaddr.c
+++ b/nametoaddr.c
@@ -674,8 +674,15 @@ __pcap_atoin(const char *s, bpf_u_int32 *addr)
len = 0;
for (;;) {
n = 0;
- while (*s && *s != '.')
+ while (*s && *s != '.') {
+ if (n > 25) {
+ /* The result will be > 255 */
+ return -1;
+ }
n = n * 10 + *s++ - '0';
+ }
+ if (n > 255)
+ return -1;
*addr <<= 8;
*addr |= n & 0xff;
len += 8;

View File

@ -1,7 +1,7 @@
Name: libpcap
Epoch: 14
Version: 1.9.1
Release: 7%{?dist}
Version: 1.10.0
Release: 1%{?dist}
Summary: A system-independent interface for user-level packet capture
License: BSD with advertising
URL: https://www.tcpdump.org/
@ -23,7 +23,6 @@ Source: https://www.tcpdump.org/release/%{name}-%{version}.tar.gz
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-invalid-ipv4.patch
%description
Libpcap provides a portable framework for low-level network
@ -93,6 +92,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libpcap.a
%{_mandir}/man5/pcap*.5*
%changelog
* Thu Feb 11 2021 Michal Ruprich <mruprich@redhat.com> - 14:1.10.0-1
- New version 1.10.0
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 14:1.9.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

View File

@ -1 +1 @@
SHA512 (libpcap-1.9.1.tar.gz) = ae0d6b0ad8253e7e059336c0f4ed3850d20d7d2f4dc1d942c2951f99a5443a690f0cc42c6f8fdc4a0ccb19e9e985192ba6f399c4bde2c7076e420f547fddfb08
SHA512 (libpcap-1.10.0.tar.gz) = 007710386ff3435ef97fc99293076eae3c39b424e986141184c712b0285f8589357a1b25085f7eba28730de04312042c724d193934a399797e95a56f5301da7f