project-everest / everparse

Automated generation of provably secure, zero-copy parsers from format specifications
https://project-everest.github.io/everparse
Apache License 2.0
251 stars 15 forks source link

VxLAN packets are two octets short. #112

Closed lemmy closed 11 months ago

lemmy commented 12 months ago

A VxLAN network identifier (VIN) is 24 bits/3 octets.

Found by assembling packets as part of 3DGen:

@lemmy ➜ /workspaces/RFC-3D (mku-tshark) $ ./validate_with_tshark.py 
Temporary directory created at: /tmp/tmptarwfqr8
Traceback (most recent call last):
  File "/workspaces/RFC-3D/./validate_with_tshark.py", line 47, in <module>
    vxlan = VXLAN(pkt_layer)
  File "/home/codespace/.python/current/lib/python3.10/site-packages/scapy/base_classes.py", line 399, in __call__
    i.__init__(*args, **kargs)
  File "/home/codespace/.python/current/lib/python3.10/site-packages/scapy/packet.py", line 165, in __init__
    self.dissect(_pkt)
  File "/home/codespace/.python/current/lib/python3.10/site-packages/scapy/packet.py", line 1029, in dissect
    s = self.do_dissect(s)
  File "/home/codespace/.python/current/lib/python3.10/site-packages/scapy/packet.py", line 986, in do_dissect
    s, fval = f.getfield(self, s)
  File "/home/codespace/.python/current/lib/python3.10/site-packages/scapy/fields.py", line 1046, in getfield
    return s[3:], self.m2i(pkt, struct.unpack(self.fmt, b"\x00" + s[:3])[0])  # noqa: E501
struct.error: unpack requires a buffer of 4 bytes