Adding support for AF_VSOCK

This commit is contained in:
Michal Ruprich 2018-06-07 09:34:43 +02:00
parent 3ff488656f
commit aa35d97de4
2 changed files with 49 additions and 1 deletions

View File

@ -0,0 +1,44 @@
diff --git a/pcap-linux.c b/pcap-linux.c
index 85aa4d2..73b8602 100644
--- a/pcap-linux.c
+++ b/pcap-linux.c
@@ -3252,6 +3252,13 @@ static void map_arphrd_to_dlt(pcap_t *handle, int sock_fd, int arptype,
/* handlep->cooked = 1; */
break;
+#ifndef ARPHRD_VSOCKMON
+#define ARPHRD_VSOCKMON 826
+#endif
+ case ARPHRD_VSOCKMON:
+ handle->linktype = DLT_VSOCK;
+ break;
+
/* ARPHRD_LAPD is unofficial and randomly allocated, if reallocation
* is needed, please report it to <daniele@orlandi.com> */
#ifndef ARPHRD_LAPD
diff --git a/pcap.c b/pcap.c
index 77a709f..f571a10 100644
--- a/pcap.c
+++ b/pcap.c
@@ -1259,6 +1259,7 @@ static struct dlt_choice dlt_choices[] = {
DLT_CHOICE(RTAC_SERIAL, "Schweitzer Engineering Laboratories RTAC packets"),
DLT_CHOICE(BLUETOOTH_LE_LL, "Bluetooth Low Energy air interface"),
DLT_CHOICE(NETLINK, "Linux netlink"),
+ DLT_CHOICE(VSOCK, "Linux vsock"),
DLT_CHOICE(BLUETOOTH_LINUX_MONITOR, "Bluetooth Linux Monitor"),
DLT_CHOICE(BLUETOOTH_BREDR_BB, "Bluetooth Basic Rate/Enhanced Data Rate baseband packets"),
DLT_CHOICE(BLUETOOTH_LE_LL_WITH_PHDR, "Bluetooth Low Energy air interface with pseudo-header"),
diff --git a/pcap/dlt.h b/pcap/dlt.h
index 2d74713..c5e851f 100644
--- a/pcap/dlt.h
+++ b/pcap/dlt.h
@@ -1316,7 +1316,8 @@
#ifdef DLT_MATCHING_MAX
#undef DLT_MATCHING_MAX
#endif
-#define DLT_MATCHING_MAX 265 /* highest value in the "matching" range */
+#define DLT_MATCHING_MAX 271 /* highest value in the "matching" range */
+#define DLT_VSOCK 271
/*
* DLT and savefile link type values are split into a class and

View File

@ -1,7 +1,7 @@
Name: libpcap
Epoch: 14
Version: 1.8.1
Release: 9%{?dist}
Release: 10%{?dist}
Summary: A system-independent interface for user-level packet capture
Group: Development/Libraries
License: BSD with advertising
@ -19,6 +19,7 @@ Source: http://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-Add-support-for-AF_VSOCK.patch
%description
Libpcap provides a portable framework for low-level network
@ -86,6 +87,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libpcap.a
%{_mandir}/man5/pcap*.5*
%changelog
* Wed Jun 06 2018 Michal Ruprich <mruprich@redhat.com> - 14:1.8.1-10
- Adding support for AF_VSOCK
* Tue Feb 20 2018 Martin Sehnoutka <msehnout@redhat.com> - 14:1.8.1-9
- Add gcc to BuildRequires