rtadvd: Fix reloading configuration killing interface timers

This commit is contained in:
roy 2019-11-10 21:07:39 +00:00
parent 14210daaf6
commit cfe5ae87ad
1 changed files with 15 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtadvd.c,v 1.69 2019/03/29 21:51:52 christos Exp $ */
/* $NetBSD: rtadvd.c,v 1.70 2019/11/10 21:07:39 roy Exp $ */
/* $KAME: rtadvd.c,v 1.92 2005/10/17 14:40:02 suz Exp $ */
/*
@ -451,6 +451,18 @@ die(void)
exit(EXIT_SUCCESS);
}
static void
ra_timer_reset(struct rainfo *rai)
{
rtadvd_remove_timer(&rai->timer);
rai->timer = rtadvd_add_timer(ra_timeout, ra_timer_update, rai, rai);
ra_timer_update(rai, &rai->timer->tm);
rtadvd_set_timer(&rai->timer->tm, rai->timer);
rtadvd_remove_timer(&rai->timer_sol);
rai->timer_sol = rtadvd_add_timer(ra_timeout_sol, NULL, rai, NULL);
}
static void
rtmsg_input(void)
{
@ -698,14 +710,7 @@ rtmsg_input(void)
rai->initcounter = 0; /* reset the counter */
rai->waiting = 0; /* XXX */
rtadvd_remove_timer(&rai->timer);
rai->timer = rtadvd_add_timer(ra_timeout,
ra_timer_update, rai, rai);
ra_timer_update(rai, &rai->timer->tm);
rtadvd_set_timer(&rai->timer->tm, rai->timer);
rtadvd_remove_timer(&rai->timer_sol);
rai->timer_sol = rtadvd_add_timer(ra_timeout_sol,
NULL, rai, NULL);
ra_timer_reset(rai);
} else if (prefixchange && rai->ifflags & IFF_UP) {
/*
* An advertised prefix has been added or invalidated.
@ -1760,10 +1765,7 @@ ra_output(struct rainfo *rai, bool solicited)
"%s: expired RA,"
" new config active for interface (%s)",
__func__, rai->ifname);
rai->leaving_for->timer = rtadvd_add_timer(ra_timeout,
ra_timer_update,
rai->leaving_for, rai->leaving_for);
ra_timer_set_short_delay(rai->leaving_for, rai->timer);
ra_timer_reset(rai->leaving_for);
rai->leaving_for->leaving = NULL;
free_rainfo(rai);
return NULL;