Fix ERSPAN encap to set EN bits in the header and add test case
[vpp.git] / test / patches / scapy-2.3.3 / gre-layers.patch
1 diff --git a/scapy/layers/inet6.py b/scapy/layers/inet6.py
2 index 03b80ec..a7e1e0f 100644
3 --- a/scapy/layers/inet6.py
4 +++ b/scapy/layers/inet6.py
5 @@ -3722,6 +3722,7 @@ conf.l2types.register(31, IPv6)
6  
7  bind_layers(Ether,     IPv6,     type = 0x86dd )
8  bind_layers(CookedLinux, IPv6,   proto = 0x86dd )
9 +bind_layers(GRE,       IPv6,     proto = 0x86dd )
10  bind_layers(IPerror6,  TCPerror, nh = socket.IPPROTO_TCP )
11  bind_layers(IPerror6,  UDPerror, nh = socket.IPPROTO_UDP )
12  bind_layers(IPv6,      TCP,      nh = socket.IPPROTO_TCP )
13 diff --git a/scapy/layers/l2.py b/scapy/layers/l2.py
14 index 4f491d2..661a5da 100644
15 --- a/scapy/layers/l2.py
16 +++ b/scapy/layers/l2.py
17 @@ -570,6 +570,20 @@
18      return getmacbyip(l3.pdst)
19  conf.neighbor.register_l3(Ether, ARP, l2_register_l3_arp)
20  
21 +
22 +class ERSPAN(Packet):
23 +    name = "ERSPAN"
24 +    fields_desc = [ BitField("ver",0,4),
25 +                    BitField("vlan",0,12),
26 +                    BitField("cos",0,3),
27 +                    BitField("en",0,2),
28 +                    BitField("t",0,1),
29 +                    BitField("session_id",0,10),
30 +                    BitField("reserved",0,12),
31 +                    BitField("index",0,20),
32 +                    ]
33 +
34 +
35  class GRErouting(Packet):
36      name = "GRE routing informations"
37      fields_desc = [ ShortField("address_family",0),
38 @@ -628,12 +642,14 @@ bind_layers( CookedLinux,   EAPOL,         proto=34958)
39  bind_layers( GRE,           LLC,           proto=122)
40  bind_layers( GRE,           Dot1Q,         proto=33024)
41  bind_layers( GRE,           Dot1AD,        type=0x88a8)
42 -bind_layers( GRE,           Ether,         proto=1)
43 +bind_layers( GRE,           Ether,         proto=0x6558)
44 +bind_layers( GRE,           ERSPAN,        proto=0x88be, seqnum_present=1)
45  bind_layers( GRE,           ARP,           proto=2054)
46  bind_layers( GRE,           EAPOL,         proto=34958)
47  bind_layers( GRE,           GRErouting,    { "routing_present" : 1 } )
48  bind_layers( GRErouting,    conf.raw_layer,{ "address_family" : 0, "SRE_len" : 0 })
49  bind_layers( GRErouting,    GRErouting,    { } )
50 +bind_layers( ERSPAN,        Ether)
51  bind_layers( EAPOL,         EAP,           type=0)
52  bind_layers(EAP,           EAP_TLS,       type=13)
53  bind_layers(EAP,           EAP_FAST,      type=43)