]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Use actual MULTIPATH_NUM as the limitor
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 8 Dec 2015 13:42:36 +0000 (13:42 +0000)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 8 Dec 2015 18:06:33 +0000 (10:06 -0800)
BGP uses a second #define that is equal to MULTIPATH_NUM.  There
is no point in having a different #define.  Just consolidate.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
bgpd/bgp_mpath.c
bgpd/bgp_mpath.h
bgpd/bgp_vty.c
bgpd/bgpd.c
tests/bgp_mpath_test.c

index cf92bb1514c59b1a5df01026b79da63fa01c90c2..496ccdf11b9636a76369e44e85d493197ab651a1 100644 (file)
@@ -83,11 +83,11 @@ bgp_maximum_paths_unset (struct bgp *bgp, afi_t afi, safi_t safi,
   switch (peertype)
     {
     case BGP_PEER_IBGP:
-      bgp->maxpaths[afi][safi].maxpaths_ibgp = BGP_DEFAULT_MAXPATHS;
+      bgp->maxpaths[afi][safi].maxpaths_ibgp = MULTIPATH_NUM;
       bgp->maxpaths[afi][safi].ibgp_flags = 0;
       break;
     case BGP_PEER_EBGP:
-      bgp->maxpaths[afi][safi].maxpaths_ebgp = BGP_DEFAULT_MAXPATHS;
+      bgp->maxpaths[afi][safi].maxpaths_ebgp = MULTIPATH_NUM;
       break;
     default:
       return -1;
@@ -429,7 +429,7 @@ bgp_info_mpath_update (struct bgp_node *rn, struct bgp_info *new_best,
   char pfx_buf[PREFIX2STR_BUFFER], nh_buf[2][INET6_ADDRSTRLEN];
 
   mpath_changed = 0;
-  maxpaths = BGP_DEFAULT_MAXPATHS;
+  maxpaths = MULTIPATH_NUM;
   mpath_count = 0;
   cur_mpath = NULL;
   old_mpath_count = 0;
index 1e112f0ec7e060808bf6f3d4533a95efa4574ef4..9120ca3433bea157e8e8272dc18b92303ee79cdc 100644 (file)
@@ -27,9 +27,6 @@
 /* Limit on number of configured maxpaths */
 #define BGP_MAXIMUM_MAXPATHS 255
 
-/* BGP default maximum-paths */
-#define BGP_DEFAULT_MAXPATHS MULTIPATH_NUM
-
 /* Supplemental information linked to bgp_info for keeping track of
  * multipath selections, lazily allocated to save memory
  */
index 1bde623fccf49a77a89509955399ffaf781c1836..a733c80682e736bcb74fae0de8fc7641da0cf31d 100644 (file)
@@ -1463,14 +1463,14 @@ int
 bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi,
                           safi_t safi, int *write)
 {
-  if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS)
+  if (bgp->maxpaths[afi][safi].maxpaths_ebgp != MULTIPATH_NUM)
     {
       bgp_config_write_family_header (vty, afi, safi, write);
       vty_out (vty, "  maximum-paths %d%s",
               bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE);
     }
 
-  if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS)
+  if (bgp->maxpaths[afi][safi].maxpaths_ibgp != MULTIPATH_NUM)
     {
       bgp_config_write_family_header (vty, afi, safi, write);
       vty_out (vty, "  maximum-paths ibgp %d",
index ea66dc3b3c646a822375cc72b455410bbb3f6752..9514f4de18354f4fc9123e3dd04f4e2398e90275 100644 (file)
@@ -2728,8 +2728,8 @@ bgp_create (as_t *as, const char *name)
        bgp->rib[afi][safi] = bgp_table_init (afi, safi);
 
         /* 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_maximum_paths_set (bgp, afi, safi, BGP_PEER_EBGP, MULTIPATH_NUM, 0);
+        bgp_maximum_paths_set (bgp, afi, safi, BGP_PEER_IBGP, MULTIPATH_NUM, 0);
       }
 
   bgp->v_update_delay = BGP_UPDATE_DELAY_DEF;
index 7053ad764288ea7bf4d1e860a5bcb47b2be130d4..e937784aae4ca3a58d2842ed9d61bab8e9e4ade6 100644 (file)
@@ -113,8 +113,8 @@ bgp_create_fake (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;
+        bgp->maxpaths[afi][safi].maxpaths_ebgp = MULTIPATH_NUM;
+        bgp->maxpaths[afi][safi].maxpaths_ibgp = MULTIPATH_NUM;
       }
 
   bgp->default_local_pref = BGP_DEFAULT_LOCAL_PREF;
@@ -171,9 +171,9 @@ run_bgp_cfg_maximum_paths (testcase_t *t)
         api_result = bgp_maximum_paths_unset (bgp, afi, safi, BGP_PEER_IBGP);
         EXPECT_TRUE (api_result == 0, test_result);
         EXPECT_TRUE ((bgp->maxpaths[afi][safi].maxpaths_ebgp ==
-                      BGP_DEFAULT_MAXPATHS), test_result);
+                      MULTIPATH_NUM), test_result);
         EXPECT_TRUE ((bgp->maxpaths[afi][safi].maxpaths_ibgp ==
-                      BGP_DEFAULT_MAXPATHS), test_result);
+                      MULTIPATH_NUM), test_result);
       }
 
   return test_result;