]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Pass non-transitive ext-communities between Route Server and RS clients
authorDonatas Abraitis <donatas@opensourcerouting.org>
Wed, 13 Apr 2022 17:40:30 +0000 (20:40 +0300)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Sat, 16 Apr 2022 11:58:12 +0000 (14:58 +0300)
https://datatracker.ietf.org/doc/html/rfc7947#section-2.2

Optional recognized and unrecognized BGP attributes,
   whether transitive or non-transitive, SHOULD NOT be updated by the
   route server (unless enforced by local IXP operator configuration)
   and SHOULD be passed on to other route server clients.

By default LB ext-community works with iBGP peers. When we receive a route
from eBGP peer, we can send LB ext-community to iBGP peers.

With this patch, allow sending LB ext-community to iBGP/eBGP peers if they
are set as RS clients.

FRR does not send non-transitive ext-communities to eBGP peers, but for
example GoBGP sends and if it's set as RS client, we should pass those attributes
towards another RS client.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd/bgp_attr.c

index 6c472e14971c40b9db39590af0f318fe82a7b06b..6ee31f9a9f8299e4b6fcbc4ab45bd4d156edd427 100644 (file)
@@ -4183,8 +4183,14 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer,
        /* Extended Communities attribute. */
        if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)
            && (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_EXT_COMMUNITIES))) {
-               if (peer->sort == BGP_PEER_IBGP
-                   || peer->sort == BGP_PEER_CONFED) {
+               bool transparent = CHECK_FLAG(peer->af_flags[afi][safi],
+                                             PEER_FLAG_RSERVER_CLIENT) &&
+                                  from &&
+                                  CHECK_FLAG(from->af_flags[afi][safi],
+                                             PEER_FLAG_RSERVER_CLIENT);
+
+               if (peer->sort == BGP_PEER_IBGP ||
+                   peer->sort == BGP_PEER_CONFED || transparent) {
                        if (attr->ecommunity->size * 8 > 255) {
                                stream_putc(s,
                                            BGP_ATTR_FLAG_OPTIONAL