From 2bf8b8154d0e1707fbf8502eb8e85fdda885a8e5 Mon Sep 17 00:00:00 2001 From: John Lo Date: Tue, 27 Feb 2018 16:35:03 -0500 Subject: Fix ERSPAN encap to set EN bits in the header and add test case For ERSPAN encap, both bits in the EN field of the header should be set to indicate any VLAN tag in the original Ethernet frame is preserved. Added SPAN L2 test case where the mirrored packet output is a GRE ERSPAN tunnel. Change-Id: Ie7a40992a9278469c24aa6fa9e122b4505797d10 Signed-off-by: John Lo --- test/patches/scapy-2.3.3/gre-layers.patch | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'test/patches') diff --git a/test/patches/scapy-2.3.3/gre-layers.patch b/test/patches/scapy-2.3.3/gre-layers.patch index 605a705b0f7..6090050fc5f 100644 --- a/test/patches/scapy-2.3.3/gre-layers.patch +++ b/test/patches/scapy-2.3.3/gre-layers.patch @@ -14,12 +14,40 @@ diff --git a/scapy/layers/l2.py b/scapy/layers/l2.py index 4f491d2..661a5da 100644 --- a/scapy/layers/l2.py +++ b/scapy/layers/l2.py -@@ -628,7 +628,7 @@ bind_layers( CookedLinux, EAPOL, proto=34958) +@@ -570,6 +570,20 @@ + return getmacbyip(l3.pdst) + conf.neighbor.register_l3(Ether, ARP, l2_register_l3_arp) + ++ ++class ERSPAN(Packet): ++ name = "ERSPAN" ++ fields_desc = [ BitField("ver",0,4), ++ BitField("vlan",0,12), ++ BitField("cos",0,3), ++ BitField("en",0,2), ++ BitField("t",0,1), ++ BitField("session_id",0,10), ++ BitField("reserved",0,12), ++ BitField("index",0,20), ++ ] ++ ++ + class GRErouting(Packet): + name = "GRE routing informations" + fields_desc = [ ShortField("address_family",0), +@@ -628,12 +642,14 @@ bind_layers( CookedLinux, EAPOL, proto=34958) bind_layers( GRE, LLC, proto=122) bind_layers( GRE, Dot1Q, proto=33024) bind_layers( GRE, Dot1AD, type=0x88a8) -bind_layers( GRE, Ether, proto=1) +bind_layers( GRE, Ether, proto=0x6558) ++bind_layers( GRE, ERSPAN, proto=0x88be, seqnum_present=1) bind_layers( GRE, ARP, proto=2054) bind_layers( GRE, EAPOL, proto=34958) bind_layers( GRE, GRErouting, { "routing_present" : 1 } ) + bind_layers( GRErouting, conf.raw_layer,{ "address_family" : 0, "SRE_len" : 0 }) + bind_layers( GRErouting, GRErouting, { } ) ++bind_layers( ERSPAN, Ether) + bind_layers( EAPOL, EAP, type=0) + bind_layers(EAP, EAP_TLS, type=13) + bind_layers(EAP, EAP_FAST, type=43) -- cgit 1.2.3-korg