]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Start conditional advertisement timer instantly 11515/head
authorDonatas Abraitis <donatas@opensourcerouting.org>
Fri, 1 Jul 2022 12:16:24 +0000 (15:16 +0300)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Fri, 1 Jul 2022 12:22:06 +0000 (15:22 +0300)
Do not wait for the configured timer to expire if we enable advertise-map.

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

index d672cf2abecdf0431d903702113a63fbdde08369..9c2826fa13d7de2b354ac6e4d5e4566b1005d783 100644 (file)
@@ -315,8 +315,9 @@ void bgp_conditional_adv_enable(struct peer *peer, afi_t afi, safi_t safi)
        }
 
        /* Register for conditional routes polling timer */
-       thread_add_timer(bm->master, bgp_conditional_adv_timer, bgp,
-                        bgp->condition_check_period, &bgp->t_condition_check);
+       if (!thread_is_scheduled(bgp->t_condition_check))
+               thread_add_timer(bm->master, bgp_conditional_adv_timer, bgp, 0,
+                                &bgp->t_condition_check);
 }
 
 void bgp_conditional_adv_disable(struct peer *peer, afi_t afi, safi_t safi)
index cea689ad8c3116cb57a2be4baea506e7ef9e4ee1..0bfcf5163fa83c10da2ef1164f6ee77f581ae64c 100644 (file)
@@ -7228,15 +7228,12 @@ static void peer_advertise_map_filter_update(struct peer *peer, afi_t afi,
                filter->advmap.update_type = UPDATE_TYPE_ADVERTISE;
                bgp_conditional_adv_enable(peer, afi, safi);
        }
+
+       /* Process peer route updates. */
+       peer_on_policy_change(peer, afi, safi, 1);
 }
 
-/* Set advertise-map to the peer but do not process peer route updates here.  *
- * Hold filter changes until the conditional routes polling thread is called  *
- * AS we need to advertise/withdraw prefixes (in advertise-map) based on the  *
- * condition (exist-map/non-exist-map) and routes(specified in condition-map) *
- * in BGP table. So do not call peer_on_policy_change() here, only create     *
- * polling timer thread, update filters and increment condition_filter_count.
- */
+/* Set advertise-map to the peer. */
 int peer_advertise_map_set(struct peer *peer, afi_t afi, safi_t safi,
                           const char *advertise_name,
                           struct route_map *advertise_map,
@@ -7316,7 +7313,6 @@ int peer_advertise_map_unset(struct peer *peer, afi_t afi, safi_t safi,
                                   __func__, peer->host,
                                   get_afi_safi_str(afi, safi, false));
 
-               peer_on_policy_change(peer, afi, safi, 1);
                return 0;
        }
 
@@ -7339,8 +7335,6 @@ int peer_advertise_map_unset(struct peer *peer, afi_t afi, safi_t safi,
                        zlog_debug("%s: Send normal update to %s for %s ",
                                   __func__, member->host,
                                   get_afi_safi_str(afi, safi, false));
-
-               peer_on_policy_change(member, afi, safi, 1);
        }
 
        return 0;