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 <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2015-12-08 14:19:39 +00:00
parent d5b77cc20d
commit 5b964da3c5
3 changed files with 6 additions and 14 deletions

View File

@ -24,9 +24,6 @@
#ifndef _QUAGGA_BGP_MPATH_H #ifndef _QUAGGA_BGP_MPATH_H
#define _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 /* Supplemental information linked to bgp_info for keeping track of
* multipath selections, lazily allocated to save memory * multipath selections, lazily allocated to save memory
*/ */

View File

@ -992,7 +992,7 @@ bgp_maxpaths_config_vty (struct vty *vty, int peer_type, const char *mpaths,
if (set) if (set)
{ {
VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, mpaths, 1, 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, ret = bgp_maximum_paths_set (bgp, afi, safi, peer_type, maxpaths,
options); options);
} }
@ -1011,11 +1011,6 @@ bgp_maxpaths_config_vty (struct vty *vty, int peer_type, const char *mpaths,
bgp_recalculate_all_bestpaths (bgp); 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; return CMD_SUCCESS;
} }

View File

@ -62,22 +62,22 @@ struct stream *bgp_ifindices_buf = NULL;
1. maintain a linked-list and free it after zapi_*_route call 1. maintain a linked-list and free it after zapi_*_route call
2. use an array to avoid number of mallocs. 2. use an array to avoid number of mallocs.
Number of supported next-hops are finite, use of arrays should be ok. */ Number of supported next-hops are finite, use of arrays should be ok. */
struct attr attr_cp[BGP_MAXIMUM_MAXPATHS]; struct attr attr_cp[MULTIPATH_NUM];
struct attr_extra attr_extra_cp[BGP_MAXIMUM_MAXPATHS]; struct attr_extra attr_extra_cp[MULTIPATH_NUM];
int attr_index = 0; int attr_index = 0;
/* Once per address-family initialization of the attribute array */ /* Once per address-family initialization of the attribute array */
#define BGP_INFO_ATTR_BUF_INIT()\ #define BGP_INFO_ATTR_BUF_INIT()\
do {\ do {\
memset(attr_cp, 0, BGP_MAXIMUM_MAXPATHS * sizeof(struct attr));\ memset(attr_cp, 0, MULTIPATH_NUM * sizeof(struct attr));\
memset(attr_extra_cp, 0, BGP_MAXIMUM_MAXPATHS * sizeof(struct attr_extra));\ memset(attr_extra_cp, 0, MULTIPATH_NUM * sizeof(struct attr_extra));\
attr_index = 0;\ attr_index = 0;\
} while (0) } while (0)
#define BGP_INFO_ATTR_BUF_COPY(info_src, info_dst)\ #define BGP_INFO_ATTR_BUF_COPY(info_src, info_dst)\
do { \ do { \
*info_dst = *info_src; \ *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]; \ attr_cp[attr_index].extra = &attr_extra_cp[attr_index]; \
bgp_attr_dup (&attr_cp[attr_index], info_src->attr); \ bgp_attr_dup (&attr_cp[attr_index], info_src->attr); \
bgp_attr_deep_dup (&attr_cp[attr_index], info_src->attr); \ bgp_attr_deep_dup (&attr_cp[attr_index], info_src->attr); \