blob: 740044802919f0ed9d832ff2ed7c0bf197ff0ef9 [file] [log] [blame]
Neale Ranns2bc94022018-02-25 12:27:18 -08001diff --git a/scapy/layers/l2.py b/scapy/layers/l2.py
2index 4f491d2..661a5da 100644
3--- a/scapy/layers/l2.py
4+++ b/scapy/layers/l2.py
5@@ -570,6 +570,20 @@
6 return getmacbyip(l3.pdst)
7 conf.neighbor.register_l3(Ether, ARP, l2_register_l3_arp)
8
9+
10+class ERSPAN(Packet):
11+ name = "ERSPAN"
12+ fields_desc = [ BitField("ver",0,4),
13+ BitField("vlan",0,12),
14+ BitField("cos",0,3),
15+ BitField("en",0,2),
16+ BitField("t",0,1),
17+ BitField("session_id",0,10),
18+ BitField("reserved",0,12),
19+ BitField("index",0,20),
20+ ]
21+
22+
23 class GRErouting(Packet):
24 name = "GRE routing informations"
25 fields_desc = [ ShortField("address_family",0),
26--- a/scapy/layers/l2.py
27+++ b/scapy/layers/l2.py
28@@ -427,6 +427,7 @@ bind_layers( Dot1AD, Dot1AD, type=0x88a8)
29 bind_layers( Dot1AD, Dot1Q, type=0x8100)
30 bind_layers( Dot1Q, Dot1AD, type=0x88a8)
31 bind_layers( Ether, Ether, type=1)
32+bind_layers( GRE, ERSPAN, proto=0x88be, seqnum_present=1)
33 bind_layers( Ether, ARP, type=2054)
34 bind_layers( CookedLinux, LLC, proto=122)
35 bind_layers( CookedLinux, Dot1Q, proto=33024)
36@@ -441,6 +442,7 @@ bind_layers( GRE, ARP, proto=2054)
37 bind_layers( GRE, GRErouting, { "routing_present" : 1 } )
38 bind_layers( GRErouting, conf.raw_layer,{ "address_family" : 0, "SRE_len" : 0 })
39 bind_layers( GRErouting, GRErouting, { } )
40+bind_layers( ERSPAN, Ether)
41 bind_layers( LLC, STP, dsap=66, ssap=66, ctrl=3)
42 bind_layers( LLC, SNAP, dsap=170, ssap=170, ctrl=3)
43 bind_layers( SNAP, Dot1Q, code=33024)