Commit b262d71540 for frr

commit b262d7154082f820db28067bb27fd41d36551672
Author: Philippe Guibert <philippe.guibert@6wind.com>
Date:   Fri Jul 31 17:24:24 2026 +0200

    bgpd: fix do not select MPLS VPN path when srv6-only set with SRv6 path

    When a device configured in SRv6 receives 2 SRv6 and MPLS BGP VPN
    updates, when MPLS VPN prefix is preferred, then by default, the
    imported MPLS prefix is prefered.

    This goes against the default behavior of a device configured in SRv6:
    only the below command should consider also imported MPLS updates.

    > router bgp 2
    >  segment-routing srv6
    >   no srv6-only

    Actually, when the VPN updates are imported in the VRF, there is a
    missing piece of code that checks the above status of the command.

    Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>

diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
index f8d7240c26..a7c24d77c2 100644
--- a/bgpd/bgp_nht.c
+++ b/bgpd/bgp_nht.c
@@ -130,6 +130,9 @@ static int bgp_isvalid_nexthop_for_mpls(struct bgp_nexthop_cache *bnc,
 static bool bgp_isvalid_nexthop_for_l3vpn(struct bgp_nexthop_cache *bnc,
 					  struct bgp_path_info *path)
 {
+	struct bgp_table *table;
+	bool nh_valid;
+
 	if (bgp_zebra_num_connects() == 0)
 		return 1;

@@ -143,13 +146,23 @@ static bool bgp_isvalid_nexthop_for_l3vpn(struct bgp_nexthop_cache *bnc,
 			return 1;
 		return 0;
 	}
+
 	/*
 	 * In the case of MPLS-VPN, the label is learned from LDP or other
 	 * protocols, and nexthop tracking is enabled for the label.
 	 * The value is recorded as BGP_NEXTHOP_LABELED_VALID.
 	 * - Otherwise check for mpls-gre acceptance
 	 */
-	return bgp_isvalid_nexthop_for_mpls(bnc, path);
+	nh_valid = bgp_isvalid_nexthop_for_mpls(bnc, path);
+
+	table = path->net ? bgp_dest_table(path->net) : NULL;
+	if (nh_valid && table && bnc->bgp->srv6_only &&
+	    ((bgp_srv6_locator_is_configured(bnc->bgp) ||
+	      (table->bgp && bgp_srv6_locator_is_configured(table->bgp)))))
+		/* Control if srv6/mpls coexistence is autorised */
+		nh_valid = false;
+
+	return nh_valid;
 }

 static void bgp_unlink_nexthop_check(struct bgp_nexthop_cache *bnc)