Module Name: src Committed By: roy Date: Sun Nov 10 21:07:39 UTC 2019
Modified Files: src/usr.sbin/rtadvd: rtadvd.c Log Message: rtadvd: Fix reloading configuration killing interface timers To generate a diff of this commit: cvs rdiff -u -r1.69 -r1.70 src/usr.sbin/rtadvd/rtadvd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.sbin/rtadvd/rtadvd.c diff -u src/usr.sbin/rtadvd/rtadvd.c:1.69 src/usr.sbin/rtadvd/rtadvd.c:1.70 --- src/usr.sbin/rtadvd/rtadvd.c:1.69 Fri Mar 29 21:51:52 2019 +++ src/usr.sbin/rtadvd/rtadvd.c Sun Nov 10 21:07:39 2019 @@ -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 $ */ /* @@ -452,6 +452,18 @@ die(void) } 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) { int n, type, ifindex = 0, plen; @@ -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 solic "%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;