1 diff --git a/scapy/layers/geneve.py b/scapy/layers/geneve.py
5 +++ b/scapy/layers/geneve.py
7 +#! /usr/bin/env python
9 +# A Framework for Overlaying Virtualized Layer 2 Networks over Layer 3 Networks
11 +from scapy.packet import Packet, bind_layers
12 +from scapy.layers.l2 import Ether
13 +from scapy.layers.inet import IP, UDP
14 +from scapy.layers.inet6 import IPv6
15 +from scapy.fields import FlagsField, XByteField, ThreeBytesField, \
16 + ConditionalField, ShortField, ByteEnumField, X3BytesField
19 +# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
20 +# |Ver| Opt Len |O|C| Rsvd. | Protocol Type |
21 +# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
22 +# | Virtual Network Identifier (VNI) | Reserved |
23 +# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
24 +# | Variable Length Options |
25 +# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
28 +class GENEVE(Packet):
32 + # INIT = ver + optlen + o + c + rsvd (all zeros)
33 + ShortField("init", 0x0),
34 + # PROTOCOL is a 2-bytes field
35 + ShortField("protocol", 0x6558),
36 + ThreeBytesField("vni", 0),
37 + XByteField("reserved2", 0),
40 + def mysummary(self):
41 + return self.sprintf("GENEVE (vni=%GENEVE.vni%)")
43 +bind_layers(UDP, GENEVE, dport=6081) # RFC standard port
44 +bind_layers(UDP, GENEVE, dport=6081) # New IANA assigned port for use with NSH
45 +bind_layers(UDP, GENEVE, dport=8472) # Linux implementation port
46 +# By default, set both ports to the RFC standard
47 +bind_layers(UDP, GENEVE, sport=6081, dport=6081)
49 +bind_layers(GENEVE, Ether)
50 +bind_layers(GENEVE, IP, NextProtocol=1)
51 +bind_layers(GENEVE, IPv6, NextProtocol=2)
52 +bind_layers(GENEVE, Ether, flags=4, NextProtocol=0)
53 +bind_layers(GENEVE, IP, flags=4, NextProtocol=1)
54 +bind_layers(GENEVE, IPv6, flags=4, NextProtocol=2)
55 +bind_layers(GENEVE, Ether, flags=4, NextProtocol=3)