Fri Apr 1 05:11:38 2016 UTC ()
Tidy up nd6_timer initialization


(ozaki-r)
diff -r1.155 -r1.156 src/sys/netinet6/ip6_input.c
diff -r1.185 -r1.186 src/sys/netinet6/nd6.c
diff -r1.69 -r1.70 src/sys/netinet6/nd6.h

cvs diff -r1.155 -r1.156 src/sys/netinet6/ip6_input.c (expand / switch to context diff)
--- src/sys/netinet6/ip6_input.c 2016/02/04 02:48:37 1.155
+++ src/sys/netinet6/ip6_input.c 2016/04/01 05:11:38 1.156
@@ -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,12 +196,8 @@
 }
 
 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);

cvs diff -r1.185 -r1.186 src/sys/netinet6/nd6.c (expand / switch to context diff)
--- src/sys/netinet6/nd6.c 2016/02/04 02:48:37 1.185
+++ src/sys/netinet6/nd6.c 2016/04/01 05:11:38 1.186
@@ -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;

cvs diff -r1.69 -r1.70 src/sys/netinet6/nd6.h (expand / switch to context diff)
--- src/sys/netinet6/nd6.h 2015/12/07 06:19:13 1.69
+++ src/sys/netinet6/nd6.h 2016/04/01 05:11:38 1.70
@@ -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 *,