bgpd: add 'bgp bestpath as-path multipath-relax'
Compute multipath in BGP based on AS_PATH hop count match. If the knob
is turned on, it is not required to have an exact match of AS_PATHs
(provided other multipath conditions are met, of course).
Signed-off-by: Pradosh Mohapatra <pmohapat at cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt at cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 0f28894..bfa1f20 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -1160,6 +1160,38 @@
return CMD_SUCCESS;
}
+/* "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);
+ 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);
+ return CMD_SUCCESS;
+}
+
/* "bgp log-neighbor-changes" configuration. */
DEFUN (bgp_log_neighbor_changes,
bgp_log_neighbor_changes_cmd,
@@ -9172,6 +9204,10 @@
install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
+ /* "bgp bestpath as-path multipath-relax" commands */
+ install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd);
+ install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_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);