Skip to content

Commit ba9a215

Browse files
authored
Update VXLANTest destination port number (#528)
Based on RFC 7348, the default IANA-assigned destination UDP port number for VXLAN is 4789, not the source port number. Update the value in the VXLANTest class to align with the RFC. The VXLAN implementation still allows for the destination port number to be configurable to allow interoperability (as specified by the RFC), such as with the Linux kernel's default value of 8472. Signed-off-by: James Raphael Tiovalen <[email protected]>
1 parent 00619e0 commit ba9a215

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/src/vxlan_test.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ const uint8_t VXLANTest::expected_packet[PACKET_SIZE] = {
3434
};
3535

3636
const uint8_t VXLANTest::flags = 8;
37-
const uint16_t VXLANTest::dport = 19627;
38-
const uint16_t VXLANTest::sport = 4789;
37+
const uint16_t VXLANTest::dport = 4789;
38+
const uint16_t VXLANTest::sport = 19627;
3939
const uint16_t VXLANTest::p_type = 0xd0ab;
4040
const small_uint<24> VXLANTest::vni = 0xffffff;
4141
const IP::address_type VXLANTest::dst_ip = IP::address_type{"2.2.2.2"};
@@ -83,7 +83,11 @@ TEST_F(VXLANTest, ConstructorFromBuffer) {
8383

8484
TEST_F(VXLANTest, OuterUDP) {
8585
auto pkt = IP{dst_ip, src_ip} / UDP{dport, sport} / VXLAN{expected_packet, PACKET_SIZE};
86-
auto const vxlan = pkt.find_pdu<VXLAN>();
86+
auto const udp = pkt.find_pdu<UDP>();
87+
ASSERT_TRUE(udp != nullptr);
88+
EXPECT_EQ(udp->dport(), dport);
89+
EXPECT_EQ(udp->sport(), sport);
90+
auto const vxlan = udp->find_pdu<VXLAN>();
8791
ASSERT_TRUE(vxlan != nullptr);
8892
EXPECT_EQ(vxlan->get_flags(), flags);
8993
EXPECT_EQ(vxlan->get_vni(), vni);

0 commit comments

Comments
 (0)