From: Donald Sharp Date: Tue, 17 Nov 2015 16:13:23 +0000 (-0800) Subject: Quagga: Set MULTIPATH_NUM to 64 when user specifies 0 from cli X-Git-Tag: frr-2.0-rc1~1199^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=7c5d2b76c685eaa31e81013017edc62ffaeb2381;p=matthieu%2Ffrr.git Quagga: Set MULTIPATH_NUM to 64 when user specifies 0 from cli 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 Reviewed-by: Daniel Walton --- diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index fd096eff22..de6f4d8b56 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -1000,7 +1000,7 @@ bgp_maxpaths_config_vty (struct vty *vty, int peer_type, const char *mpaths, bgp_recalculate_all_bestpaths (bgp); - 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 e44823262c..40c11e7fb7 100755 --- a/configure.ac +++ b/configure.ac @@ -415,7 +415,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 cad367808d..a4da7f079d 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -1987,7 +1987,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 1eec867041..c53d282b63 100644 --- a/zebra/zebra_fpm_netlink.c +++ b/zebra/zebra_fpm_netlink.c @@ -137,10 +137,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; @@ -288,7 +287,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)) diff --git a/zebra/zserv.c b/zebra/zserv.c index 3f7d73285f..87fa5ce49c 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -1042,7 +1042,7 @@ zread_interface_delete (struct zserv *client, u_short length, vrf_id_t vrf_id) void zserv_nexthop_num_warn (const char *caller, const struct prefix *p, const u_char nexthop_num) { - if ((MULTIPATH_NUM != 0) && (nexthop_num > MULTIPATH_NUM)) + if (nexthop_num > MULTIPATH_NUM) { char buff[80]; prefix2str(p, buff, 80);