From 5b964da3c54e710de97aaf67f7338e76cf119044 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 8 Dec 2015 14:19:39 +0000 Subject: [PATCH] bgpd: Convert BGP_MAXIMUM_MAXPATHS to MULTIPATH_NUM There is no point in allowing more BGP_MAXIMUM_MAXPATHS than MULTIPATH_NUM. Signed-off-by: Donald Sharp --- bgpd/bgp_mpath.h | 3 --- bgpd/bgp_vty.c | 7 +------ bgpd/bgp_zebra.c | 10 +++++----- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/bgpd/bgp_mpath.h b/bgpd/bgp_mpath.h index 9120ca3433..0a51c98d06 100644 --- a/bgpd/bgp_mpath.h +++ b/bgpd/bgp_mpath.h @@ -24,9 +24,6 @@ #ifndef _QUAGGA_BGP_MPATH_H #define _QUAGGA_BGP_MPATH_H -/* Limit on number of configured maxpaths */ -#define BGP_MAXIMUM_MAXPATHS 255 - /* Supplemental information linked to bgp_info for keeping track of * multipath selections, lazily allocated to save memory */ diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index a733c80682..02a066102c 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -992,7 +992,7 @@ bgp_maxpaths_config_vty (struct vty *vty, int peer_type, const char *mpaths, if (set) { VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, mpaths, 1, - BGP_MAXIMUM_MAXPATHS); + MULTIPATH_NUM); ret = bgp_maximum_paths_set (bgp, afi, safi, peer_type, maxpaths, options); } @@ -1011,11 +1011,6 @@ bgp_maxpaths_config_vty (struct vty *vty, int peer_type, const char *mpaths, bgp_recalculate_all_bestpaths (bgp); - 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); - return CMD_SUCCESS; } diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 07532d93fa..707476e818 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -62,22 +62,22 @@ struct stream *bgp_ifindices_buf = NULL; 1. maintain a linked-list and free it after zapi_*_route call 2. use an array to avoid number of mallocs. Number of supported next-hops are finite, use of arrays should be ok. */ -struct attr attr_cp[BGP_MAXIMUM_MAXPATHS]; -struct attr_extra attr_extra_cp[BGP_MAXIMUM_MAXPATHS]; +struct attr attr_cp[MULTIPATH_NUM]; +struct attr_extra attr_extra_cp[MULTIPATH_NUM]; int attr_index = 0; /* Once per address-family initialization of the attribute array */ #define BGP_INFO_ATTR_BUF_INIT()\ do {\ - memset(attr_cp, 0, BGP_MAXIMUM_MAXPATHS * sizeof(struct attr));\ - memset(attr_extra_cp, 0, BGP_MAXIMUM_MAXPATHS * sizeof(struct attr_extra));\ + memset(attr_cp, 0, MULTIPATH_NUM * sizeof(struct attr));\ + memset(attr_extra_cp, 0, MULTIPATH_NUM * sizeof(struct attr_extra));\ attr_index = 0;\ } while (0) #define BGP_INFO_ATTR_BUF_COPY(info_src, info_dst)\ do { \ *info_dst = *info_src; \ - assert(attr_index != BGP_MAXIMUM_MAXPATHS);\ + assert(attr_index != MULTIPATH_NUM);\ attr_cp[attr_index].extra = &attr_extra_cp[attr_index]; \ bgp_attr_dup (&attr_cp[attr_index], info_src->attr); \ bgp_attr_deep_dup (&attr_cp[attr_index], info_src->attr); \ -- 2.39.5