mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-29 06:29:40 +00:00
bgpd: use XCALLOC to allocate bgpd damp array
* bgpd: (bgp_damp_parameter_set) The BGP reuse_index is not initialized properly. This would cause sporadic crash when disabling dampening. Use XCALLOC correctly and the right size array is initialized and no memset is needed.
This commit is contained in:
parent
6c88b44dcb
commit
fac9c6b63a
@ -407,14 +407,10 @@ bgp_damp_parameter_set (int hlife, int reuse, int sup, int maxsup)
|
|||||||
damp->reuse_list = XCALLOC (MTYPE_BGP_DAMP_ARRAY,
|
damp->reuse_list = XCALLOC (MTYPE_BGP_DAMP_ARRAY,
|
||||||
damp->reuse_list_size
|
damp->reuse_list_size
|
||||||
* sizeof (struct bgp_reuse_node *));
|
* sizeof (struct bgp_reuse_node *));
|
||||||
memset (damp->reuse_list, 0x00,
|
|
||||||
damp->reuse_list_size * sizeof (struct bgp_reuse_node *));
|
|
||||||
|
|
||||||
/* Reuse-array computations */
|
/* Reuse-array computations */
|
||||||
damp->reuse_index = XMALLOC (MTYPE_BGP_DAMP_ARRAY,
|
damp->reuse_index = XCALLOC (MTYPE_BGP_DAMP_ARRAY,
|
||||||
sizeof(int) * damp->reuse_index_size);
|
sizeof(int) * damp->reuse_index_size);
|
||||||
memset (damp->reuse_index, 0x00,
|
|
||||||
damp->reuse_list_size * sizeof (int));
|
|
||||||
|
|
||||||
reuse_max_ratio = (double)damp->ceiling/damp->reuse_limit;
|
reuse_max_ratio = (double)damp->ceiling/damp->reuse_limit;
|
||||||
j = (exp((double)damp->max_suppress_time/damp->half_life) * log10(2.0));
|
j = (exp((double)damp->max_suppress_time/damp->half_life) * log10(2.0));
|
||||||
|
Loading…
Reference in New Issue
Block a user