aboutsummaryrefslogtreecommitdiffstats
path: root/test/patches/scapy-2.3.3/gre-layers.patch
blob: 6090050fc5f37138d34ccc62677cd8d02e43fdff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
diff --git a/scapy/layers/inet6.py b/scapy/layers/inet6.py
index 03b80ec..a7e1e0f 100644
--- a/scapy/layers/inet6.py
+++ b/scapy/layers/inet6.py
@@ -3722,6 +3722,7 @@ conf.l2types.register(31, IPv6)
 
 bind_layers(Ether,     IPv6,     type = 0x86dd )
 bind_layers(CookedLinux, IPv6,   proto = 0x86dd )
+bind_layers(GRE,       IPv6,     proto = 0x86dd )
 bind_layers(IPerror6,  TCPerror, nh = socket.IPPROTO_TCP )
 bind_layers(IPerror6,  UDPerror, nh = socket.IPPROTO_UDP )
 bind_layers(IPv6,      TCP,      nh = socket.IPPROTO_TCP )
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),
@@ -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)