From 113bdf5225105c6ae702ab83ea5512ab8d228884 Mon Sep 17 00:00:00 2001 From: Pierre LALET Date: Thu, 21 Sep 2017 16:35:03 +0200 Subject: [PATCH] VXLAN: more layer bindings --- scapy/layers/vxlan.py | 6 ++++++ test/regression.uts | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/scapy/layers/vxlan.py b/scapy/layers/vxlan.py index 5eb3e2bb3..378c13a08 100644 --- a/scapy/layers/vxlan.py +++ b/scapy/layers/vxlan.py @@ -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) diff --git a/test/regression.uts b/test/regression.uts index b801e8da8..eb61f3163 100644 --- a/test/regression.uts +++ b/test/regression.uts @@ -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)