this complements my diff to make arp use time_uptime for expiries
too.

the point is time_second can be skewed by clock adjustements while
time_uptime is monotonic.

this is mechanical. after this and arp go in i think i can get rid
of ln_expire and simply populate the rtentry associated with this
llinfo, like arp does.

Index: nd6.c
===================================================================
RCS file: /cvs/src/sys/netinet6/nd6.c,v
retrieving revision 1.182
diff -u -p -r1.182 nd6.c
--- nd6.c       1 Jun 2016 23:45:19 -0000       1.182
+++ nd6.c       2 Jun 2016 00:04:21 -0000
@@ -314,7 +314,7 @@ nd6_llinfo_settimer(struct llinfo_nd6 *l
                ln->ln_expire = 0;
                timeout_del(&ln->ln_timer_ch);
        } else {
-               ln->ln_expire = time_second + secs;
+               ln->ln_expire = time_uptime + secs;
                timeout_add_sec(&ln->ln_timer_ch, secs);
        }
 
@@ -1177,6 +1177,7 @@ nd6_ioctl(u_long cmd, caddr_t data, stru
        {
                struct llinfo_nd6 *ln;
                struct in6_addr nb_addr = nbi->addr; /* make local for safety */
+               time_t expire;
 
                /*
                 * XXX: KAME specific hack for scoped addresses
@@ -1199,10 +1200,16 @@ nd6_ioctl(u_long cmd, caddr_t data, stru
                        splx(s);
                        break;
                }
+               expire = ln->ln_expire;
+               if (expire != 0) {
+                       expire -= time_uptime;
+                       expire += time_second;
+               }
+
                nbi->state = ln->ln_state;
                nbi->asked = ln->ln_asked;
                nbi->isrouter = ln->ln_router;
-               nbi->expire = ln->ln_expire;
+               nbi->expire = expire;
                rtfree(rt);
                splx(s);
 

Reply via email to