aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2011-11-19 16:48:29 -0800
committerGuy Harris <guy@alum.mit.edu>2011-11-19 16:48:29 -0800
commitb107f954e64878ce569cce7c00bd3aa6297ca0c5 (patch)
treeb57a3b4066b1bb68dcee2972598dfcf982be89d9
parent93fea042b3fcedeb21fe517b25c41b3eaf0573b9 (diff)
When checking for VLAN tags, check for QinQ tags as well.
From robwills2 at SourceForge.
-rw-r--r--ethertype.h3
-rw-r--r--gencode.c6
2 files changed, 8 insertions, 1 deletions
diff --git a/ethertype.h b/ethertype.h
index d22b9277..2d6bbebd 100644
--- a/ethertype.h
+++ b/ethertype.h
@@ -117,3 +117,6 @@
#ifndef ETHERTYPE_LOOPBACK
#define ETHERTYPE_LOOPBACK 0x9000
#endif
+#ifndef ETHERTYPE_8021QINQ
+#define ETHERTYPE_8021QINQ 0x9100
+#endif
diff --git a/gencode.c b/gencode.c
index a6acb405..7281d40f 100644
--- a/gencode.c
+++ b/gencode.c
@@ -8108,9 +8108,13 @@ gen_vlan(vlan_num)
case DLT_EN10MB:
case DLT_NETANALYZER:
case DLT_NETANALYZER_TRANSPARENT:
- /* check for VLAN */
+ /* check for VLAN, including QinQ */
b0 = gen_cmp(OR_LINK, off_linktype, BPF_H,
(bpf_int32)ETHERTYPE_8021Q);
+ b1 = gen_cmp(OR_LINK, off_linktype, BPF_H,
+ (bpf_int32)ETHERTYPE_8021QINQ);
+ gen_or(b0,b1);
+ b0 = b1;
/* If a specific VLAN is requested, check VLAN id */
if (vlan_num >= 0) {