summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2022-07-01 15:16:24 +0300
committerDonatas Abraitis <donatas@opensourcerouting.org>2022-07-01 15:22:06 +0300
commit06bb44c884e988d9ebed5176a7fd1bcf1b0f8afc (patch)
tree65a4296f1be4af8bd99738b277b537368f5baa84
parentecf2b628d9914ae0a6dc653a2a7d28d65653fe18 (diff)
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>
-rw-r--r--bgpd/bgp_conditional_adv.c5
-rw-r--r--bgpd/bgpd.c14
2 files changed, 7 insertions, 12 deletions
diff --git a/bgpd/bgp_conditional_adv.c b/bgpd/bgp_conditional_adv.c
index d672cf2abe..9c2826fa13 100644
--- a/bgpd/bgp_conditional_adv.c
+++ b/bgpd/bgp_conditional_adv.c
@@ -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)
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index cea689ad8c..0bfcf5163f 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -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;