Commit c0fae7916f for frr

commit c0fae7916f82d6b3a08237847ace8917b1f14f86
Author: Brad House <bhouse@nexthop.ai>
Date:   Fri Oct 9 10:33:22 2026 +0000

    bgpd: keep sticky flag when MAC mobility has a seq

    A local MAC that was remote before and is now learned locally as sticky
    (static) has a local sequence number above 0. bgpd advertises it without
    the sticky flag:

    - build_evpn_route_extcomm() adds the MAC Mobility extended community
      with the sticky flag and sequence 0.
    - update_evpn_route_entry() then calls add_mac_mobility_to_attr() for
      the sequence number, which rewrites that same community with the
      flag cleared.

    The receiver sees "MM:<seq>" without "sticky MAC" and installs a plain,
    non-sticky remote MAC, although the MAC is sticky on the advertising
    VTEP. A sticky MAC that was never remote (sequence 0) skips the
    rewrite, so only moved MACs are affected.

    RFC 7432 section 7.7 carries both the sticky flag and the sequence
    number in the one MAC Mobility community, so encode the flag from the
    route's attribute when the sequence number is added. Every path that
    advertises a local MAC route with a sequence number above 0 (the VNI
    table route, its copy to the global table, and re-advertisement) goes
    through add_mac_mobility_to_attr().

    Signed-off-by: Brad House <bhouse@nexthop.ai>

diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index 86c7d2f18e..8c6ca9b047 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -1476,8 +1476,9 @@ static void add_mac_mobility_to_attr(uint32_t seq_num, struct attr *attr)
 	int sub_type = 0;
 	struct ecommunity *ecomm = bgp_attr_get_ecommunity(attr);

-	/* Build MM */
-	encode_mac_mobility_extcomm(0, seq_num, &eval);
+	/* MM carries the sticky flag and the seq in one community (RFC 7432 7.7) */
+	encode_mac_mobility_extcomm(!!CHECK_FLAG(attr->evpn_flags, ATTR_EVPN_FLAG_STICKY), seq_num,
+				    &eval);

 	/* Find current MM ecommunity */
 	ecom_val_ptr = NULL;