Accepting request 222227 from home:vitezslav_cizek:branches:Base:System
- added support for netlink (bnc#863823) * libpcap-netlink.patch - update to 1.5.3 * Don't let packets that don't match the current filter get to the application when TPACKET_V3 is used. (GitHub issue #331) * Fix handling of pcap_loop()/pcap_dispatch() with a packet count of 0 on some platforms (including Linux with TPACKET_V3). (GitHub issue #333) * Work around TPACKET_V3 deficiency that causes packets to be lost when a timeout of 0 is specified. (GitHub issue #335) * Man page formatting fixes. - refreshed libpcap-1.5.2-filter-fix.patch OBS-URL: https://build.opensuse.org/request/show/222227 OBS-URL: https://build.opensuse.org/package/show/Base:System/libpcap?expand=0&rev=36
This commit is contained in:
parent
1177f467e1
commit
6ef0670f31
@ -3,10 +3,10 @@
|
|||||||
pcap-linux.c | 22 ++++++++++++++++++++++
|
pcap-linux.c | 22 ++++++++++++++++++++++
|
||||||
2 files changed, 23 insertions(+), 1 deletion(-)
|
2 files changed, 23 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
Index: libpcap-1.5.2/pcap-bpf.c
|
Index: libpcap-1.5.3/pcap-bpf.c
|
||||||
===================================================================
|
===================================================================
|
||||||
--- libpcap-1.5.2.orig/pcap-bpf.c 2013-11-07 23:23:22.000000000 +0000
|
--- libpcap-1.5.3.orig/pcap-bpf.c 2014-02-13 17:22:30.794295046 +0100
|
||||||
+++ libpcap-1.5.2/pcap-bpf.c 2013-12-14 11:28:40.000000000 +0000
|
+++ libpcap-1.5.3/pcap-bpf.c 2014-02-13 17:22:31.667305231 +0100
|
||||||
@@ -494,7 +494,7 @@ bpf_open(pcap_t *p)
|
@@ -494,7 +494,7 @@ bpf_open(pcap_t *p)
|
||||||
fd = open(device, O_RDWR);
|
fd = open(device, O_RDWR);
|
||||||
if (fd == -1 && errno == EACCES)
|
if (fd == -1 && errno == EACCES)
|
||||||
@ -16,11 +16,11 @@ Index: libpcap-1.5.2/pcap-bpf.c
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* XXX better message for all minors used
|
* XXX better message for all minors used
|
||||||
Index: libpcap-1.5.2/pcap-linux.c
|
Index: libpcap-1.5.3/pcap-linux.c
|
||||||
===================================================================
|
===================================================================
|
||||||
--- libpcap-1.5.2.orig/pcap-linux.c 2013-12-03 15:11:24.000000000 +0000
|
--- libpcap-1.5.3.orig/pcap-linux.c 2014-02-13 17:22:31.668305243 +0100
|
||||||
+++ libpcap-1.5.2/pcap-linux.c 2013-12-14 11:30:29.000000000 +0000
|
+++ libpcap-1.5.3/pcap-linux.c 2014-02-13 17:24:01.924357989 +0100
|
||||||
@@ -2475,8 +2475,30 @@ pcap_setfilter_linux_common(pcap_t *hand
|
@@ -2476,11 +2476,33 @@ pcap_setfilter_linux_common(pcap_t *hand
|
||||||
if (can_filter_in_kernel) {
|
if (can_filter_in_kernel) {
|
||||||
if ((err = set_kernel_filter(handle, &fcode)) == 0)
|
if ((err = set_kernel_filter(handle, &fcode)) == 0)
|
||||||
{
|
{
|
||||||
@ -29,8 +29,11 @@ Index: libpcap-1.5.2/pcap-linux.c
|
|||||||
+ int ret;
|
+ int ret;
|
||||||
+ unsigned int received = 0, rec_len = 0;
|
+ unsigned int received = 0, rec_len = 0;
|
||||||
+ socklen_t optlen = sizeof(rec_len);
|
+ socklen_t optlen = sizeof(rec_len);
|
||||||
/* Installation succeded - using kernel filter. */
|
/*
|
||||||
handlep->filtering_in_kernel = 1;
|
* Installation succeded - using kernel filter,
|
||||||
|
* so userland filtering not needed.
|
||||||
|
*/
|
||||||
|
handlep->filter_in_userland = 0;
|
||||||
+
|
+
|
||||||
+ oldflags = fcntl(handle->fd, F_GETFL, 0);
|
+ oldflags = fcntl(handle->fd, F_GETFL, 0);
|
||||||
+ oldflags |= O_NONBLOCK;
|
+ oldflags |= O_NONBLOCK;
|
||||||
@ -38,7 +41,7 @@ Index: libpcap-1.5.2/pcap-linux.c
|
|||||||
+ getsockopt(handle->fd, SOL_SOCKET, SO_RCVBUF,
|
+ getsockopt(handle->fd, SOL_SOCKET, SO_RCVBUF,
|
||||||
+ (char *)&rec_len, &optlen);
|
+ (char *)&rec_len, &optlen);
|
||||||
+
|
+
|
||||||
+ /* now read all packets received until now */
|
+ /* now read all packets received until now */
|
||||||
+ while((ret = read(handle->fd, buf, 1024)) > 0
|
+ while((ret = read(handle->fd, buf, 1024)) > 0
|
||||||
+ && received < rec_len) {
|
+ && received < rec_len) {
|
||||||
+ received += ret;
|
+ received += ret;
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:806d4ba23b126476d39a458ad1468f73dfe63c92f9586208f7e4e18c13e52ddd
|
|
||||||
size 640308
|
|
Binary file not shown.
3
libpcap-1.5.3.tar.gz
Normal file
3
libpcap-1.5.3.tar.gz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:9ae92159c1060f15e6a90f2c4ad227268b6aaa382c316fa49a31c496b9979e93
|
||||||
|
size 642352
|
BIN
libpcap-1.5.3.tar.gz.sig
Normal file
BIN
libpcap-1.5.3.tar.gz.sig
Normal file
Binary file not shown.
91
libpcap-netlink.patch
Normal file
91
libpcap-netlink.patch
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
diff --git a/pcap-common.c b/pcap-common.c
|
||||||
|
index 6175a5a..f26d22e 100644
|
||||||
|
--- a/pcap-common.c
|
||||||
|
+++ b/pcap-common.c
|
||||||
|
@@ -932,7 +932,12 @@
|
||||||
|
*/
|
||||||
|
#define LINKTYPE_WIRESHARK_UPPER_PDU 252
|
||||||
|
|
||||||
|
-#define LINKTYPE_MATCHING_MAX 252 /* highest value in the "matching" range */
|
||||||
|
+/*
|
||||||
|
+ * Link-layer header type for the netlink protocol (nlmon devices).
|
||||||
|
+ */
|
||||||
|
+#define LINKTYPE_NETLINK 253
|
||||||
|
+
|
||||||
|
+#define LINKTYPE_MATCHING_MAX 253 /* highest value in the "matching" range */
|
||||||
|
|
||||||
|
static struct linktype_map {
|
||||||
|
int dlt;
|
||||||
|
diff --git a/pcap-linux.c b/pcap-linux.c
|
||||||
|
index c6fd076..1d2c130 100644
|
||||||
|
--- a/pcap-linux.c
|
||||||
|
+++ b/pcap-linux.c
|
||||||
|
@@ -2604,6 +2604,8 @@ map_packet_type_to_sll_type(short int sll_pkttype)
|
||||||
|
*/
|
||||||
|
static void map_arphrd_to_dlt(pcap_t *handle, int arptype, int cooked_ok)
|
||||||
|
{
|
||||||
|
+ struct pcap_linux *handlep = handle->priv;
|
||||||
|
+
|
||||||
|
switch (arptype) {
|
||||||
|
|
||||||
|
case ARPHRD_ETHER:
|
||||||
|
@@ -2976,6 +2976,19 @@ static void map_arphrd_to_dlt(pcap_t *handle, int arptype, int cooked_ok)
|
||||||
|
handle->linktype = DLT_IEEE802_15_4_NOFCS;
|
||||||
|
break;
|
||||||
|
|
||||||
|
+#ifndef ARPHRD_NETLINK
|
||||||
|
+#define ARPHRD_NETLINK 824
|
||||||
|
+#endif
|
||||||
|
+ case ARPHRD_NETLINK:
|
||||||
|
+ handle->linktype = DLT_NETLINK;
|
||||||
|
+ /*
|
||||||
|
+ * We need to use cooked mode, so that in sll_protocol we
|
||||||
|
+ * pick up the netlink protocol type such as NETLINK_ROUTE,
|
||||||
|
+ * NETLINK_GENERIC, NETLINK_FIB_LOOKUP, etc.
|
||||||
|
+ */
|
||||||
|
+ handlep->cooked = 1;
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
default:
|
||||||
|
handle->linktype = -1;
|
||||||
|
break;
|
||||||
|
@@ -3181,7 +3194,8 @@ activate_new(pcap_t *handle)
|
||||||
|
* same applies to LAPD capture.
|
||||||
|
*/
|
||||||
|
if (handle->linktype != DLT_LINUX_IRDA &&
|
||||||
|
- handle->linktype != DLT_LINUX_LAPD)
|
||||||
|
+ handle->linktype != DLT_LINUX_LAPD &&
|
||||||
|
+ handle->linktype != DLT_NETLINK)
|
||||||
|
handle->linktype = DLT_LINUX_SLL;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/pcap.c b/pcap.c
|
||||||
|
index 6b16cea..83d4bb1 100644
|
||||||
|
--- a/pcap.c
|
||||||
|
+++ b/pcap.c
|
||||||
|
@@ -1203,6 +1203,7 @@ static struct dlt_choice dlt_choices[] = {
|
||||||
|
DLT_CHOICE(DLT_NETANALYZER_TRANSPARENT, "Ethernet with Hilscher netANALYZER pseudo-header and with preamble and SFD"),
|
||||||
|
DLT_CHOICE(DLT_IPOIB, "RFC 4391 IP-over-Infiniband"),
|
||||||
|
DLT_CHOICE(DLT_DBUS, "D-Bus"),
|
||||||
|
+ DLT_CHOICE(DLT_NETLINK, "Linux netlink"),
|
||||||
|
DLT_CHOICE_SENTINEL
|
||||||
|
};
|
||||||
|
|
||||||
|
diff --git a/pcap/bpf.h b/pcap/bpf.h
|
||||||
|
index 608ef39..d30bf95 100644
|
||||||
|
--- a/pcap/bpf.h
|
||||||
|
+++ b/pcap/bpf.h
|
||||||
|
@@ -1243,7 +1243,12 @@ struct bpf_program {
|
||||||
|
*/
|
||||||
|
#define DLT_WIRESHARK_UPPER_PDU 252
|
||||||
|
|
||||||
|
-#define DLT_MATCHING_MAX 252 /* highest value in the "matching" range */
|
||||||
|
+/*
|
||||||
|
+ * DLT type for the netlink protocol (nlmon devices).
|
||||||
|
+ */
|
||||||
|
+#define DLT_NETLINK 253
|
||||||
|
+
|
||||||
|
+#define DLT_MATCHING_MAX 253 /* highest value in the "matching" range */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DLT and savefile link type values are split into a class and
|
@ -1,3 +1,23 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Feb 13 16:18:19 UTC 2014 - vcizek@suse.com
|
||||||
|
|
||||||
|
- added support for netlink (bnc#863823)
|
||||||
|
* libpcap-netlink.patch
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Feb 13 15:14:48 UTC 2014 - vcizek@suse.com
|
||||||
|
|
||||||
|
- update to 1.5.3
|
||||||
|
* Don't let packets that don't match the current filter get to the
|
||||||
|
application when TPACKET_V3 is used. (GitHub issue #331)
|
||||||
|
* Fix handling of pcap_loop()/pcap_dispatch() with a packet count
|
||||||
|
of 0 on some platforms (including Linux with TPACKET_V3).
|
||||||
|
(GitHub issue #333)
|
||||||
|
* Work around TPACKET_V3 deficiency that causes packets to be lost
|
||||||
|
when a timeout of 0 is specified. (GitHub issue #335)
|
||||||
|
* Man page formatting fixes.
|
||||||
|
- refreshed libpcap-1.5.2-filter-fix.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sat Dec 14 12:08:46 UTC 2013 - andreas.stieger@gmx.de
|
Sat Dec 14 12:08:46 UTC 2013 - andreas.stieger@gmx.de
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package libpcap
|
# spec file for package libpcap
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
|
|
||||||
Name: libpcap
|
Name: libpcap
|
||||||
Version: 1.5.2
|
Version: 1.5.3
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: A Library for Network Sniffers
|
Summary: A Library for Network Sniffers
|
||||||
License: BSD-3-Clause
|
License: BSD-3-Clause
|
||||||
@ -32,6 +32,7 @@ Patch1: libpcap-1.0.0-pcap-bpf.patch
|
|||||||
Patch2: libpcap-1.0.0-ppp.patch
|
Patch2: libpcap-1.0.0-ppp.patch
|
||||||
Patch3: libpcap-1.0.0-s390.patch
|
Patch3: libpcap-1.0.0-s390.patch
|
||||||
Patch4: libpcap-ocloexec.patch
|
Patch4: libpcap-ocloexec.patch
|
||||||
|
Patch5: libpcap-netlink.patch
|
||||||
BuildRequires: automake
|
BuildRequires: automake
|
||||||
BuildRequires: bison
|
BuildRequires: bison
|
||||||
BuildRequires: bluez-devel
|
BuildRequires: bluez-devel
|
||||||
@ -96,6 +97,7 @@ program yourself.
|
|||||||
%patch2
|
%patch2
|
||||||
%patch3
|
%patch3
|
||||||
%patch4 -p1
|
%patch4 -p1
|
||||||
|
%patch5 -p1
|
||||||
%build
|
%build
|
||||||
%ifarch %sparc
|
%ifarch %sparc
|
||||||
pic="PIC"
|
pic="PIC"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user