Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/rtadvd rtadvd: Fix reloading configuration killing ...



details:   https://anonhg.NetBSD.org/src/rev/59783453db89
branches:  trunk
changeset: 460942:59783453db89
user:      roy <roy%NetBSD.org@localhost>
date:      Sun Nov 10 21:07:39 2019 +0000

description:
rtadvd: Fix reloading configuration killing interface timers

diffstat:

 usr.sbin/rtadvd/rtadvd.c |  28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)

diffs (56 lines):

diff -r 2989d9c30731 -r 59783453db89 usr.sbin/rtadvd/rtadvd.c
--- a/usr.sbin/rtadvd/rtadvd.c  Sun Nov 10 20:41:15 2019 +0000
+++ b/usr.sbin/rtadvd/rtadvd.c  Sun Nov 10 21:07:39 2019 +0000
@@ -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 @@
 }
 
 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 @@
 
                        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 @@
                               "%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;



Home | Main Index | Thread Index | Old Index