The code has tests to see if the MULTIPATH_NUM == 0 and to
treat it like the user has entered 'Maximum PATHS'.
This 0 is treated as 64 internally.  Remove this dependency
and setup MULTIPATH_NUM to 64 when --enable-multipath=0 from
the configure cli.

Signed-off-by: Donald Sharp <[email protected]>
Reviewed-by: Daniel Walton <[email protected]>
---
 bgpd/bgp_vty.c            | 4 ++--
 configure.ac              | 5 ++++-
 zebra/rt_netlink.c        | 2 +-
 zebra/zebra_fpm_netlink.c | 7 +++----
 4 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 36fd263..501fbaa 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -676,7 +676,7 @@ DEFUN (bgp_maxpaths,
       return CMD_WARNING;
     }
 
-  if ((MULTIPATH_NUM != 0) && (maxpaths > MULTIPATH_NUM))
+  if (maxpaths > MULTIPATH_NUM)
     vty_out (vty,
             "%% Warning: maximum-paths set to %d is greater than %d that zebra 
is compiled to support%s",
             maxpaths, MULTIPATH_NUM, VTY_NEWLINE);
@@ -709,7 +709,7 @@ DEFUN (bgp_maxpaths_ibgp,
       return CMD_WARNING;
     }
 
-  if ((MULTIPATH_NUM != 0) && (maxpaths > MULTIPATH_NUM))
+  if (maxpaths > MULTIPATH_NUM)
     vty_out (vty,
             "%% Warning: maximum-paths set to %d is greater than %d that zebra 
is compiled to support%s",
             maxpaths, MULTIPATH_NUM, VTY_NEWLINE);
diff --git a/configure.ac b/configure.ac
index 3003e62..ea59dd3 100755
--- a/configure.ac
+++ b/configure.ac
@@ -395,7 +395,10 @@ AC_DEFINE_UNQUOTED(LOGFILE_MASK, ${enable_logfile_mask}, 
Mask for log files)
 MULTIPATH_NUM=1
 
 case "${enable_multipath}" in
-  [[0-9]|[1-9][0-9]])
+  0)
+    MULTIPATH_NUM=64
+    ;;
+  [[1-9]|[1-9][0-9]])
     MULTIPATH_NUM="${enable_multipath}"
     ;;
   "")
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 614f809..f2ddc88 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -1752,7 +1752,7 @@ netlink_route_multipath (int cmd, struct prefix *p, 
struct rib *rib,
       nexthop_num = 0;
       for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
         {
-          if (MULTIPATH_NUM != 0 && nexthop_num >= MULTIPATH_NUM)
+          if (nexthop_num >= MULTIPATH_NUM)
             break;
 
           if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c
index c4a650d..6434817 100644
--- a/zebra/zebra_fpm_netlink.c
+++ b/zebra/zebra_fpm_netlink.c
@@ -136,10 +136,9 @@ typedef struct netlink_route_info_t_
   int num_nhs;
 
   /*
-   * Nexthop structures. We keep things simple for now by enforcing a
-   * maximum of 64 in case MULTIPATH_NUM is 0;
+   * Nexthop structures.
    */
-  netlink_nh_info_t nhs[MAX (MULTIPATH_NUM, 64)];
+  netlink_nh_info_t nhs[MULTIPATH_NUM];
   union g_addr *pref_src;
 } netlink_route_info_t;
 
@@ -287,7 +286,7 @@ netlink_route_info_fill (netlink_route_info_t *ri, int cmd,
 
   for (ALL_NEXTHOPS_RO(rib->nexthop, nexthop, tnexthop, recursing))
     {
-      if (MULTIPATH_NUM != 0 && ri->num_nhs >= MULTIPATH_NUM)
+      if (ri->num_nhs >= MULTIPATH_NUM)
         break;
 
       if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
-- 
1.9.1


_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to