linux-cp: fix multicast route setup with lcp-sync 08/43808/1 stable/2510 v25.10-rc2
authorMatthew Smith <[email protected]>
Mon, 22 Sep 2025 13:32:29 +0000 (08:32 -0500)
committerMatthew Smith <[email protected]>
Wed, 8 Oct 2025 17:59:07 +0000 (17:59 +0000)
Type: fix
Fixes: 344dab5a22e1

Code which tries to avoid removing multicast routes prematurely or
adding them multiple times causes problems when lcp-sync is enabled. At
the time the decision is made whether this is the first interface
address added, multiple addresses may already configured on the VPP
interface. This causes the route to not be added.

Retain the check which avoids premature removal and remove the one
which tries to avoid adding the route multiple times. Adding the route
more than once is innocuous.

Signed-off-by: Matthew Smith <[email protected]>
Change-Id: I2a29f87db5ba97e847a6e29ad2283386b1f1dc7b
(cherry picked from commit bf440243c1f854a97e0084d268d68f5f5e8e2b9e)

src/plugins/linux-cp/lcp_router.c

index 342cafc..ec2704b 100644 (file)
@@ -664,28 +664,6 @@ lcp_router_count_interface_addresses (u32 sw_if_index, u8 address_family)
   return count;
 }
 
-static void
-lcp_router_update_mroutes_ip4_on_addr_change (u32 sw_if_index, int is_del)
-{
-  u32 count_after;
-
-  count_after = lcp_router_count_interface_addresses (sw_if_index, AF_IP4);
-
-  if ((!is_del && count_after == 1) || (is_del && count_after == 0))
-    lcp_router_ip4_mroutes_add_del (sw_if_index, !is_del);
-}
-
-static void
-lcp_router_update_mroutes_ip6_on_addr_change (u32 sw_if_index, int is_del)
-{
-  u32 count_after;
-
-  count_after = lcp_router_count_interface_addresses (sw_if_index, AF_IP6);
-
-  if ((!is_del && count_after == 1) || (is_del && count_after == 0))
-    lcp_router_ip6_mroutes_add_del (sw_if_index, !is_del);
-}
-
 static void
 lcp_router_link_addr_add_del (struct rtnl_addr *rla, int is_del)
 {
@@ -704,7 +682,9 @@ lcp_router_link_addr_add_del (struct rtnl_addr *rla, int is_del)
          ip4_add_del_interface_address (
            vlib_get_main (), sw_if_index, &ip_addr_v4 (&nh),
            rtnl_addr_get_prefixlen (rla), is_del);
-         lcp_router_update_mroutes_ip4_on_addr_change (sw_if_index, is_del);
+         if (!is_del ||
+             !lcp_router_count_interface_addresses (sw_if_index, AF_IP4))
+           lcp_router_ip4_mroutes_add_del (sw_if_index, !is_del);
        }
       else if (AF_IP6 == ip_addr_version (&nh))
        {
@@ -720,7 +700,9 @@ lcp_router_link_addr_add_del (struct rtnl_addr *rla, int is_del)
            ip6_add_del_interface_address (
              vlib_get_main (), sw_if_index, &ip_addr_v6 (&nh),
              rtnl_addr_get_prefixlen (rla), is_del);
-         lcp_router_update_mroutes_ip6_on_addr_change (sw_if_index, is_del);
+         if (!is_del ||
+             !lcp_router_count_interface_addresses (sw_if_index, AF_IP6))
+           lcp_router_ip6_mroutes_add_del (sw_if_index, !is_del);
        }
 
       LCP_ROUTER_DBG ("link-addr: %U %U/%d", format_vnet_sw_if_index_name,