From: Jesse Gross Date: Wed, 11 Feb 2015 01:00:45 +0000 (-0800) Subject: Check offloaded vlans are from the outermost part of the packet. X-Git-Tag: libpcap-1.7.2^2~19 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/44ef59e3e254156a7afa7c7aff614887eee23be9 Check offloaded vlans are from the outermost part of the packet. VLAN acceleration doesn't apply to any tags that are inside of any type of encapsulation. --- diff --git a/gencode.c b/gencode.c index 277015e3..af0f3017 100644 --- a/gencode.c +++ b/gencode.c @@ -7955,7 +7955,11 @@ gen_vlan(vlan_num) case DLT_NETANALYZER: case DLT_NETANALYZER_TRANSPARENT: #if defined(SKF_AD_VLAN_TAG) && defined(SKF_AD_VLAN_TAG_PRESENT) - if (vlan_stack_depth == 0) { + /* Verify that this is the outer part of the packet and + * not encapsulated somehow. */ + if (vlan_stack_depth == 0 && !off_linkhdr.is_variable && + off_linkhdr.constant_part == + off_outermostlinkhdr.constant_part) { /* * Do we need special VLAN handling? */