Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet6 Tidy up nd6_timer initialization



details:   https://anonhg.NetBSD.org/src/rev/dfa0d8b1e1d0
branches:  trunk
changeset: 344481:dfa0d8b1e1d0
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Fri Apr 01 05:11:38 2016 +0000

description:
Tidy up nd6_timer initialization

diffstat:

 sys/netinet6/ip6_input.c |  14 +++++---------
 sys/netinet6/nd6.c       |  20 +++++++-------------
 sys/netinet6/nd6.h       |   5 +----
 3 files changed, 13 insertions(+), 26 deletions(-)

diffs (144 lines):

diff -r fb9a4102a1a4 -r dfa0d8b1e1d0 sys/netinet6/ip6_input.c
--- a/sys/netinet6/ip6_input.c  Fri Apr 01 02:00:14 2016 +0000
+++ b/sys/netinet6/ip6_input.c  Fri Apr 01 05:11:38 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip6_input.c,v 1.155 2016/02/04 02:48:37 riastradh Exp $        */
+/*     $NetBSD: ip6_input.c,v 1.156 2016/04/01 05:11:38 ozaki-r Exp $  */
 /*     $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $     */
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.155 2016/02/04 02:48:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.156 2016/04/01 05:11:38 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_gateway.h"
@@ -144,7 +144,7 @@
 
 percpu_t *ip6stat_percpu;
 
-static void ip6_init2(void *);
+static void ip6_init2(void);
 static void ip6intr(void *);
 static struct m_tag *ip6_setdstifaddr(struct mbuf *, const struct in6_ifaddr *);
 
@@ -184,7 +184,7 @@
        frag6_init();
        ip6_desync_factor = cprng_fast32() % MAX_TEMP_DESYNC_FACTOR;
 
-       ip6_init2(NULL);
+       ip6_init2();
 #ifdef GATEWAY
        ip6flow_init(ip6_hashsize);
 #endif
@@ -196,13 +196,9 @@
 }
 
 static void
-ip6_init2(void *dummy)
+ip6_init2(void)
 {
 
-       /* nd6_timer_init */
-       callout_init(&nd6_timer_ch, CALLOUT_MPSAFE);
-       callout_reset(&nd6_timer_ch, hz, nd6_timer, NULL);
-
        /* timer for regeneranation of temporary addresses randomize ID */
        callout_init(&in6_tmpaddrtimer_ch, CALLOUT_MPSAFE);
        callout_reset(&in6_tmpaddrtimer_ch,
diff -r fb9a4102a1a4 -r dfa0d8b1e1d0 sys/netinet6/nd6.c
--- a/sys/netinet6/nd6.c        Fri Apr 01 02:00:14 2016 +0000
+++ b/sys/netinet6/nd6.c        Fri Apr 01 05:11:38 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nd6.c,v 1.185 2016/02/04 02:48:37 riastradh Exp $      */
+/*     $NetBSD: nd6.c,v 1.186 2016/04/01 05:11:38 ozaki-r Exp $        */
 /*     $KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $   */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.185 2016/02/04 02:48:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.186 2016/04/01 05:11:38 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -123,10 +123,11 @@
 static int regen_tmpaddr(struct in6_ifaddr *);
 static void nd6_free(struct rtentry *, struct llentry *, int);
 static void nd6_llinfo_timer(void *);
+static void nd6_timer(void *);
 static void clear_llinfo_pqueue(struct llentry *);
 
-callout_t nd6_slowtimo_ch;
-callout_t nd6_timer_ch;
+static callout_t nd6_slowtimo_ch;
+static callout_t nd6_timer_ch;
 
 static int fill_drlist(void *, size_t *, size_t);
 static int fill_prlist(void *, size_t *, size_t);
@@ -136,24 +137,17 @@
 void
 nd6_init(void)
 {
-       static int nd6_init_done = 0;
-
-       if (nd6_init_done) {
-               log(LOG_NOTICE, "nd6_init called more than once(ignored)\n");
-               return;
-       }
 
        /* initialization of the default router list */
        TAILQ_INIT(&nd_defrouter);
 
-       nd6_init_done = 1;
-
        callout_init(&nd6_slowtimo_ch, CALLOUT_MPSAFE);
        callout_init(&nd6_timer_ch, CALLOUT_MPSAFE);
 
        /* start timer */
        callout_reset(&nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL * hz,
            nd6_slowtimo, NULL);
+       callout_reset(&nd6_timer_ch, hz, nd6_timer, NULL);
 }
 
 struct nd_ifinfo *
@@ -592,7 +586,7 @@
 /*
  * ND6 timer routine to expire default route list and prefix list
  */
-void
+static void
 nd6_timer(void *ignored_arg)
 {
        struct nd_defrouter *next_dr, *dr;
diff -r fb9a4102a1a4 -r dfa0d8b1e1d0 sys/netinet6/nd6.h
--- a/sys/netinet6/nd6.h        Fri Apr 01 02:00:14 2016 +0000
+++ b/sys/netinet6/nd6.h        Fri Apr 01 05:11:38 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nd6.h,v 1.69 2015/12/07 06:19:13 ozaki-r Exp $ */
+/*     $NetBSD: nd6.h,v 1.70 2016/04/01 05:11:38 ozaki-r Exp $ */
 /*     $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $    */
 
 /*
@@ -352,8 +352,6 @@
 
 #define nd6log(x)      do { if (nd6_debug) log x; } while (/*CONSTCOND*/ 0)
 
-extern struct callout nd6_timer_ch;
-
 /* nd6_rtr.c */
 extern int nd6_defifindex;
 extern int ip6_desync_factor;  /* seconds */
@@ -402,7 +400,6 @@
 void nd6_setmtu(struct ifnet *);
 void nd6_llinfo_settimer(struct llentry *, time_t);
 void nd6_llinfo_settimer_locked(struct llentry *, time_t);
-void nd6_timer(void *);
 void nd6_purge(struct ifnet *, struct in6_ifextra *);
 void nd6_nud_hint(struct rtentry *);
 int nd6_resolve(struct ifnet *, struct rtentry *,



Home | Main Index | Thread Index | Old Index