VXLAN: more layer bindings

This commit is contained in:
Pierre LALET 2017-09-21 16:35:03 +02:00
parent d9be84f194
commit 113bdf5225
2 changed files with 8 additions and 2 deletions

View File

@ -68,6 +68,12 @@ bind_layers(UDP, VXLAN, dport=4789) # RFC standard vxlan port
bind_layers(UDP, VXLAN, dport=4790) # RFC standard vxlan-gpe port
bind_layers(UDP, VXLAN, dport=6633) # New IANA assigned port for use with NSH
bind_layers(UDP, VXLAN, dport=8472) # Linux implementation port
bind_layers(UDP, VXLAN, sport=4789)
bind_layers(UDP, VXLAN, sport=4790)
bind_layers(UDP, VXLAN, sport=6633)
bind_layers(UDP, VXLAN, sport=8472)
# By default, set both ports to the RFC standard
bind_layers(UDP, VXLAN, sport=4789, dport=4789)
bind_layers(VXLAN, Ether)
bind_layers(VXLAN, IP, NextProtocol=1)

View File

@ -7444,7 +7444,7 @@ p = Ether(dst="11:11:11:11:11:11", src="22:22:22:22:22:22")
p /= IP(src="1.1.1.1", dst="2.2.2.2") / UDP(sport=1111)
p /= VXLAN(flags=0x8, vni=42) / Ether() / IP()
p = Ether(str(p))
assert(p[UDP].dport == 8472)
assert(p[UDP].dport == 4789)
assert(p[Ether:2].type == 0x800)
= Build a VXLAN packet with next protocol field
@ -7452,7 +7452,7 @@ p = Ether(dst="11:11:11:11:11:11", src="22:22:22:22:22:22")
p /= IP(src="1.1.1.1", dst="2.2.2.2") / UDP(sport=1111)
p /= VXLAN(flags=0xC, vni=42, NextProtocol=3) / Ether() / IP()
p = Ether(str(p))
assert(p[UDP].dport == 8472)
assert(p[UDP].dport == 4789)
assert(p[VXLAN].reserved0 == 0x0)
assert(p[VXLAN].NextProtocol == 3)
assert(p[Ether:2].type == 0x800)