]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: fix install BGP route with appropriate colored ext. community
authorPhilippe Guibert <philippe.guibert@6wind.com>
Thu, 21 Mar 2024 15:48:52 +0000 (16:48 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Thu, 4 Apr 2024 20:10:33 +0000 (22:10 +0200)
When receiving a BGP update that includes a colored extended community,
the nexthop is tracked in the bgp nexthop tracking context, but the
color is never recorded. Adding to this, the BGP route is not prevented
from being installed without hte color.

Actually, the srte color is set only when the SRTE_COLOR attribute is set.
And that attribute value is only set when an ext. community is locally
created, or an srte value is set, but not when a BGP update with a color
ext. community is received.

Fix this by setting the SRTE_COLOR attribute on this last case.

Fixes: 442e2edcfaef ("bgpd: add functions related to srte_color management")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
bgpd/bgp_attr.h

index 5386f24a0bacc32dfade24d1b5d055a496322829..164aa5ae795098fa0f4f64b9d9a5f86f894835f6 100644 (file)
@@ -517,9 +517,11 @@ static inline void bgp_attr_set_ecommunity(struct attr *attr,
 {
        attr->ecommunity = ecomm;
 
-       if (ecomm)
+       if (ecomm) {
                SET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES));
-       else
+               if (ecommunity_select_color(ecomm))
+                       SET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_SRTE_COLOR));
+       } else
                UNSET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES));
 }