Quagga default: BGP "no-as-set" should be the default for "bgp as-path multipath-relax"

Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-7928
This commit is contained in:
Daniel Walton 2015-11-10 15:33:24 +00:00
parent 2a3d57318c
commit 219178b6ba
4 changed files with 32 additions and 90 deletions

View File

@ -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 */

View File

@ -1919,17 +1919,26 @@ 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 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")
"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_unset (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;
@ -1937,58 +1946,20 @@ DEFUN (bgp_bestpath_aspath_multipath_relax,
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 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"
"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);
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",
"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);

View File

@ -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",

View File

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