From e50176a534f71e5730b851e07f6e6ae1d653d02e Mon Sep 17 00:00:00 2001 From: Kaian Date: Wed, 24 May 2017 15:28:29 +0200 Subject: [PATCH] capture: add support for VLAN 802.1Q header in Linux cooked packets #189 --- src/capture.c | 11 +++++++++++ src/capture.h | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/src/capture.c b/src/capture.c index b2705ab..ed17399 100644 --- a/src/capture.c +++ b/src/capture.c @@ -390,6 +390,17 @@ capture_packet_reasm_ip(capture_info_t *capinfo, const struct pcap_pkthdr *heade } } +#ifdef DLT_LINUX_SLL + if (capinfo->link == DLT_LINUX_SLL) { + struct sll_header *sll = (struct sll_header *) packet; + if (ntohs(sll->sll_protocol) == ETHERTYPE_8021Q) { + link_hl += 4; + } + } +#endif + + + // Get IP header ip4 = (struct ip *) (packet + link_hl); diff --git a/src/capture.h b/src/capture.h index a8a36e7..d1f2b3f 100644 --- a/src/capture.h +++ b/src/capture.h @@ -68,6 +68,10 @@ #include #endif +#ifdef DLT_LINUX_SLL +#include +#endif + #include #include #include