]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Do not send routes back received from a peer
authorDonatas Abraitis <donatas@opensourcerouting.org>
Thu, 5 Jan 2023 08:25:38 +0000 (10:25 +0200)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Sat, 14 Jan 2023 19:30:07 +0000 (21:30 +0200)
Before this patch, we needed to explicitly define a neighbor to be SOLO
(= separate update-group). Let's ease this functionality for an operator to
avoid confusions.

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

index 87871573f000437d062bb54bc8cff5fcc42907e2..40f29dac5c28771f2e0ec0e64f96ffdb621d78e2 100644 (file)
@@ -2188,12 +2188,12 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi,
        }
 
        /* AS path loop check. */
-       if (onlypeer && onlypeer->as_path_loop_detection
-           && aspath_loop_check(piattr->aspath, onlypeer->as)) {
+       if (peer->as_path_loop_detection &&
+           aspath_loop_check(piattr->aspath, peer->as)) {
                if (bgp_debug_update(NULL, p, subgrp->update_group, 0))
                        zlog_debug(
                                "%pBP [Update:SEND] suppress announcement to peer AS %u that is part of AS path.",
-                               onlypeer, onlypeer->as);
+                               peer, peer->as);
                return false;
        }
 
index afd2107b48fbc7720a02b2d407d8e1f9c16c2645..9ca57f08daa55ffb2205a597c2f44aa7a67df4e2 100644 (file)
@@ -164,6 +164,7 @@ static void conf_copy(struct peer *dst, struct peer *src, afi_t afi,
        dst->change_local_as = src->change_local_as;
        dst->shared_network = src->shared_network;
        dst->local_role = src->local_role;
+       dst->as_path_loop_detection = src->as_path_loop_detection;
 
        if (src->soo[afi][safi]) {
                ecommunity_free(&dst->soo[afi][safi]);
@@ -360,6 +361,9 @@ static unsigned int updgrp_hash_key_make(const void *p)
        key = jhash_1word(peer->max_packet_size, key);
        key = jhash_1word(peer->pmax_out[afi][safi], key);
 
+       if (peer->as_path_loop_detection)
+               key = jhash_2words(peer->as, peer->as_path_loop_detection, key);
+
        if (peer->group)
                key = jhash_1word(jhash(peer->group->name,
                                        strlen(peer->group->name), SEED1),
@@ -454,12 +458,13 @@ static unsigned int updgrp_hash_key_make(const void *p)
                        (intmax_t)CHECK_FLAG(peer->flags, PEER_UPDGRP_FLAGS),
                        (intmax_t)CHECK_FLAG(flags, PEER_UPDGRP_AF_FLAGS));
                zlog_debug(
-                       "%pBP Update Group Hash: addpath: %u UpdGrpCapFlag: %u UpdGrpCapAFFlag: %u route_adv: %u change local as: %u",
+                       "%pBP Update Group Hash: addpath: %u UpdGrpCapFlag: %u UpdGrpCapAFFlag: %u route_adv: %u change local as: %u, as_path_loop_detection: %d",
                        peer, (uint32_t)peer->addpath_type[afi][safi],
                        CHECK_FLAG(peer->cap, PEER_UPDGRP_CAP_FLAGS),
                        CHECK_FLAG(peer->af_cap[afi][safi],
                                   PEER_UPDGRP_AF_CAP_FLAGS),
-                       peer->v_routeadv, peer->change_local_as);
+                       peer->v_routeadv, peer->change_local_as,
+                       peer->as_path_loop_detection);
                zlog_debug(
                        "%pBP Update Group Hash: max packet size: %u pmax_out: %u Peer Group: %s rmap out: %s",
                        peer, peer->max_packet_size, peer->pmax_out[afi][safi],