mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 03:27:25 +00:00
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:
parent
d5b77cc20d
commit
5b964da3c5
@ -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
|
||||
*/
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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); \
|
||||
|
Loading…
Reference in New Issue
Block a user