Commit 73a890cfd5 for frr
commit 73a890cfd59a1559fcaf01e1e1574f25e57107a9
Author: Philippe Guibert <philippe.guibert@6wind.com>
Date: Fri Nov 6 10:31:22 2026 +0100
bgpd: send the color of a received color extended community to zebra
A BGP route received with a color extended community is installed in
zebra without its color, and can not be steered in the SR policy of
this color. For instance, rt6 advertises 9.9.9.2/32 to rt1 with the
color 1, and rt1 does not color the route itself:
> rt6:
> route-map COLOR permit 10
> set extcommunity color 00:1
> router bgp 1
> address-family ipv4 unicast
> neighbor 1.1.1.1 route-map COLOR out
BGP tracks the colored nexthop, but the route installed in zebra has no
"SR-TE color 1" on its recursive nexthop:
> rt1# show bgp nexthop
> [..]
> SR-TE color 1 - 6.6.6.6 valid [IGP metric 40], #paths 1
> rt1# show ip route
> [..]
> B> 9.9.9.2/32 [200/0] via 6.6.6.6 (recursive), weight 1, 00:01:16
> * via 10.0.1.2, eth-sw1, label 16060, weight 1, 00:01:16
> * via 10.0.1.3, eth-sw1, label 16060, weight 1, 00:01:16
bgp_zebra_announce_actual() puts the color in each zapi nexthop with
bgp_path_info_get_srte_color(), which falls back on the color extended
community. But it only sets ZAPI_MESSAGE_SRTE when the color is set
locally by the "set sr-te color" route-map command. Without this flag,
zebra ignores the color of the nexthops, and resolves them without the
SR policy. The received color extended community was taken into account
by 37488b573f5e ("bgpd: fix install BGP route with appropriate colored
ext. community"), but this was lost when the SRTE_COLOR attribute flag
was dropped.
Fix this by setting ZAPI_MESSAGE_SRTE when the path has a color,
whatever its origin.
Fixes: 619321de784a ("bgpd: Drop SRTE_COLOR attribute flag")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index 304720792e..cba9ec1b19 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -1648,7 +1648,7 @@ enum zclient_send_status bgp_zebra_announce_actual(struct bgp_dest *dest,
api.tableid = info->attr->rmap_table_id;
}
- if (info->extra && info->extra->srte_color)
+ if (bgp_path_info_get_srte_color(info))
SET_FLAG(api.message, ZAPI_MESSAGE_SRTE);
/* Metric is currently based on the best-path only */