llinfo_nd6 thinks its expiry may extend beyond a timeout interval.

so it keeps track of the number of ticks it really wants via ln_ntick
in llinfo_nd6 and schedules multiple timeouts to reach it.

i think this is a waste of time for two reasons:

1. nd6_llinfo_settimer() (which sets this up) doesnt seem to be
called with a timeout greater than what timeouts can handle. timeouts
off the wire are ignored if theyre greater than an hour
(MAX_REACHABLE_TIME), and the largest constant that ends up being
passed is a day via nd6_gctimer. the fastest ticking arch we have
is alpha with HZ at 1024, which wraps at about 24 days. we have
space.

2. ln_ntick is a long, which is the same size as int on 32 bit
archs. the semantics it wants dont exist on a bunch of platforms.
it is kind of arguing its own uselesness.

ok?

Index: nd6.c
===================================================================
RCS file: /cvs/src/sys/netinet6/nd6.c,v
retrieving revision 1.179
diff -u -p -r1.179 nd6.c
--- nd6.c       17 May 2016 08:29:14 -0000      1.179
+++ nd6.c       30 May 2016 07:08:09 -0000
@@ -308,21 +308,16 @@ nd6_llinfo_settimer(struct llinfo_nd6 *l
 {
        int s;
 
+       KASSERT(tick <= INT_MAX);
+
        s = splsoftnet();
 
        if (tick < 0) {
                ln->ln_expire = 0;
-               ln->ln_ntick = 0;
                timeout_del(&ln->ln_timer_ch);
        } else {
                ln->ln_expire = time_second + tick / hz;
-               if (tick > INT_MAX) {
-                       ln->ln_ntick = tick - INT_MAX;
-                       timeout_add(&ln->ln_timer_ch, INT_MAX);
-               } else {
-                       ln->ln_ntick = 0;
-                       timeout_add(&ln->ln_timer_ch, tick);
-               }
+               timeout_add(&ln->ln_timer_ch, tick);
        }
 
        splx(s);
@@ -341,18 +336,6 @@ nd6_llinfo_timer(void *arg)
        s = splsoftnet();
 
        ln = (struct llinfo_nd6 *)arg;
-
-       if (ln->ln_ntick > 0) {
-               if (ln->ln_ntick > INT_MAX) {
-                       ln->ln_ntick -= INT_MAX;
-                       nd6_llinfo_settimer(ln, INT_MAX);
-               } else {
-                       ln->ln_ntick = 0;
-                       nd6_llinfo_settimer(ln, ln->ln_ntick);
-               }
-               splx(s);
-               return;
-       }
 
        if ((rt = ln->ln_rt) == NULL)
                panic("ln->ln_rt == NULL");
Index: nd6.h
===================================================================
RCS file: /cvs/src/sys/netinet6/nd6.h,v
retrieving revision 1.58
diff -u -p -r1.58 nd6.h
--- nd6.h       30 Mar 2016 10:13:14 -0000      1.58
+++ nd6.h       30 May 2016 07:08:09 -0000
@@ -150,7 +150,6 @@ struct      llinfo_nd6 {
        short   ln_state;       /* reachability state */
        short   ln_router;      /* 2^0: ND6 router bit */
 
-       long    ln_ntick;
        struct  timeout ln_timer_ch;
 };
 

Reply via email to