summaryrefslogtreecommitdiffstats
path: root/test/patches
diff options
context:
space:
mode:
Diffstat (limited to 'test/patches')
-rw-r--r--test/patches/scapy-2.4/bier.patch64
-rw-r--r--test/patches/scapy-2.4/enable_geneve.patch13
-rw-r--r--test/patches/scapy-2.4/geneve.patch56
-rw-r--r--test/patches/scapy-2.4/gre.patch43
-rw-r--r--test/patches/scapy-2.4/mpls.py.patch21
5 files changed, 197 insertions, 0 deletions
diff --git a/test/patches/scapy-2.4/bier.patch b/test/patches/scapy-2.4/bier.patch
new file mode 100644
index 00000000000..82a881e9997
--- /dev/null
+++ b/test/patches/scapy-2.4/bier.patch
@@ -0,0 +1,64 @@
+diff --git a/scapy/contrib/bier.py b/scapy/contrib/bier.py
+new file mode 100644
+index 0000000..e173cdb
+--- /dev/null
++++ b/scapy/contrib/bier.py
+@@ -0,0 +1,58 @@
++# http://trac.secdev.org/scapy/ticket/31
++
++# scapy.contrib.description = BIER
++# scapy.contrib.status = loads
++
++from scapy.packet import *
++from scapy.fields import *
++from scapy.layers.inet import IP, UDP
++from scapy.layers.inet6 import IPv6
++
++
++class BIERLength:
++ BIER_LEN_64 = 0
++ BIER_LEN_128 = 1
++ BIER_LEN_256 = 2
++ BIER_LEN_512 = 3
++ BIER_LEN_1024 = 4
++
++
++BIERnhcls = {1: "MPLS",
++ 2: "MPLS",
++ 4: "IPv4",
++ 5: "IPv6"}
++
++
++class BIFT(Packet):
++ name = "BIFT"
++ fields_desc = [BitField("bsl", 0, 4),
++ BitField("sd", 0, 8),
++ BitField("set", 0, 8),
++ BitField("cos", 0, 3),
++ BitField("s", 1, 1),
++ ByteField("ttl", 0)]
++
++ def guess_payload_class(self, payload):
++ return BIER
++
++
++class BIER(Packet):
++ name = "BIER"
++ fields_desc = [BitField("id", 5, 4),
++ BitField("version", 0, 4),
++ BitFieldLenField("length", BIERLength.BIER_LEN_256, 4,
++ length_of=lambda x:(x.BitString >> 8)),
++ BitField("entropy", 0, 20),
++ BitField("OAM", 0, 2),
++ BitField("RSV", 0, 2),
++ BitField("DSCP", 0, 6),
++ BitEnumField("Proto", 2, 6, BIERnhcls),
++ ShortField("BFRID", 0),
++ StrLenField("BitString",
++ "",
++ length_from=lambda x:(8 << x.length))]
++
++
++bind_layers(BIER, IP, Proto=4)
++bind_layers(BIER, IPv6, Proto=5)
++bind_layers(UDP, BIFT, dport=8138)
diff --git a/test/patches/scapy-2.4/enable_geneve.patch b/test/patches/scapy-2.4/enable_geneve.patch
new file mode 100644
index 00000000000..4e91b219d3e
--- /dev/null
+++ b/test/patches/scapy-2.4/enable_geneve.patch
@@ -0,0 +1,13 @@
+diff --git a/scapy/config.py b/scapy/config.py
+index cc97c6d..887b639 100755
+--- a/scapy/config.py
++++ b/scapy/config.py
+@@ -439,7 +439,7 @@ debug_tls:When 1, print some TLS session secrets when they are computed.
+ "mobileip", "netbios", "netflow", "ntp", "ppp", "pptp",
+ "radius", "rip", "rtp", "skinny", "smb", "snmp",
+ "tftp", "x509", "bluetooth", "dhcp6", "llmnr",
+- "sctp", "vrrp", "ipsec", "lltd", "vxlan", "eap"]
++ "sctp", "vrrp", "ipsec", "lltd", "vxlan", "eap", "geneve"]
+ contribs = dict()
+ crypto_valid = isCryptographyValid()
+ crypto_valid_advanced = isCryptographyAdvanced()
diff --git a/test/patches/scapy-2.4/geneve.patch b/test/patches/scapy-2.4/geneve.patch
new file mode 100644
index 00000000000..92752f1196e
--- /dev/null
+++ b/test/patches/scapy-2.4/geneve.patch
@@ -0,0 +1,56 @@
+diff --git a/scapy/layers/geneve.py b/scapy/layers/geneve.py
+new file mode 100644
+index 0000000..e2ca888
+--- /dev/null
++++ b/scapy/layers/geneve.py
+@@ -0,0 +1,50 @@
++#! /usr/bin/env python
++# (GENEVE):
++# A Framework for Overlaying Virtualized Layer 2 Networks over Layer 3 Networks
++
++from scapy.packet import Packet, bind_layers
++from scapy.layers.l2 import Ether
++from scapy.layers.inet import IP, UDP
++from scapy.layers.inet6 import IPv6
++from scapy.fields import FlagsField, XByteField, ThreeBytesField, \
++ ConditionalField, ShortField, ByteEnumField, X3BytesField
++
++#
++# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
++# |Ver| Opt Len |O|C| Rsvd. | Protocol Type |
++# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
++# | Virtual Network Identifier (VNI) | Reserved |
++# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
++# | Variable Length Options |
++# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
++#
++
++class GENEVE(Packet):
++ name = "GENEVE"
++
++ fields_desc = [
++ # INIT = ver + optlen + o + c + rsvd (all zeros)
++ ShortField("init", 0x0),
++ # PROTOCOL is a 2-bytes field
++ ShortField("protocol", 0x6558),
++ ThreeBytesField("vni", 0),
++ XByteField("reserved2", 0),
++ ]
++
++ def mysummary(self):
++ return self.sprintf("GENEVE (vni=%GENEVE.vni%)")
++
++bind_layers(UDP, GENEVE, dport=6081) # RFC standard port
++bind_layers(UDP, GENEVE, dport=6081) # New IANA assigned port for use with NSH
++bind_layers(UDP, GENEVE, dport=8472) # Linux implementation port
++# By default, set both ports to the RFC standard
++bind_layers(UDP, GENEVE, sport=6081, dport=6081)
++
++bind_layers(GENEVE, Ether)
++bind_layers(GENEVE, IP, NextProtocol=1)
++bind_layers(GENEVE, IPv6, NextProtocol=2)
++bind_layers(GENEVE, Ether, flags=4, NextProtocol=0)
++bind_layers(GENEVE, IP, flags=4, NextProtocol=1)
++bind_layers(GENEVE, IPv6, flags=4, NextProtocol=2)
++bind_layers(GENEVE, Ether, flags=4, NextProtocol=3)
++
diff --git a/test/patches/scapy-2.4/gre.patch b/test/patches/scapy-2.4/gre.patch
new file mode 100644
index 00000000000..74004480291
--- /dev/null
+++ b/test/patches/scapy-2.4/gre.patch
@@ -0,0 +1,43 @@
+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)
diff --git a/test/patches/scapy-2.4/mpls.py.patch b/test/patches/scapy-2.4/mpls.py.patch
new file mode 100644
index 00000000000..2a8fc84b1c4
--- /dev/null
+++ b/test/patches/scapy-2.4/mpls.py.patch
@@ -0,0 +1,21 @@
+diff --git a/scapy/contrib/mpls.py b/scapy/contrib/mpls.py
+index 8daddf2..a9dc7fe 100644
+--- a/scapy/contrib/mpls.py
++++ b/scapy/contrib/mpls.py
+@@ -18,6 +18,7 @@
+ from scapy.packet import Packet, bind_layers, Padding
+ from scapy.fields import BitField,ByteField
+ from scapy.layers.inet import IP
++from scapy.contrib.bier import BIER
+ from scapy.layers.inet6 import IPv6
+ from scapy.layers.l2 import Ether, GRE
+ from scapy.compat import orb
+@@ -36,6 +37,8 @@ class MPLS(Packet):
+ ip_version = (orb(payload[0]) >> 4) & 0xF
+ if ip_version == 4:
+ return IP
++ elif ip_version == 5:
++ return BIER
+ elif ip_version == 6:
+ return IPv6
+ return Padding