Module Name: src Committed By: ozaki-r Date: Fri Apr 1 05:11:38 UTC 2016
Modified Files: src/sys/netinet6: ip6_input.c nd6.c nd6.h Log Message: Tidy up nd6_timer initialization To generate a diff of this commit: cvs rdiff -u -r1.155 -r1.156 src/sys/netinet6/ip6_input.c cvs rdiff -u -r1.185 -r1.186 src/sys/netinet6/nd6.c cvs rdiff -u -r1.69 -r1.70 src/sys/netinet6/nd6.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/netinet6/ip6_input.c diff -u src/sys/netinet6/ip6_input.c:1.155 src/sys/netinet6/ip6_input.c:1.156 --- src/sys/netinet6/ip6_input.c:1.155 Thu Feb 4 02:48:37 2016 +++ src/sys/netinet6/ip6_input.c Fri Apr 1 05:11:38 2016 @@ -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 @@ pfil_head_t *inet6_pfil_hook; 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 @@ ip6_init(void) 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 @@ ip6_init(void) } 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, Index: src/sys/netinet6/nd6.c diff -u src/sys/netinet6/nd6.c:1.185 src/sys/netinet6/nd6.c:1.186 --- src/sys/netinet6/nd6.c:1.185 Thu Feb 4 02:48:37 2016 +++ src/sys/netinet6/nd6.c Fri Apr 1 05:11:38 2016 @@ -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 void nd6_slowtimo(void *); 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 @@ MALLOC_DEFINE(M_IP6NDP, "NDP", "IPv6 Nei 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 @@ out: /* * 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; Index: src/sys/netinet6/nd6.h diff -u src/sys/netinet6/nd6.h:1.69 src/sys/netinet6/nd6.h:1.70 --- src/sys/netinet6/nd6.h:1.69 Mon Dec 7 06:19:13 2015 +++ src/sys/netinet6/nd6.h Fri Apr 1 05:11:38 2016 @@ -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 @@ extern int nd6_debug; #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 @@ struct rtentry *nd6_lookup(const struct 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 *,