summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorPradosh Mohapatra <pmohapat@cumulusnetworks.com>2013-09-07 07:02:36 +0000
committerDavid Lamparter <equinox@opensourcerouting.org>2014-05-15 19:15:22 +0200
commit2fdd455cfd1f758b7aa2e6c8e3d185098b93908c (patch)
tree3b2d28c7b389228cc6c1e3809660c4f7f22c3f18 /bgpd
parentd92a2f39b46f1990052d2db046b47edf7bb21ebb (diff)
downloadquagga-2fdd455cfd1f758b7aa2e6c8e3d185098b93908c.tar.bz2
quagga-2fdd455cfd1f758b7aa2e6c8e3d185098b93908c.tar.xz
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>
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_route.c15
-rw-r--r--bgpd/bgp_vty.c36
-rw-r--r--bgpd/bgpd.c3
-rw-r--r--bgpd/bgpd.h1
4 files changed, 54 insertions, 1 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 335543e0..7f68b8d0 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -480,7 +480,20 @@ bgp_info_cmp (struct bgp *bgp, struct bgp_info *new, struct bgp_info *exist,
/* 9. Maximum path check. */
if (newm == existm)
{
- if (new->peer->sort == BGP_PEER_IBGP)
+ if (bgp_flag_check(bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX))
+ {
+
+ /*
+ * For the two paths, all comparison steps till IGP metric
+ * have succeeded - including AS_PATH hop count. Since 'bgp
+ * bestpath as-path multipath-relax' knob is on, we don't need
+ * an exact match of AS_PATH. Thus, mark the paths are equal.
+ * That will trigger both these paths to get into the multipath
+ * array.
+ */
+ *paths_eq = 1;
+ }
+ else if (new->peer->sort == BGP_PEER_IBGP)
{
if (aspath_cmp (new->attr->aspath, exist->attr->aspath))
*paths_eq = 1;
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 0f288948..bfa1f204 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -1160,6 +1160,38 @@ DEFUN (no_bgp_bestpath_aspath_confed,
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 @@ bgp_vty_init (void)
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);
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index c9a04fff..4b26993e 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -5276,6 +5276,9 @@ 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)) {
+ vty_out (vty, " bgp bestpath as-path multipath-relax%s", VTY_NEWLINE);
+ }
if (bgp_flag_check (bgp, BGP_FLAG_COMPARE_ROUTER_ID))
vty_out (vty, " bgp bestpath compare-routerid%s", VTY_NEWLINE);
if (bgp_flag_check (bgp, BGP_FLAG_MED_CONFED)
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 0746f0dd..024fedcf 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -120,6 +120,7 @@ struct bgp
#define BGP_FLAG_LOG_NEIGHBOR_CHANGES (1 << 11)
#define BGP_FLAG_GRACEFUL_RESTART (1 << 12)
#define BGP_FLAG_ASPATH_CONFED (1 << 13)
+#define BGP_FLAG_ASPATH_MULTIPATH_RELAX (1 << 14)
/* BGP Per AF flags */
u_int16_t af_flags[AFI_MAX][SAFI_MAX];