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 @@ -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), --- a/scapy/layers/l2.py +++ b/scapy/layers/l2.py @@ -427,6 +427,7 @@ bind_layers( Dot1AD, Dot1AD, type=0x88a8) bind_layers( Dot1AD, Dot1Q, type=0x8100) bind_layers( Dot1Q, Dot1AD, type=0x88a8) bind_layers( Ether, Ether, type=1) +bind_layers( GRE, ERSPAN, proto=0x88be, seqnum_present=1) bind_layers( Ether, ARP, type=2054) bind_layers( CookedLinux, LLC, proto=122) bind_layers( CookedLinux, Dot1Q, proto=33024) @@ -441,6 +442,7 @@ bind_layers( GRE, ARP, proto=2054) 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( LLC, STP, dsap=66, ssap=66, ctrl=3) bind_layers( LLC, SNAP, dsap=170, ssap=170, ctrl=3) bind_layers( SNAP, Dot1Q, code=33024)