Add a no-as-set option to multipath-relax

This commit is contained in:
Donald Sharp 2015-05-19 18:03:58 -07:00
parent f992e2a98c
commit 16fc1eec45
4 changed files with 106 additions and 52 deletions

View File

@ -660,6 +660,10 @@ bgp_info_mpath_aggregate_update (struct bgp_info *new_best,
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))
{
/* aggregate attribute from multipath constituents */
aspath = aspath_dup (attr.aspath);
origin = attr.origin;
@ -725,6 +729,7 @@ bgp_info_mpath_aggregate_update (struct bgp_info *new_best,
#endif /* HAVE_IPV6 */
/* TODO: should we set ATOMIC_AGGREGATE and AGGREGATOR? */
}
new_attr = bgp_attr_intern (&attr);
bgp_attr_extra_free (&attr);

View File

@ -1588,6 +1588,7 @@ DEFUN (bgp_bestpath_aspath_multipath_relax,
bgp = vty->index;
bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET);
return CMD_SUCCESS;
}
@ -1604,6 +1605,43 @@ DEFUN (no_bgp_bestpath_aspath_multipath_relax,
bgp = vty->index;
bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
bgp_flag_unset (bgp, BGP_FLAG_MULTIPATH_RELAX_NO_AS_SET);
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);
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_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"
"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);
return CMD_SUCCESS;
}
@ -11419,6 +11457,10 @@ 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

@ -6366,9 +6366,15 @@ bgp_config_write (struct vty *vty)
vty_out (vty, " bgp bestpath as-path ignore%s", VTY_NEWLINE);
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_RR_ALLOW_OUTBOUND_POLICY)) {
vty_out (vty, " bgp route-reflector allow-outbound-policy%s",
VTY_NEWLINE);

View File

@ -238,6 +238,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)
/* BGP Per AF flags */
u_int16_t af_flags[AFI_MAX][SAFI_MAX];