summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2022-05-04 11:26:09 +0200
committerNeale Ranns <neale@graphiant.com>2022-05-05 00:16:27 +0000
commit0ec1c6dc68570b8b824ff55205b4b133bffbf9e4 (patch)
treec611c5222225252ed632adfb572679e0efcb6031
parent6e7ebb00af73507eb67309c3f245388747b0aeab (diff)
udp: remove buggy assert in udp encap
It looks like in a distant past we were using a vnet_rewrite but this no longer the case. Type: fix Change-Id: Ib8d336aec7d5abd7749f543739f531144e76e551 Signed-off-by: Benoît Ganne <bganne@cisco.com>
-rw-r--r--src/vnet/udp/udp_inlines.h2
-rw-r--r--test/test_udp.py40
2 files changed, 38 insertions, 4 deletions
diff --git a/src/vnet/udp/udp_inlines.h b/src/vnet/udp/udp_inlines.h
index 915f891f8b9..025809e1873 100644
--- a/src/vnet/udp/udp_inlines.h
+++ b/src/vnet/udp/udp_inlines.h
@@ -142,8 +142,6 @@ ip_udp_encap_two (vlib_main_t *vm, vlib_buffer_t *b0, vlib_buffer_t *b1,
udp_header_t *udp0, *udp1;
int payload_ip4 = (payload_family == AF_IP4);
- ASSERT (vec_len (ec0) == vec_len (ec1));
-
if (payload_family < N_AF)
{
vnet_calc_checksums_inline (vm, b0, payload_ip4, !payload_ip4);
diff --git a/test/test_udp.py b/test/test_udp.py
index 81851055546..031867cf63d 100644
--- a/test/test_udp.py
+++ b/test/test_udp.py
@@ -105,6 +105,9 @@ class TestUdpEncap(VppTestCase):
#
# construct a UDP encap object through each of the peers
# v4 through the first two peers, v6 through the second.
+ # The last encap is v4 and is used to check the codepath
+ # where 2 different udp encap objects are processed at the
+ # same time
#
udp_encap_0 = VppUdpEncap(self,
self.pg0.local_ip4,
@@ -125,10 +128,15 @@ class TestUdpEncap(VppTestCase):
self.pg3.remote_ip6,
333, 443,
table_id=3)
+ udp_encap_4 = VppUdpEncap(self,
+ self.pg0.local_ip4,
+ self.pg0.remote_ip4,
+ 334, 444)
udp_encap_0.add_vpp_config()
udp_encap_1.add_vpp_config()
udp_encap_2.add_vpp_config()
udp_encap_3.add_vpp_config()
+ udp_encap_4.add_vpp_config()
self.logger.info(self.vapi.cli("sh udp encap"))
@@ -136,6 +144,7 @@ class TestUdpEncap(VppTestCase):
self.assertTrue(find_udp_encap(self, udp_encap_3))
self.assertTrue(find_udp_encap(self, udp_encap_0))
self.assertTrue(find_udp_encap(self, udp_encap_1))
+ self.assertTrue(find_udp_encap(self, udp_encap_4))
#
# Routes via each UDP encap object - all combinations of v4 and v6.
@@ -148,6 +157,16 @@ class TestUdpEncap(VppTestCase):
next_hop_id=udp_encap_0.id,
proto=FibPathProto.FIB_PATH_NH_PROTO_IP4)],
table_id=1)
+ # specific route to match encap4, to test encap of 2 packets using 2
+ # different encap
+ route_4o4_2 = VppIpRoute(
+ self, "1.1.0.2", 32,
+ [VppRoutePath("0.0.0.0",
+ 0xFFFFFFFF,
+ type=FibPathType.FIB_PATH_TYPE_UDP_ENCAP,
+ next_hop_id=udp_encap_4.id,
+ proto=FibPathProto.FIB_PATH_NH_PROTO_IP4)],
+ table_id=1)
route_4o6 = VppIpRoute(
self, "1.1.2.1", 32,
[VppRoutePath("0.0.0.0",
@@ -173,21 +192,38 @@ class TestUdpEncap(VppTestCase):
route_6o6.add_vpp_config()
route_6o4.add_vpp_config()
route_4o4.add_vpp_config()
+ route_4o4_2.add_vpp_config()
#
# 4o4 encap
+ # we add a single packet matching the last encap at the beginning of
+ # the packet vector so that we encap 2 packets with different udp
+ # encap object at the same time
#
p_4o4 = (Ether(src=self.pg1.remote_mac,
dst=self.pg1.local_mac) /
IP(src="2.2.2.2", dst="1.1.0.1") /
UDP(sport=1234, dport=1234) /
Raw(b'\xa5' * 100))
- rx = self.send_and_expect(self.pg1, p_4o4*NUM_PKTS, self.pg0)
+ p_4o4_2 = (Ether(src=self.pg1.remote_mac,
+ dst=self.pg1.local_mac) /
+ IP(src="2.2.2.2", dst="1.1.0.2") /
+ UDP(sport=1234, dport=1234) /
+ Raw(b'\xa5' * 100))
+ rx = self.send_and_expect(
+ self.pg1, p_4o4_2 * 1 + p_4o4 * (NUM_PKTS - 1), self.pg0)
+ # checking encap4 magic packet
+ p = rx.pop(0)
+ self.validate_outer4(p, udp_encap_4)
+ p = IP(p["UDP"].payload.load)
+ self.validate_inner4(p, p_4o4_2)
+ self.assertEqual(udp_encap_4.get_stats()['packets'], 1)
+ # checking remaining packets for encap0
for p in rx:
self.validate_outer4(p, udp_encap_0)
p = IP(p["UDP"].payload.load)
self.validate_inner4(p, p_4o4)
- self.assertEqual(udp_encap_0.get_stats()['packets'], NUM_PKTS)
+ self.assertEqual(udp_encap_0.get_stats()['packets'], NUM_PKTS - 1)
#
# 4o6 encap
n.h> /** * Creates a lis of Connection * * @return non-null An allocated list * @return null An error */ ConnectionList *connectionList_Create(void); /** * Destroys the list and all objects inside it */ void connectionList_Destroy(ConnectionList **listPtr); /** * @function connectionList_Append * @abstract Adds a connection entry to the list. * @discussion * Acquires a reference to the passed entry and stores it in the list. */ void connectionList_Append(ConnectionList *list, Connection *entry); /** * Returns the number of items on the list * @param [in] list The allocated list to check * @return number The number of items on the list */ size_t connectionList_Length(const ConnectionList *list); /** * @function connectionList_Get * @abstract Returns the connection entry. * @discussion * Caller must not destroy the returned value. If you will store the * entry in your own data structure, you should acquire your own reference. * Will assert if you go beyond the end of the list. * */ Connection *connectionList_Get(ConnectionList *list, size_t index); #endif // connectionList_h