version 1.1.1.1, 2012/02/21 17:26:11
|
version 1.1.1.3, 2016/11/02 10:09:10
|
Line 26 Software Foundation, Inc., 59 Temple Place - Suite 330
|
Line 26 Software Foundation, Inc., 59 Temple Place - Suite 330
|
#include "command.h" |
#include "command.h" |
#include "log.h" |
#include "log.h" |
#include "thread.h" |
#include "thread.h" |
|
#include "filter.h" |
|
|
#include "bgpd/bgpd.h" |
#include "bgpd/bgpd.h" |
#include "bgpd/bgp_damp.h" |
#include "bgpd/bgp_damp.h" |
Line 42 static struct bgp_damp_config *damp = &bgp_damp_cfg;
|
Line 43 static struct bgp_damp_config *damp = &bgp_damp_cfg;
|
used list. */ |
used list. */ |
#define BGP_DAMP_LIST_ADD(N,A) BGP_INFO_ADD(N,A,no_reuse_list) |
#define BGP_DAMP_LIST_ADD(N,A) BGP_INFO_ADD(N,A,no_reuse_list) |
#define BGP_DAMP_LIST_DEL(N,A) BGP_INFO_DEL(N,A,no_reuse_list) |
#define BGP_DAMP_LIST_DEL(N,A) BGP_INFO_DEL(N,A,no_reuse_list) |
| |
/* Calculate reuse list index by penalty value. */ |
/* Calculate reuse list index by penalty value. */ |
static int |
static int |
bgp_reuse_index (int penalty) |
bgp_reuse_index (int penalty) |
Line 86 bgp_reuse_list_delete (struct bgp_damp_info *bdi)
|
Line 87 bgp_reuse_list_delete (struct bgp_damp_info *bdi)
|
else |
else |
damp->reuse_list[bdi->index] = bdi->next; |
damp->reuse_list[bdi->index] = bdi->next; |
} |
} |
| |
/* Return decayed penalty value. */ |
/* Return decayed penalty value. */ |
int |
int |
bgp_damp_decay (time_t tdiff, int penalty) |
bgp_damp_decay (time_t tdiff, int penalty) |
Line 115 bgp_reuse_timer (struct thread *t)
|
Line 116 bgp_reuse_timer (struct thread *t)
|
|
|
damp->t_reuse = NULL; |
damp->t_reuse = NULL; |
damp->t_reuse = |
damp->t_reuse = |
thread_add_timer (master, bgp_reuse_timer, NULL, DELTA_REUSE); | thread_add_timer (bm->master, bgp_reuse_timer, NULL, DELTA_REUSE); |
|
|
t_now = bgp_clock (); |
t_now = bgp_clock (); |
|
|
Line 447 bgp_damp_enable (struct bgp *bgp, afi_t afi, safi_t sa
|
Line 448 bgp_damp_enable (struct bgp *bgp, afi_t afi, safi_t sa
|
/* Register reuse timer. */ |
/* Register reuse timer. */ |
if (! damp->t_reuse) |
if (! damp->t_reuse) |
damp->t_reuse = |
damp->t_reuse = |
thread_add_timer (master, bgp_reuse_timer, NULL, DELTA_REUSE); | thread_add_timer (bm->master, bgp_reuse_timer, NULL, DELTA_REUSE); |
|
|
return 0; |
return 0; |
} |
} |
Line 498 bgp_damp_info_clean (void)
|
Line 499 bgp_damp_info_clean (void)
|
int |
int |
bgp_damp_disable (struct bgp *bgp, afi_t afi, safi_t safi) |
bgp_damp_disable (struct bgp *bgp, afi_t afi, safi_t safi) |
{ |
{ |
|
/* If it wasn't enabled, there's nothing to do. */ |
|
if (! CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) |
|
return 0; |
|
|
/* Cancel reuse thread. */ |
/* Cancel reuse thread. */ |
if (damp->t_reuse ) |
if (damp->t_reuse ) |
thread_cancel (damp->t_reuse); |
thread_cancel (damp->t_reuse); |
Line 525 bgp_config_write_damp (struct vty *vty)
|
Line 530 bgp_config_write_damp (struct vty *vty)
|
&& bgp_damp_cfg.reuse_limit == DEFAULT_REUSE |
&& bgp_damp_cfg.reuse_limit == DEFAULT_REUSE |
&& bgp_damp_cfg.suppress_value == DEFAULT_SUPPRESS |
&& bgp_damp_cfg.suppress_value == DEFAULT_SUPPRESS |
&& bgp_damp_cfg.max_suppress_time == bgp_damp_cfg.half_life*4) |
&& bgp_damp_cfg.max_suppress_time == bgp_damp_cfg.half_life*4) |
vty_out (vty, " bgp dampening %ld%s", | vty_out (vty, " bgp dampening %lld%s", |
bgp_damp_cfg.half_life/60, | bgp_damp_cfg.half_life/60LL, |
VTY_NEWLINE); |
VTY_NEWLINE); |
else |
else |
vty_out (vty, " bgp dampening %ld %d %d %ld%s", | vty_out (vty, " bgp dampening %lld %d %d %lld%s", |
bgp_damp_cfg.half_life/60, | bgp_damp_cfg.half_life/60LL, |
bgp_damp_cfg.reuse_limit, |
bgp_damp_cfg.reuse_limit, |
bgp_damp_cfg.suppress_value, |
bgp_damp_cfg.suppress_value, |
bgp_damp_cfg.max_suppress_time/60, | bgp_damp_cfg.max_suppress_time/60LL, |
VTY_NEWLINE); |
VTY_NEWLINE); |
} |
} |
|
|
Line 634 bgp_damp_reuse_time_vty (struct vty *vty, struct bgp_i
|
Line 639 bgp_damp_reuse_time_vty (struct vty *vty, struct bgp_i
|
penalty = bgp_damp_decay (t_diff, bdi->penalty); |
penalty = bgp_damp_decay (t_diff, bdi->penalty); |
|
|
return bgp_get_reuse_time (penalty, timebuf, len); |
return bgp_get_reuse_time (penalty, timebuf, len); |
|
} |
|
|
|
int |
|
bgp_show_dampening_parameters (struct vty *vty, afi_t afi, safi_t safi) |
|
{ |
|
struct bgp *bgp; |
|
bgp = bgp_get_default(); |
|
|
|
if (bgp == NULL) |
|
{ |
|
vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE); |
|
return CMD_WARNING; |
|
} |
|
|
|
if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING)) |
|
{ |
|
vty_out (vty, "Half-life time: %ld min%s", |
|
damp->half_life / 60, VTY_NEWLINE); |
|
vty_out (vty, "Reuse penalty: %d%s", |
|
damp->reuse_limit, VTY_NEWLINE); |
|
vty_out (vty, "Suppress penalty: %d%s", |
|
damp->suppress_value, VTY_NEWLINE); |
|
vty_out (vty, "Max suppress time: %ld min%s", |
|
damp->max_suppress_time / 60, VTY_NEWLINE); |
|
vty_out (vty, "Max supress penalty: %u%s", |
|
damp->ceiling, VTY_NEWLINE); |
|
vty_out (vty, "%s", VTY_NEWLINE); |
|
} |
|
else |
|
vty_out (vty, "dampening not enabled for %s%s", |
|
afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE); |
|
|
|
return CMD_SUCCESS; |
} |
} |