mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 20:32:18 +00:00
pimd: fix register suppress timer code
Signed-off-by: Christian Hopps <chopps@labn.net>
This commit is contained in:
parent
11ca35875c
commit
e8b7548c0d
@ -96,9 +96,9 @@ struct pim_router {
|
|||||||
int t_periodic;
|
int t_periodic;
|
||||||
struct pim_assert_metric infinite_assert_metric;
|
struct pim_assert_metric infinite_assert_metric;
|
||||||
long rpf_cache_refresh_delay_msec;
|
long rpf_cache_refresh_delay_msec;
|
||||||
int32_t register_suppress_time;
|
uint32_t register_suppress_time;
|
||||||
int packet_process;
|
int packet_process;
|
||||||
int32_t register_probe_time;
|
uint32_t register_probe_time;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* What is the default vrf that we work in
|
* What is the default vrf that we work in
|
||||||
|
@ -556,8 +556,27 @@ int pim_join_prune_interval_modify(struct nb_cb_modify_args *args)
|
|||||||
*/
|
*/
|
||||||
int pim_register_suppress_time_modify(struct nb_cb_modify_args *args)
|
int pim_register_suppress_time_modify(struct nb_cb_modify_args *args)
|
||||||
{
|
{
|
||||||
|
uint16_t value;
|
||||||
switch (args->event) {
|
switch (args->event) {
|
||||||
case NB_EV_VALIDATE:
|
case NB_EV_VALIDATE:
|
||||||
|
value = yang_dnode_get_uint16(args->dnode, NULL);
|
||||||
|
/*
|
||||||
|
* As soon as this is non-constant it needs to be replaced with
|
||||||
|
* a yang_dnode_get to lookup the candidate value, *not* the
|
||||||
|
* operational value. Since the code has a field assigned and
|
||||||
|
* used for this value it should have YANG/CLI to set it too,
|
||||||
|
* otherwise just use the #define!
|
||||||
|
*/
|
||||||
|
/* RFC7761: 4.11. Timer Values */
|
||||||
|
if (value <= router->register_probe_time * 2) {
|
||||||
|
snprintf(
|
||||||
|
args->errmsg, args->errmsg_len,
|
||||||
|
"Register suppress time (%u) must be more than "
|
||||||
|
"twice the register probe time (%u).",
|
||||||
|
value, router->register_probe_time);
|
||||||
|
return NB_ERR_VALIDATION;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case NB_EV_PREPARE:
|
case NB_EV_PREPARE:
|
||||||
case NB_EV_ABORT:
|
case NB_EV_ABORT:
|
||||||
break;
|
break;
|
||||||
|
@ -1800,12 +1800,16 @@ void pim_upstream_start_register_stop_timer(struct pim_upstream *up,
|
|||||||
THREAD_OFF(up->t_rs_timer);
|
THREAD_OFF(up->t_rs_timer);
|
||||||
|
|
||||||
if (!null_register) {
|
if (!null_register) {
|
||||||
uint32_t lower = (0.5 * PIM_REGISTER_SUPPRESSION_PERIOD);
|
uint32_t lower = (0.5 * router->register_suppress_time);
|
||||||
uint32_t upper = (1.5 * PIM_REGISTER_SUPPRESSION_PERIOD);
|
uint32_t upper = (1.5 * router->register_suppress_time);
|
||||||
time = lower + (frr_weak_random() % (upper - lower + 1))
|
time = lower + (frr_weak_random() % (upper - lower + 1));
|
||||||
- PIM_REGISTER_PROBE_PERIOD;
|
/* Make sure we don't wrap around */
|
||||||
|
if (time >= router->register_probe_time)
|
||||||
|
time -= router->register_probe_time;
|
||||||
|
else
|
||||||
|
time = 0;
|
||||||
} else
|
} else
|
||||||
time = PIM_REGISTER_PROBE_PERIOD;
|
time = router->register_probe_time;
|
||||||
|
|
||||||
if (PIM_DEBUG_PIM_TRACE) {
|
if (PIM_DEBUG_PIM_TRACE) {
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
|
Loading…
Reference in New Issue
Block a user