Initial GENEVE TUNNEL implementation and tests.
Notes on this first implementation:
* First version of the implementation does NOT support GENEVE OPTIONS
HEADER: it isn't well understood what the purpose of the OPTIONS will be and/or
what content would be placed in the variable option data;
Once the IETF work will evolve and further information will be available
it could be possible to modify the frame rewrite to contemplate the
actual GENEVE OPTIONS.
Change-Id: Iddfe6f408cc45bb0800f00ce6a3e302e48a4ed52
Signed-off-by: Marco Varlese <marco.varlese@suse.com>
diff --git a/test/patches/scapy-2.3.3/enable_geneve.patch b/test/patches/scapy-2.3.3/enable_geneve.patch
new file mode 100644
index 0000000..4e91b21
--- /dev/null
+++ b/test/patches/scapy-2.3.3/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.3.3/geneve.patch b/test/patches/scapy-2.3.3/geneve.patch
new file mode 100644
index 0000000..92752f1
--- /dev/null
+++ b/test/patches/scapy-2.3.3/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)
++