File libpcap-8021ad-tpid.patch of Package libpcap.2975
From: Michal Kubecek <mkubecek@suse.cz>
Date: Wed, 19 Aug 2015 15:08:06 +0200
Subject: Recognize 802.1ad nested VLAN tag in vlan filter.
Patch-mainline: libpcap-1.7.2
Git-commit: cb21bc35f7cac6bc9e833510e48e9533cc4d0845
References: bsc#874131
In addition to ETHERTYPE_8021Q (0x8100) and ETHERTYPE_8021QINQ (0x9100),
recognize also ETHERTYPE_8021AD (0x88a8) as a VLAN tag. This is defined
as S-Tag (Service tag) by 802.1ad.
---
ethertype.h | 3 +++
gencode.c | 4 ++++
2 files changed, 7 insertions(+)
diff --git a/ethertype.h b/ethertype.h
index 2d6bbebddd5a..90d5c42cdd15 100644
--- a/ethertype.h
+++ b/ethertype.h
@@ -114,6 +114,9 @@
#ifndef ETHERTYPE_PPPOES
#define ETHERTYPE_PPPOES 0x8864
#endif
+#ifndef ETHERTYPE_8021AD
+#define ETHERTYPE_8021AD 0x88a8
+#endif
#ifndef ETHERTYPE_LOOPBACK
#define ETHERTYPE_LOOPBACK 0x9000
#endif
diff --git a/gencode.c b/gencode.c
index 7bb07fb1130d..593966333aa0 100644
--- a/gencode.c
+++ b/gencode.c
@@ -7909,6 +7909,10 @@ gen_vlan(vlan_num)
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_8021AD);
+ gen_or(b0,b1);
+ b0 = b1;
+ b1 = gen_cmp(OR_LINK, off_linktype, BPF_H,
(bpf_int32)ETHERTYPE_8021QINQ);
gen_or(b0,b1);
b0 = b1;
--
2.5.0