capture: add support for VLAN 802.1Q header in Linux cooked packets #189

This commit is contained in:
Kaian 2017-05-24 15:28:29 +02:00
parent 22b8206357
commit e50176a534
2 changed files with 15 additions and 0 deletions

View File

@ -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);

View File

@ -68,6 +68,10 @@
#include <netinet/ip6.h>
#endif
#ifdef DLT_LINUX_SLL
#include <pcap/sll.h>
#endif
#include <arpa/inet.h>
#include <netinet/if_ether.h>
#include <netinet/ip.h>