libpcap/0004-Add-support-for-AF_VSOCK.patch
2018-06-07 09:34:43 +02:00

45 lines
1.5 KiB
Diff

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