fib: fix flags updates when adding routes with a udp encap path 07/32507/6
authorArthur de Kerhor <arthurdekerhor@gmail.com>
Tue, 1 Jun 2021 09:42:20 +0000 (11:42 +0200)
committerNeale Ranns <neale@graphiant.com>
Thu, 3 Jun 2021 14:12:54 +0000 (14:12 +0000)
When adding a route via a udp encap instance, FIB_ENTRY_FLAG_IMPORT
should not be set. In particular, fib_route_attached_cross_table should
always return false for such paths.
Modified test_udp_encap to leverage the bug that needed to be fixed.

Type: fix
Signed-off-by: Arthur de Kerhor <arthurdekerhor@gmail.com>
Change-Id: Iaa9489e96d1cff09751f92c62caf7999d924fd7f

src/vnet/fib/fib_entry_src.c
test/test_udp.py

index 503473a..1285734 100644 (file)
@@ -1504,7 +1504,7 @@ fib_route_attached_cross_table (const fib_entry_t *fib_entry,
      */
     if (ip46_address_is_zero(&rpath->frp_addr) &&
        (~0 != rpath->frp_sw_if_index) &&
-        !(rpath->frp_flags & FIB_ROUTE_PATH_DVR) &&
+        !(rpath->frp_flags & (FIB_ROUTE_PATH_DVR | FIB_ROUTE_PATH_UDP_ENCAP)) &&
        (fib_entry->fe_fib_index != 
         fib_table_get_index_for_sw_if_index(fib_entry_get_proto(fib_entry),
                                             rpath->frp_sw_if_index)))
index 3281c0d..df9a0af 100644 (file)
@@ -141,11 +141,11 @@ class TestUdpEncap(VppTestCase):
         # Routes via each UDP encap object - all combinations of v4 and v6.
         #
         route_4o4 = VppIpRoute(
-            self, "1.1.0.1", 32,
+            self, "1.1.0.1", 24,
             [VppRoutePath("0.0.0.0",
                           0xFFFFFFFF,
                           type=FibPathType.FIB_PATH_TYPE_UDP_ENCAP,
-                          next_hop_id=udp_encap_0.id)])
+                          next_hop_id=udp_encap_0.id)], table_id=1)
         route_4o6 = VppIpRoute(
             self, "1.1.2.1", 32,
             [VppRoutePath("0.0.0.0",
@@ -172,12 +172,12 @@ class TestUdpEncap(VppTestCase):
         #
         # 4o4 encap
         #
-        p_4o4 = (Ether(src=self.pg0.remote_mac,
-                       dst=self.pg0.local_mac) /
+        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.pg0, p_4o4*NUM_PKTS, self.pg0)
+        rx = self.send_and_expect(self.pg1, p_4o4*NUM_PKTS, self.pg0)
         for p in rx:
             self.validate_outer4(p, udp_encap_0)
             p = IP(p["UDP"].payload.load)