Skip to content

Commit

Permalink
Merge pull request FRRouting#16720 from opensourcerouting/fix/default…
Browse files Browse the repository at this point in the history
…_originate_not_needed_if_not_enabled

bgpd: Do not scan update-groups if default-originate timer is set to 0
  • Loading branch information
riw777 committed Sep 18, 2024
2 parents d1af391 + 5b24d3b commit 6109043
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
3 changes: 2 additions & 1 deletion bgpd/bgp_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -3757,7 +3757,8 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_dest *dest,
if (old_select || new_select) {
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(
bm->master,
update_group_refresh_default_originate_route_map,
Expand Down
10 changes: 5 additions & 5 deletions bgpd/bgp_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -8417,7 +8417,7 @@ DEFPY (bgp_condadv_period,

DEFPY (bgp_def_originate_eval,
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
BGP_STR
"Control default-originate\n"
Expand All @@ -8426,8 +8426,7 @@ DEFPY (bgp_def_originate_eval,
{
VTY_DECLVAR_CONTEXT(bgp, bgp);

bgp->rmap_def_originate_eval_timer =
no ? RMAP_DEFAULT_ORIGINATE_EVAL_TIMER : timer;
bgp->rmap_def_originate_eval_timer = no ? 0 : timer;

if (bgp->t_rmap_def_originate_eval)
EVENT_OFF(bgp->t_rmap_def_originate_eval);
Expand Down Expand Up @@ -19792,8 +19791,9 @@ int bgp_config_write(struct vty *vty)
bgp->condition_check_period);

/* default-originate timer configuration */
if (bgp->rmap_def_originate_eval_timer !=
RMAP_DEFAULT_ORIGINATE_EVAL_TIMER)
if (bgp->rmap_def_originate_eval_timer &&
bgp->rmap_def_originate_eval_timer !=
RMAP_DEFAULT_ORIGINATE_EVAL_TIMER)
vty_out(vty, " bgp default-originate timer %u\n",
bgp->rmap_def_originate_eval_timer);

Expand Down
10 changes: 9 additions & 1 deletion bgpd/bgpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3527,7 +3527,7 @@ static struct bgp *bgp_create(as_t *as, const char *name,
bgp_addpath_init_bgp_data(&bgp->tx_addpath);
bgp->fast_convergence = false;
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
if (inst_type != BGP_INSTANCE_TYPE_VRF) {
Expand Down Expand Up @@ -5791,6 +5791,10 @@ int peer_default_originate_set(struct peer *peer, afi_t afi, safi_t safi,
subgrp = peer_subgroup(peer, afi, safi);

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
|| strcmp(rmap, peer->default_rmap[afi][safi].name) != 0) {
struct route_map *map = NULL;
Expand Down Expand Up @@ -5873,6 +5877,10 @@ int peer_default_originate_set(struct peer *peer, afi_t afi, safi_t safi,
if (rmap) {
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) {
map = route_map_lookup_by_name(
member->default_rmap[afi][safi].name);
Expand Down
4 changes: 3 additions & 1 deletion doc/user/bgp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1972,12 +1972,14 @@ Configuring Peers
and will not be displayed as part of a `show run`. The no form
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
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.

Setting to 0 turns off the scanning at all.

.. clicmd:: bgp default ipv4-unicast

This command allows the user to specify that the IPv4 Unicast address
Expand Down

0 comments on commit 6109043

Please sign in to comment.