Merge pull request #16720 from opensourcerouting/fix/default_originate_not_needed_if_not_enabled

bgpd: Do not scan update-groups if default-originate timer is set to 0
This commit is contained in:
Russ White 2024-09-18 10:11:23 -04:00 committed by GitHub
commit 6109043c54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 19 additions and 8 deletions

View File

@ -3757,7 +3757,8 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_dest *dest,
if (old_select || new_select) { if (old_select || new_select) {
bgp_bump_version(dest); bgp_bump_version(dest);
if (!bgp->t_rmap_def_originate_eval) if (!bgp->t_rmap_def_originate_eval &&
bgp->rmap_def_originate_eval_timer)
event_add_timer( event_add_timer(
bm->master, bm->master,
update_group_refresh_default_originate_route_map, update_group_refresh_default_originate_route_map,

View File

@ -8417,7 +8417,7 @@ DEFPY (bgp_condadv_period,
DEFPY (bgp_def_originate_eval, DEFPY (bgp_def_originate_eval,
bgp_def_originate_eval_cmd, bgp_def_originate_eval_cmd,
"[no$no] bgp default-originate timer (0-3600)$timer", "[no$no] bgp default-originate timer (0-65535)$timer",
NO_STR NO_STR
BGP_STR BGP_STR
"Control default-originate\n" "Control default-originate\n"
@ -8426,8 +8426,7 @@ DEFPY (bgp_def_originate_eval,
{ {
VTY_DECLVAR_CONTEXT(bgp, bgp); VTY_DECLVAR_CONTEXT(bgp, bgp);
bgp->rmap_def_originate_eval_timer = bgp->rmap_def_originate_eval_timer = no ? 0 : timer;
no ? RMAP_DEFAULT_ORIGINATE_EVAL_TIMER : timer;
if (bgp->t_rmap_def_originate_eval) if (bgp->t_rmap_def_originate_eval)
EVENT_OFF(bgp->t_rmap_def_originate_eval); EVENT_OFF(bgp->t_rmap_def_originate_eval);
@ -19792,8 +19791,9 @@ int bgp_config_write(struct vty *vty)
bgp->condition_check_period); bgp->condition_check_period);
/* default-originate timer configuration */ /* default-originate timer configuration */
if (bgp->rmap_def_originate_eval_timer != if (bgp->rmap_def_originate_eval_timer &&
RMAP_DEFAULT_ORIGINATE_EVAL_TIMER) bgp->rmap_def_originate_eval_timer !=
RMAP_DEFAULT_ORIGINATE_EVAL_TIMER)
vty_out(vty, " bgp default-originate timer %u\n", vty_out(vty, " bgp default-originate timer %u\n",
bgp->rmap_def_originate_eval_timer); bgp->rmap_def_originate_eval_timer);

View File

@ -3527,7 +3527,7 @@ static struct bgp *bgp_create(as_t *as, const char *name,
bgp_addpath_init_bgp_data(&bgp->tx_addpath); bgp_addpath_init_bgp_data(&bgp->tx_addpath);
bgp->fast_convergence = false; bgp->fast_convergence = false;
bgp->llgr_stale_time = BGP_DEFAULT_LLGR_STALE_TIME; bgp->llgr_stale_time = BGP_DEFAULT_LLGR_STALE_TIME;
bgp->rmap_def_originate_eval_timer = RMAP_DEFAULT_ORIGINATE_EVAL_TIMER; bgp->rmap_def_originate_eval_timer = 0;
#ifdef ENABLE_BGP_VNC #ifdef ENABLE_BGP_VNC
if (inst_type != BGP_INSTANCE_TYPE_VRF) { if (inst_type != BGP_INSTANCE_TYPE_VRF) {
@ -5791,6 +5791,10 @@ int peer_default_originate_set(struct peer *peer, afi_t afi, safi_t safi,
subgrp = peer_subgroup(peer, afi, safi); subgrp = peer_subgroup(peer, afi, safi);
if (rmap) { if (rmap) {
if (!peer->bgp->rmap_def_originate_eval_timer)
peer->bgp->rmap_def_originate_eval_timer =
RMAP_DEFAULT_ORIGINATE_EVAL_TIMER;
if (!peer->default_rmap[afi][safi].name if (!peer->default_rmap[afi][safi].name
|| strcmp(rmap, peer->default_rmap[afi][safi].name) != 0) { || strcmp(rmap, peer->default_rmap[afi][safi].name) != 0) {
struct route_map *map = NULL; struct route_map *map = NULL;
@ -5873,6 +5877,10 @@ int peer_default_originate_set(struct peer *peer, afi_t afi, safi_t safi,
if (rmap) { if (rmap) {
struct route_map *map = NULL; struct route_map *map = NULL;
if (!member->bgp->rmap_def_originate_eval_timer)
member->bgp->rmap_def_originate_eval_timer =
RMAP_DEFAULT_ORIGINATE_EVAL_TIMER;
if (member->default_rmap[afi][safi].name) { if (member->default_rmap[afi][safi].name) {
map = route_map_lookup_by_name( map = route_map_lookup_by_name(
member->default_rmap[afi][safi].name); member->default_rmap[afi][safi].name);

View File

@ -1972,12 +1972,14 @@ Configuring Peers
and will not be displayed as part of a `show run`. The no form and will not be displayed as part of a `show run`. The no form
of the command turns off this ability. of the command turns off this ability.
.. clicmd:: bgp default-originate timer (0-3600) .. clicmd:: bgp default-originate timer (0-65535)
Set the period to rerun the default-originate route-map scanner process. The Set the period to rerun the default-originate route-map scanner process. The
default is 5 seconds. With a full routing table, it might be useful to increase default is 5 seconds. With a full routing table, it might be useful to increase
this setting to avoid scanning the whole BGP table aggressively. this setting to avoid scanning the whole BGP table aggressively.
Setting to 0 turns off the scanning at all.
.. clicmd:: bgp default ipv4-unicast .. clicmd:: bgp default ipv4-unicast
This command allows the user to specify that the IPv4 Unicast address This command allows the user to specify that the IPv4 Unicast address