From: Daniel Walton Date: Tue, 10 Nov 2015 15:33:24 +0000 (+0000) Subject: Quagga default: BGP "no-as-set" should be the default for "bgp as-path multipath... X-Git-Tag: frr-2.0-rc1~1202 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=219178b6ba7efa520e4d19971f0021ff23ce0742;p=matthieu%2Ffrr.git Quagga default: BGP "no-as-set" should be the default for "bgp as-path multipath-relax" Signed-off-by: Daniel Walton Reviewed-by: Donald Sharp Ticket: CM-7928 --- diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c index 14fb49c38b..30eefdb5fe 100644 --- a/bgpd/bgp_mpath.c +++ b/bgpd/bgp_mpath.c @@ -621,7 +621,7 @@ bgp_info_mpath_aggregate_update (struct bgp_info *new_best, struct aspath *aspath; struct aspath *asmerge; struct attr *new_attr, *old_attr; - u_char origin, attr_chg; + u_char origin; struct community *community, *commerge; struct ecommunity *ecomm, *ecommerge; struct attr_extra *ae; @@ -648,41 +648,10 @@ bgp_info_mpath_aggregate_update (struct bgp_info *new_best, return; } - /* - * Bail out here if the following is true: - * - MULTIPATH_CHG bit is not set on new_best, and - * - No change in bestpath, and - * - ATTR_CHANGED bit is not set on new_best or any of the multipaths - */ - if (!CHECK_FLAG (new_best->flags, BGP_INFO_MULTIPATH_CHG) && - (old_best == new_best)) - { - attr_chg = 0; - - if (CHECK_FLAG (new_best->flags, BGP_INFO_ATTR_CHANGED)) - attr_chg = 1; - else - for (mpinfo = bgp_info_mpath_first (new_best); mpinfo; - mpinfo = bgp_info_mpath_next (mpinfo)) - { - if (CHECK_FLAG (mpinfo->flags, BGP_INFO_ATTR_CHANGED)) - { - attr_chg = 1; - break; - } - } - - if (!attr_chg) - { - assert (bgp_info_mpath_attr (new_best)); - return; - } - } - bgp_attr_dup (&attr, new_best->attr); if (new_best->peer && - !bgp_flag_check (new_best->peer->bgp, BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET)) + bgp_flag_check (new_best->peer->bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET)) { /* aggregate attribute from multipath constituents */ diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index c71baa2a1e..6bbb5d8dd3 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -1919,76 +1919,47 @@ DEFUN (no_bgp_bestpath_aspath_confed, /* "bgp bestpath as-path multipath-relax" configuration. */ DEFUN (bgp_bestpath_aspath_multipath_relax, bgp_bestpath_aspath_multipath_relax_cmd, - "bgp bestpath as-path multipath-relax", - "BGP specific commands\n" - "Change the default bestpath selection\n" - "AS-path attribute\n" - "Allow load sharing across routes that have different AS paths (but same length)\n") -{ - struct bgp *bgp; - - bgp = vty->index; - bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); - bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET); - bgp_recalculate_all_bestpaths (bgp); - - return CMD_SUCCESS; -} - -DEFUN (no_bgp_bestpath_aspath_multipath_relax, - no_bgp_bestpath_aspath_multipath_relax_cmd, - "no bgp bestpath as-path multipath-relax", - NO_STR - "BGP specific commands\n" - "Change the default bestpath selection\n" - "AS-path attribute\n" - "Allow load sharing across routes that have different AS paths (but same length)\n") -{ - struct bgp *bgp; - - bgp = vty->index; - bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); - bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET); - bgp_recalculate_all_bestpaths (bgp); - - return CMD_SUCCESS; -} - -/* "bgp bestpath as-path multipath-relax no-as-set" configuration. */ -DEFUN (bgp_bestpath_aspath_multipath_relax_no_as_set, - bgp_bestpath_aspath_multipath_relax_no_as_set_cmd, - "bgp bestpath as-path multipath-relax no-as-set", + "bgp bestpath as-path multipath-relax {as-set|no-as-set}", "BGP specific commands\n" "Change the default bestpath selection\n" "AS-path attribute\n" "Allow load sharing across routes that have different AS paths (but same length)\n" + "Generate an AS_SET\n" "Do not generate an AS_SET\n") { struct bgp *bgp; bgp = vty->index; bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); - bgp_flag_set (bgp, BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET); + + /* no-as-set is now the default behavior so we can silently + * ignore it */ + if (argv[0] != NULL && strncmp (argv[0], "a", 1) == 0) + bgp_flag_set (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET); + else + bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET) ; + bgp_recalculate_all_bestpaths (bgp); return CMD_SUCCESS; } -DEFUN (no_bgp_bestpath_aspath_multipath_relax_no_as_set, - no_bgp_bestpath_aspath_multipath_relax_no_as_set_cmd, - "no bgp bestpath as-path multipath-relax no-as-set", +DEFUN (no_bgp_bestpath_aspath_multipath_relax, + no_bgp_bestpath_aspath_multipath_relax_cmd, + "no bgp bestpath as-path multipath-relax {as-set|no-as-set}", NO_STR "BGP specific commands\n" "Change the default bestpath selection\n" "AS-path attribute\n" "Allow load sharing across routes that have different AS paths (but same length)\n" + "Generate an AS_SET\n" "Do not generate an AS_SET\n") { struct bgp *bgp; bgp = vty->index; bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX); - bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET); + bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET); bgp_recalculate_all_bestpaths (bgp); return CMD_SUCCESS; @@ -12165,10 +12136,6 @@ bgp_vty_init (void) install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd); install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd); - /* "bgp bestpath as-path multipath-relax no-as-set" commands */ - install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_no_as_set_cmd); - install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_no_as_set_cmd); - /* "bgp log-neighbor-changes" commands */ install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd); install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd); diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 51712cee3b..cc160a52fe 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -2686,8 +2686,10 @@ bgp_create (as_t *as, const char *name) bgp->route[afi][safi] = bgp_table_init (afi, safi); bgp->aggregate[afi][safi] = bgp_table_init (afi, safi); bgp->rib[afi][safi] = bgp_table_init (afi, safi); - bgp->maxpaths[afi][safi].maxpaths_ebgp = BGP_DEFAULT_MAXPATHS; - bgp->maxpaths[afi][safi].maxpaths_ibgp = BGP_DEFAULT_MAXPATHS; + + /* Enable maximum-paths */ + bgp_maximum_paths_set (bgp, afi, safi, BGP_PEER_EBGP, BGP_DEFAULT_MAXPATHS, 0); + bgp_maximum_paths_set (bgp, afi, safi, BGP_PEER_IBGP, BGP_DEFAULT_MAXPATHS, 0); } bgp->v_update_delay = BGP_UPDATE_DELAY_DEF; @@ -6889,13 +6891,17 @@ bgp_config_write (struct vty *vty) if (bgp_flag_check (bgp, BGP_FLAG_ASPATH_CONFED)) vty_out (vty, " bgp bestpath as-path confed%s", VTY_NEWLINE); - if (bgp_flag_check (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX)) { - if (bgp_flag_check (bgp, BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET)) { - vty_out (vty, " bgp bestpath as-path multipath-relax no-as-set%s", VTY_NEWLINE); - } else { - vty_out (vty, " bgp bestpath as-path multipath-relax%s", VTY_NEWLINE); + if (bgp_flag_check (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX)) + { + if (bgp_flag_check (bgp, BGP_FLAG_MULTIPATH_RELAX_AS_SET)) + { + vty_out (vty, " bgp bestpath as-path multipath-relax as-set%s", VTY_NEWLINE); + } + } + else + { + vty_out (vty, " no bgp bestpath as-path multipath-relax%s", VTY_NEWLINE); } - } if (bgp_flag_check (bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY)) { vty_out (vty, " bgp route-reflector allow-outbound-policy%s", diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 24b39dd7f5..76486a4290 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -249,7 +249,7 @@ struct bgp #define BGP_FLAG_ASPATH_MULTIPATH_RELAX (1 << 14) #define BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY (1 << 15) #define BGP_FLAG_DISABLE_NH_CONNECTED_CHK (1 << 16) -#define BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET (1 << 17) +#define BGP_FLAG_MULTIPATH_RELAX_AS_SET (1 << 17) #define BGP_FLAG_FORCE_STATIC_PROCESS (1 << 18) #define BGP_FLAG_SHOW_HOSTNAME (1 << 19)