Damjan Marion | f56b77a | 2016-10-03 19:44:57 +0200 | [diff] [blame] | 1 | from scapy.fields import BitField, XByteField, X3BytesField |
| 2 | from scapy.packet import Packet, bind_layers |
| 3 | from scapy.layers.l2 import Ether |
| 4 | from scapy.layers.inet import UDP |
| 5 | |
| 6 | |
| 7 | class VXLAN(Packet): |
| 8 | name = "VXLAN" |
| 9 | fields_desc = [BitField("flags", 0x08000000, 32), |
| 10 | X3BytesField("vni", 0), |
| 11 | XByteField("reserved", 0x00)] |
| 12 | |
| 13 | def mysummary(self): |
| 14 | return self.sprintf("VXLAN (vni=%VXLAN.vni%)") |
| 15 | |
| 16 | bind_layers(UDP, VXLAN, dport=4789) |
| 17 | bind_layers(VXLAN, Ether) |