]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Respect BLACKHOLE community for internal BGP peering also 16651/head
authorDonatas Abraitis <donatas@opensourcerouting.org>
Tue, 27 Aug 2024 07:08:54 +0000 (10:08 +0300)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Tue, 27 Aug 2024 07:08:54 +0000 (10:08 +0300)
rfc7999 does not define to use this technique ONLY for EBGP sessions.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd/bgp_route.c
doc/user/bgp.rst

index 4887f3592a37d67666629c403ed5e8d215762477..0250ae18e8db1566bff9531059cc897a232599e7 100644 (file)
@@ -4793,22 +4793,21 @@ void bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
                                                false);
        }
 
-       if (peer->sort == BGP_PEER_EBGP) {
-
-               /* rfc7999:
-                * A BGP speaker receiving an announcement tagged with the
-                * BLACKHOLE community SHOULD add the NO_ADVERTISE or
-                * NO_EXPORT community as defined in RFC1997, or a
-                * similar community, to prevent propagation of the
-                * prefix outside the local AS. The community to prevent
-                * propagation SHOULD be chosen according to the operator's
-                * routing policy.
-                */
-               if (bgp_attr_get_community(&new_attr) &&
-                   community_include(bgp_attr_get_community(&new_attr),
-                                     COMMUNITY_BLACKHOLE))
-                       bgp_attr_add_no_export_community(&new_attr);
+       /* rfc7999:
+        * A BGP speaker receiving an announcement tagged with the
+        * BLACKHOLE community SHOULD add the NO_ADVERTISE or
+        * NO_EXPORT community as defined in RFC1997, or a
+        * similar community, to prevent propagation of the
+        * prefix outside the local AS. The community to prevent
+        * propagation SHOULD be chosen according to the operator's
+        * routing policy.
+        */
+       if (bgp_attr_get_community(&new_attr) &&
+           community_include(bgp_attr_get_community(&new_attr),
+                             COMMUNITY_BLACKHOLE))
+               bgp_attr_add_no_export_community(&new_attr);
 
+       if (peer->sort == BGP_PEER_EBGP) {
                /* If we receive the graceful-shutdown community from an eBGP
                 * peer we must lower local-preference */
                if (bgp_attr_get_community(&new_attr) &&
index a569a9af2889248926d7b78140cd2ef7a3ff2038..aa62d274f03f19b542326aeed2ac3cf4d5991394 100644 (file)
@@ -2482,7 +2482,7 @@ is 4 octet long. The following format is used to define the community value.
 ``blackhole``
    ``blackhole`` represents well-known communities value ``BLACKHOLE``
    ``0xFFFF029A`` ``65535:666``. :rfc:`7999` documents sending prefixes to
-   EBGP peers and upstream for the purpose of blackholing traffic.
+   peers and upstream for the purpose of blackholing traffic.
    Prefixes tagged with the this community should normally not be
    re-advertised from neighbors of the originating network. Upon receiving
    ``BLACKHOLE`` community from a BGP speaker, ``NO_ADVERTISE`` community