Blame SOURCES/0007-Add-support-for-AF_VSOCK.patch

52e97a
From 59a65c3d24289661dc444e3c303fbd880de5b6e0 Mon Sep 17 00:00:00 2001
52e97a
From: rpm-build <rpm-build>
52e97a
Date: Tue, 15 Aug 2017 09:59:02 +0200
52e97a
Subject: [PATCH] Add support for AF_VSOCK
52e97a
52e97a
Backported from here:
52e97a
https://github.com/the-tcpdump-group/libpcap/commit/8fe43bb140f1b5dd193a76b89e379a27847a9391
52e97a
and extended with DLT_VSOCK definition from upstream pcap/dlt.h file.
52e97a
---
52e97a
 pcap-linux.c |  6 ++++++
52e97a
 pcap.c       |  1 +
52e97a
 pcap/bpf.h   | 10 +++++++++-
52e97a
 3 files changed, 16 insertions(+), 1 deletion(-)
52e97a
52e97a
diff --git a/pcap-linux.c b/pcap-linux.c
52e97a
index d7149d5..0bfc77a 100644
52e97a
--- a/pcap-linux.c
52e97a
+++ b/pcap-linux.c
52e97a
@@ -2995,6 +2995,12 @@ static void map_arphrd_to_dlt(pcap_t *handle, int arptype, int cooked_ok)
52e97a
                 
52e97a
 		/* handlep->cooked = 1; */
52e97a
 		break;
52e97a
+#ifndef ARPHRD_VSOCKMON
52e97a
+#define ARPHRD_VSOCKMON	826
52e97a
+#endif
52e97a
+	case ARPHRD_VSOCKMON:
52e97a
+		handle->linktype = DLT_VSOCK;
52e97a
+		break;
52e97a
 
52e97a
 	default:
52e97a
 		handle->linktype = -1;
52e97a
diff --git a/pcap.c b/pcap.c
52e97a
index 7b834af..ce5ade8 100644
52e97a
--- a/pcap.c
52e97a
+++ b/pcap.c
52e97a
@@ -1210,6 +1210,7 @@ static struct dlt_choice dlt_choices[] = {
52e97a
 	DLT_CHOICE(DLT_IPOIB, "RFC 4391 IP-over-Infiniband"),
52e97a
 	DLT_CHOICE(DLT_DBUS, "D-Bus"),
52e97a
 	DLT_CHOICE(DLT_NETLINK, "Linux netlink"),
52e97a
+        DLT_CHOICE(DLT_VSOCK, "Linux vsock"),
52e97a
 	DLT_CHOICE_SENTINEL
52e97a
 };
52e97a
 
52e97a
diff --git a/pcap/bpf.h b/pcap/bpf.h
52e97a
index 29efd7e..22bff1e 100644
52e97a
--- a/pcap/bpf.h
52e97a
+++ b/pcap/bpf.h
52e97a
@@ -1232,7 +1232,15 @@ struct bpf_program {
52e97a
  */
52e97a
 #define DLT_NETLINK		253
52e97a
 
52e97a
-#define DLT_MATCHING_MAX	253	/* highest value in the "matching" range */
52e97a
+#define DLT_MATCHING_MAX	271	/* highest value in the "matching" range */
52e97a
+
52e97a
+/*
52e97a
+ * per: Stefanha at gmail.com for
52e97a
+ *   http://lists.sandelman.ca/pipermail/tcpdump-workers/2017-May/000772.html
52e97a
+ * and: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/vsockmon.h
52e97a
+ * for: http://qemu-project.org/Features/VirtioVsock
52e97a
+ */
52e97a
+#define DLT_VSOCK               271
52e97a
 
52e97a
 /*
52e97a
  * DLT and savefile link type values are split into a class and
52e97a
-- 
52e97a
2.13.5
52e97a