From 52979c3baa1981c03d312e0944029b32d13ac56a Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 12 Jan 2022 09:49:59 -0500 Subject: [PATCH] bgpd: Remove unneeded loop over all peers The bgp_notify_conditional_adv_scanner function was/is looping over all peers. And only matching on the passed in peer, based upon the subgroup. As such we do not need to loop over everything and just cut-to-the chase and just modify the peer structure. Signed-off-by: Donald Sharp --- bgpd/bgp_route.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 3836d5f24b..5318ee28ee 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -1803,27 +1803,18 @@ void bgp_attr_add_gshut_community(struct attr *attr) /* Notify BGP Conditional advertisement scanner process. */ void bgp_notify_conditional_adv_scanner(struct update_subgroup *subgrp) { - struct peer *temp_peer; struct peer *peer = SUBGRP_PEER(subgrp); - struct listnode *temp_node, *temp_nnode = NULL; afi_t afi = SUBGRP_AFI(subgrp); safi_t safi = SUBGRP_SAFI(subgrp); - struct bgp *bgp = SUBGRP_INST(subgrp); struct bgp_filter *filter = &peer->filter[afi][safi]; if (!ADVERTISE_MAP_NAME(filter)) return; - for (ALL_LIST_ELEMENTS(bgp->peer, temp_node, temp_nnode, temp_peer)) { - if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) - continue; + if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) + return; - if (peer != temp_peer) - continue; - - temp_peer->advmap_table_change = true; - break; - } + peer->advmap_table_change = true; }