Skip to content
Snippets Groups Projects
Commit 7efcc29f authored by Jochen Bartl's avatar Jochen Bartl
Browse files

Moved ThreeBytesField to fields.py, renamed VXLAN tests file

--HG--
rename : scapy/contrib/vxlan.utscapy => scapy/contrib/vxlan.uts
parent c1e3e8dc
No related branches found
No related tags found
No related merge requests found
...@@ -168,10 +168,6 @@ class EigrpIP6Field(StrField, IP6Field, EigrpIPField): ...@@ -168,10 +168,6 @@ class EigrpIP6Field(StrField, IP6Field, EigrpIPField):
def getfield(self, pkt, s): def getfield(self, pkt, s):
return EigrpIPField.getfield(self, pkt, s) return EigrpIPField.getfield(self, pkt, s)
class ThreeBytesField(X3BytesField, ByteField):
def i2repr(self, pkt, x):
return ByteField.i2repr(self, pkt, x)
class EIGRPGeneric(Packet): class EIGRPGeneric(Packet):
name = "EIGRP Generic TLV" name = "EIGRP Generic TLV"
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
from scapy.packet import Packet, bind_layers from scapy.packet import Packet, bind_layers
from scapy.layers.l2 import Ether from scapy.layers.l2 import Ether
from scapy.layers.inet import UDP from scapy.layers.inet import UDP
from scapy.fields import FlagsField, XByteField from scapy.fields import FlagsField, XByteField, ThreeBytesField
from scapy.contrib.eigrp import ThreeBytesField
_VXLAN_FLAGS = ['R' for i in range(0, 24)] + ['R', 'R', 'R', 'I', 'R', 'R', 'R', 'R', 'R'] _VXLAN_FLAGS = ['R' for i in range(0, 24)] + ['R', 'R', 'R', 'I', 'R', 'R', 'R', 'R', 'R']
......
% VXLAN Tests % VXLAN Tests
* Tests for the Scapy VXLAN layer * Tests for the Scapy VXLAN layer
+ Basic Layer Tests
= Build a VXLAN packet with VNI of 42 = Build a VXLAN packet with VNI of 42
str(UDP(sport=1024, dport=4789, len=None, chksum=None)/VXLAN(flags=0x08000000, vni=42)) == "\x04\x00\x12\xb5\x00\x10\x00\x00\x08\x00\x00\x00\x00\x00\x2a\x00" str(UDP(sport=1024, dport=4789, len=None, chksum=None)/VXLAN(flags=0x08000000, vni=42)) == "\x04\x00\x12\xb5\x00\x10\x00\x00\x08\x00\x00\x00\x00\x00\x2a\x00"
......
...@@ -275,6 +275,9 @@ class X3BytesField(XByteField): ...@@ -275,6 +275,9 @@ class X3BytesField(XByteField):
def getfield(self, pkt, s): def getfield(self, pkt, s):
return s[3:], self.m2i(pkt, struct.unpack(self.fmt, "\x00"+s[:3])[0]) return s[3:], self.m2i(pkt, struct.unpack(self.fmt, "\x00"+s[:3])[0])
class ThreeBytesField(X3BytesField, ByteField):
def i2repr(self, pkt, x):
return ByteField.i2repr(self, pkt, x)
class ShortField(Field): class ShortField(Field):
def __init__(self, name, default): def __init__(self, name, default):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment