bgpd: Start conditional advertisement timer instantly

Do not wait for the configured timer to expire if we enable advertise-map.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
Donatas Abraitis 2022-07-01 15:16:24 +03:00
parent ecf2b628d9
commit 06bb44c884
2 changed files with 7 additions and 12 deletions

View 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)

View 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;