Tidy up nd6_timer initializationdiff -r1.155 -r1.156 src/sys/netinet6/ip6_input.c
(ozaki-r)
--- 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,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ip6_input.c,v 1.155 2016/02/04 02:48:37 riastradh Exp $ */ | 1 | /* $NetBSD: ip6_input.c,v 1.156 2016/04/01 05:11:38 ozaki-r Exp $ */ | |
2 | /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ | 2 | /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | 5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -52,27 +52,27 @@ | @@ -52,27 +52,27 @@ | |||
52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
59 | * SUCH DAMAGE. | 59 | * SUCH DAMAGE. | |
60 | * | 60 | * | |
61 | * @(#)ip_input.c 8.2 (Berkeley) 1/4/94 | 61 | * @(#)ip_input.c 8.2 (Berkeley) 1/4/94 | |
62 | */ | 62 | */ | |
63 | 63 | |||
64 | #include <sys/cdefs.h> | 64 | #include <sys/cdefs.h> | |
65 | __KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.155 2016/02/04 02:48:37 riastradh Exp $"); | 65 | __KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.156 2016/04/01 05:11:38 ozaki-r Exp $"); | |
66 | 66 | |||
67 | #ifdef _KERNEL_OPT | 67 | #ifdef _KERNEL_OPT | |
68 | #include "opt_gateway.h" | 68 | #include "opt_gateway.h" | |
69 | #include "opt_inet.h" | 69 | #include "opt_inet.h" | |
70 | #include "opt_inet6.h" | 70 | #include "opt_inet6.h" | |
71 | #include "opt_ipsec.h" | 71 | #include "opt_ipsec.h" | |
72 | #include "opt_compat_netbsd.h" | 72 | #include "opt_compat_netbsd.h" | |
73 | #endif | 73 | #endif | |
74 | 74 | |||
75 | #include <sys/param.h> | 75 | #include <sys/param.h> | |
76 | #include <sys/systm.h> | 76 | #include <sys/systm.h> | |
77 | #include <sys/malloc.h> | 77 | #include <sys/malloc.h> | |
78 | #include <sys/mbuf.h> | 78 | #include <sys/mbuf.h> | |
@@ -134,27 +134,27 @@ extern struct domain inet6domain; | @@ -134,27 +134,27 @@ extern struct domain inet6domain; | |||
134 | 134 | |||
135 | u_char ip6_protox[IPPROTO_MAX]; | 135 | u_char ip6_protox[IPPROTO_MAX]; | |
136 | struct in6_ifaddr *in6_ifaddr; | 136 | struct in6_ifaddr *in6_ifaddr; | |
137 | pktqueue_t *ip6_pktq __read_mostly; | 137 | pktqueue_t *ip6_pktq __read_mostly; | |
138 | 138 | |||
139 | int ip6_forward_srcrt; /* XXX */ | 139 | int ip6_forward_srcrt; /* XXX */ | |
140 | int ip6_sourcecheck; /* XXX */ | 140 | int ip6_sourcecheck; /* XXX */ | |
141 | int ip6_sourcecheck_interval; /* XXX */ | 141 | int ip6_sourcecheck_interval; /* XXX */ | |
142 | 142 | |||
143 | pfil_head_t *inet6_pfil_hook; | 143 | pfil_head_t *inet6_pfil_hook; | |
144 | 144 | |||
145 | percpu_t *ip6stat_percpu; | 145 | percpu_t *ip6stat_percpu; | |
146 | 146 | |||
147 | static void ip6_init2(void *); | 147 | static void ip6_init2(void); | |
148 | static void ip6intr(void *); | 148 | static void ip6intr(void *); | |
149 | static struct m_tag *ip6_setdstifaddr(struct mbuf *, const struct in6_ifaddr *); | 149 | static struct m_tag *ip6_setdstifaddr(struct mbuf *, const struct in6_ifaddr *); | |
150 | 150 | |||
151 | static int ip6_process_hopopts(struct mbuf *, u_int8_t *, int, u_int32_t *, | 151 | static int ip6_process_hopopts(struct mbuf *, u_int8_t *, int, u_int32_t *, | |
152 | u_int32_t *); | 152 | u_int32_t *); | |
153 | static struct mbuf *ip6_pullexthdr(struct mbuf *, size_t, int); | 153 | static struct mbuf *ip6_pullexthdr(struct mbuf *, size_t, int); | |
154 | static void sysctl_net_inet6_ip6_setup(struct sysctllog **); | 154 | static void sysctl_net_inet6_ip6_setup(struct sysctllog **); | |
155 | 155 | |||
156 | /* | 156 | /* | |
157 | * IP6 initialization: fill in IP6 protocol switch table. | 157 | * IP6 initialization: fill in IP6 protocol switch table. | |
158 | * All protocols not implemented in kernel go to raw IP6 protocol handler. | 158 | * All protocols not implemented in kernel go to raw IP6 protocol handler. | |
159 | */ | 159 | */ | |
160 | void | 160 | void | |
@@ -174,45 +174,41 @@ ip6_init(void) | @@ -174,45 +174,41 @@ ip6_init(void) | |||
174 | if (pr->pr_domain->dom_family == PF_INET6 && | 174 | if (pr->pr_domain->dom_family == PF_INET6 && | |
175 | pr->pr_protocol && pr->pr_protocol != IPPROTO_RAW) | 175 | pr->pr_protocol && pr->pr_protocol != IPPROTO_RAW) | |
176 | ip6_protox[pr->pr_protocol] = pr - inet6sw; | 176 | ip6_protox[pr->pr_protocol] = pr - inet6sw; | |
177 | 177 | |||
178 | ip6_pktq = pktq_create(IFQ_MAXLEN, ip6intr, NULL); | 178 | ip6_pktq = pktq_create(IFQ_MAXLEN, ip6intr, NULL); | |
179 | KASSERT(ip6_pktq != NULL); | 179 | KASSERT(ip6_pktq != NULL); | |
180 | 180 | |||
181 | scope6_init(); | 181 | scope6_init(); | |
182 | addrsel_policy_init(); | 182 | addrsel_policy_init(); | |
183 | nd6_init(); | 183 | nd6_init(); | |
184 | frag6_init(); | 184 | frag6_init(); | |
185 | ip6_desync_factor = cprng_fast32() % MAX_TEMP_DESYNC_FACTOR; | 185 | ip6_desync_factor = cprng_fast32() % MAX_TEMP_DESYNC_FACTOR; | |
186 | 186 | |||
187 | ip6_init2(NULL); | 187 | ip6_init2(); | |
188 | #ifdef GATEWAY | 188 | #ifdef GATEWAY | |
189 | ip6flow_init(ip6_hashsize); | 189 | ip6flow_init(ip6_hashsize); | |
190 | #endif | 190 | #endif | |
191 | /* Register our Packet Filter hook. */ | 191 | /* Register our Packet Filter hook. */ | |
192 | inet6_pfil_hook = pfil_head_create(PFIL_TYPE_AF, (void *)AF_INET6); | 192 | inet6_pfil_hook = pfil_head_create(PFIL_TYPE_AF, (void *)AF_INET6); | |
193 | KASSERT(inet6_pfil_hook != NULL); | 193 | KASSERT(inet6_pfil_hook != NULL); | |
194 | 194 | |||
195 | ip6stat_percpu = percpu_alloc(sizeof(uint64_t) * IP6_NSTATS); | 195 | ip6stat_percpu = percpu_alloc(sizeof(uint64_t) * IP6_NSTATS); | |
196 | } | 196 | } | |
197 | 197 | |||
198 | static void | 198 | static void | |
199 | ip6_init2(void *dummy) | 199 | ip6_init2(void) | |
200 | { | 200 | { | |
201 | 201 | |||
202 | /* nd6_timer_init */ | |||
203 | callout_init(&nd6_timer_ch, CALLOUT_MPSAFE); | |||
204 | callout_reset(&nd6_timer_ch, hz, nd6_timer, NULL); | |||
205 | ||||
206 | /* timer for regeneranation of temporary addresses randomize ID */ | 202 | /* timer for regeneranation of temporary addresses randomize ID */ | |
207 | callout_init(&in6_tmpaddrtimer_ch, CALLOUT_MPSAFE); | 203 | callout_init(&in6_tmpaddrtimer_ch, CALLOUT_MPSAFE); | |
208 | callout_reset(&in6_tmpaddrtimer_ch, | 204 | callout_reset(&in6_tmpaddrtimer_ch, | |
209 | (ip6_temp_preferred_lifetime - ip6_desync_factor - | 205 | (ip6_temp_preferred_lifetime - ip6_desync_factor - | |
210 | ip6_temp_regen_advance) * hz, | 206 | ip6_temp_regen_advance) * hz, | |
211 | in6_tmpaddrtimer, NULL); | 207 | in6_tmpaddrtimer, NULL); | |
212 | } | 208 | } | |
213 | 209 | |||
214 | /* | 210 | /* | |
215 | * IP6 input interrupt handling. Just pass the packet to ip6_input. | 211 | * IP6 input interrupt handling. Just pass the packet to ip6_input. | |
216 | */ | 212 | */ | |
217 | static void | 213 | static void | |
218 | ip6intr(void *arg __unused) | 214 | ip6intr(void *arg __unused) |
--- 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,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: nd6.c,v 1.185 2016/02/04 02:48:37 riastradh Exp $ */ | 1 | /* $NetBSD: nd6.c,v 1.186 2016/04/01 05:11:38 ozaki-r Exp $ */ | |
2 | /* $KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $ */ | 2 | /* $KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | 5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -21,27 +21,27 @@ | @@ -21,27 +21,27 @@ | |||
21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | |
24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
30 | * SUCH DAMAGE. | 30 | * SUCH DAMAGE. | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.185 2016/02/04 02:48:37 riastradh Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.186 2016/04/01 05:11:38 ozaki-r Exp $"); | |
35 | 35 | |||
36 | #ifdef _KERNEL_OPT | 36 | #ifdef _KERNEL_OPT | |
37 | #include "opt_net_mpsafe.h" | 37 | #include "opt_net_mpsafe.h" | |
38 | #endif | 38 | #endif | |
39 | 39 | |||
40 | #include "bridge.h" | 40 | #include "bridge.h" | |
41 | #include "carp.h" | 41 | #include "carp.h" | |
42 | 42 | |||
43 | #include <sys/param.h> | 43 | #include <sys/param.h> | |
44 | #include <sys/systm.h> | 44 | #include <sys/systm.h> | |
45 | #include <sys/callout.h> | 45 | #include <sys/callout.h> | |
46 | #include <sys/malloc.h> | 46 | #include <sys/malloc.h> | |
47 | #include <sys/mbuf.h> | 47 | #include <sys/mbuf.h> | |
@@ -113,57 +113,51 @@ static const struct sockaddr_in6 all1_sa | @@ -113,57 +113,51 @@ static const struct sockaddr_in6 all1_sa | |||
113 | .sin6_family = AF_INET6 | 113 | .sin6_family = AF_INET6 | |
114 | , .sin6_len = sizeof(struct sockaddr_in6) | 114 | , .sin6_len = sizeof(struct sockaddr_in6) | |
115 | , .sin6_addr = {.s6_addr = {0xff, 0xff, 0xff, 0xff, | 115 | , .sin6_addr = {.s6_addr = {0xff, 0xff, 0xff, 0xff, | |
116 | 0xff, 0xff, 0xff, 0xff, | 116 | 0xff, 0xff, 0xff, 0xff, | |
117 | 0xff, 0xff, 0xff, 0xff, | 117 | 0xff, 0xff, 0xff, 0xff, | |
118 | 0xff, 0xff, 0xff, 0xff}} | 118 | 0xff, 0xff, 0xff, 0xff}} | |
119 | }; | 119 | }; | |
120 | 120 | |||
121 | static void nd6_setmtu0(struct ifnet *, struct nd_ifinfo *); | 121 | static void nd6_setmtu0(struct ifnet *, struct nd_ifinfo *); | |
122 | static void nd6_slowtimo(void *); | 122 | static void nd6_slowtimo(void *); | |
123 | static int regen_tmpaddr(struct in6_ifaddr *); | 123 | static int regen_tmpaddr(struct in6_ifaddr *); | |
124 | static void nd6_free(struct rtentry *, struct llentry *, int); | 124 | static void nd6_free(struct rtentry *, struct llentry *, int); | |
125 | static void nd6_llinfo_timer(void *); | 125 | static void nd6_llinfo_timer(void *); | |
126 | static void nd6_timer(void *); | |||
126 | static void clear_llinfo_pqueue(struct llentry *); | 127 | static void clear_llinfo_pqueue(struct llentry *); | |
127 | 128 | |||
128 | callout_t nd6_slowtimo_ch; | 129 | static callout_t nd6_slowtimo_ch; | |
129 | callout_t nd6_timer_ch; | 130 | static callout_t nd6_timer_ch; | |
130 | 131 | |||
131 | static int fill_drlist(void *, size_t *, size_t); | 132 | static int fill_drlist(void *, size_t *, size_t); | |
132 | static int fill_prlist(void *, size_t *, size_t); | 133 | static int fill_prlist(void *, size_t *, size_t); | |
133 | 134 | |||
134 | MALLOC_DEFINE(M_IP6NDP, "NDP", "IPv6 Neighbour Discovery"); | 135 | MALLOC_DEFINE(M_IP6NDP, "NDP", "IPv6 Neighbour Discovery"); | |
135 | 136 | |||
136 | void | 137 | void | |
137 | nd6_init(void) | 138 | nd6_init(void) | |
138 | { | 139 | { | |
139 | static int nd6_init_done = 0; | |||
140 | ||||
141 | if (nd6_init_done) { | |||
142 | log(LOG_NOTICE, "nd6_init called more than once(ignored)\n"); | |||
143 | return; | |||
144 | } | |||
145 | 140 | |||
146 | /* initialization of the default router list */ | 141 | /* initialization of the default router list */ | |
147 | TAILQ_INIT(&nd_defrouter); | 142 | TAILQ_INIT(&nd_defrouter); | |
148 | 143 | |||
149 | nd6_init_done = 1; | |||
150 | ||||
151 | callout_init(&nd6_slowtimo_ch, CALLOUT_MPSAFE); | 144 | callout_init(&nd6_slowtimo_ch, CALLOUT_MPSAFE); | |
152 | callout_init(&nd6_timer_ch, CALLOUT_MPSAFE); | 145 | callout_init(&nd6_timer_ch, CALLOUT_MPSAFE); | |
153 | 146 | |||
154 | /* start timer */ | 147 | /* start timer */ | |
155 | callout_reset(&nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL * hz, | 148 | callout_reset(&nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL * hz, | |
156 | nd6_slowtimo, NULL); | 149 | nd6_slowtimo, NULL); | |
150 | callout_reset(&nd6_timer_ch, hz, nd6_timer, NULL); | |||
157 | } | 151 | } | |
158 | 152 | |||
159 | struct nd_ifinfo * | 153 | struct nd_ifinfo * | |
160 | nd6_ifattach(struct ifnet *ifp) | 154 | nd6_ifattach(struct ifnet *ifp) | |
161 | { | 155 | { | |
162 | struct nd_ifinfo *nd; | 156 | struct nd_ifinfo *nd; | |
163 | 157 | |||
164 | nd = (struct nd_ifinfo *)malloc(sizeof(*nd), M_IP6NDP, M_WAITOK|M_ZERO); | 158 | nd = (struct nd_ifinfo *)malloc(sizeof(*nd), M_IP6NDP, M_WAITOK|M_ZERO); | |
165 | 159 | |||
166 | nd->initialized = 1; | 160 | nd->initialized = 1; | |
167 | 161 | |||
168 | nd->chlim = IPV6_DEFHLIM; | 162 | nd->chlim = IPV6_DEFHLIM; | |
169 | nd->basereachable = REACHABLE_TIME; | 163 | nd->basereachable = REACHABLE_TIME; | |
@@ -582,27 +576,27 @@ nd6_llinfo_timer(void *arg) | @@ -582,27 +576,27 @@ nd6_llinfo_timer(void *arg) | |||
582 | nd6_ns_output(ifp, daddr6, &dst->sin6_addr, psrc, 0); | 576 | nd6_ns_output(ifp, daddr6, &dst->sin6_addr, psrc, 0); | |
583 | } | 577 | } | |
584 | 578 | |||
585 | out: | 579 | out: | |
586 | if (ln != NULL) | 580 | if (ln != NULL) | |
587 | LLE_FREE_LOCKED(ln); | 581 | LLE_FREE_LOCKED(ln); | |
588 | KERNEL_UNLOCK_ONE(NULL); | 582 | KERNEL_UNLOCK_ONE(NULL); | |
589 | mutex_exit(softnet_lock); | 583 | mutex_exit(softnet_lock); | |
590 | } | 584 | } | |
591 | 585 | |||
592 | /* | 586 | /* | |
593 | * ND6 timer routine to expire default route list and prefix list | 587 | * ND6 timer routine to expire default route list and prefix list | |
594 | */ | 588 | */ | |
595 | void | 589 | static void | |
596 | nd6_timer(void *ignored_arg) | 590 | nd6_timer(void *ignored_arg) | |
597 | { | 591 | { | |
598 | struct nd_defrouter *next_dr, *dr; | 592 | struct nd_defrouter *next_dr, *dr; | |
599 | struct nd_prefix *next_pr, *pr; | 593 | struct nd_prefix *next_pr, *pr; | |
600 | struct in6_ifaddr *ia6, *nia6; | 594 | struct in6_ifaddr *ia6, *nia6; | |
601 | 595 | |||
602 | callout_reset(&nd6_timer_ch, nd6_prune * hz, | 596 | callout_reset(&nd6_timer_ch, nd6_prune * hz, | |
603 | nd6_timer, NULL); | 597 | nd6_timer, NULL); | |
604 | 598 | |||
605 | mutex_enter(softnet_lock); | 599 | mutex_enter(softnet_lock); | |
606 | KERNEL_LOCK(1, NULL); | 600 | KERNEL_LOCK(1, NULL); | |
607 | 601 | |||
608 | /* expire default router list */ | 602 | /* expire default router list */ |
--- 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,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: nd6.h,v 1.69 2015/12/07 06:19:13 ozaki-r Exp $ */ | 1 | /* $NetBSD: nd6.h,v 1.70 2016/04/01 05:11:38 ozaki-r Exp $ */ | |
2 | /* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */ | 2 | /* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | 5 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -342,28 +342,26 @@ MALLOC_DECLARE(M_IP6NDP); | @@ -342,28 +342,26 @@ MALLOC_DECLARE(M_IP6NDP); | |||
342 | extern int nd6_prune; | 342 | extern int nd6_prune; | |
343 | extern int nd6_delay; | 343 | extern int nd6_delay; | |
344 | extern int nd6_umaxtries; | 344 | extern int nd6_umaxtries; | |
345 | extern int nd6_mmaxtries; | 345 | extern int nd6_mmaxtries; | |
346 | extern int nd6_useloopback; | 346 | extern int nd6_useloopback; | |
347 | extern int nd6_maxnudhint; | 347 | extern int nd6_maxnudhint; | |
348 | extern int nd6_gctimer; | 348 | extern int nd6_gctimer; | |
349 | extern struct nd_drhead nd_defrouter; | 349 | extern struct nd_drhead nd_defrouter; | |
350 | extern struct nd_prhead nd_prefix; | 350 | extern struct nd_prhead nd_prefix; | |
351 | extern int nd6_debug; | 351 | extern int nd6_debug; | |
352 | 352 | |||
353 | #define nd6log(x) do { if (nd6_debug) log x; } while (/*CONSTCOND*/ 0) | 353 | #define nd6log(x) do { if (nd6_debug) log x; } while (/*CONSTCOND*/ 0) | |
354 | 354 | |||
355 | extern struct callout nd6_timer_ch; | |||
356 | ||||
357 | /* nd6_rtr.c */ | 355 | /* nd6_rtr.c */ | |
358 | extern int nd6_defifindex; | 356 | extern int nd6_defifindex; | |
359 | extern int ip6_desync_factor; /* seconds */ | 357 | extern int ip6_desync_factor; /* seconds */ | |
360 | extern u_int32_t ip6_temp_preferred_lifetime; /* seconds */ | 358 | extern u_int32_t ip6_temp_preferred_lifetime; /* seconds */ | |
361 | extern u_int32_t ip6_temp_valid_lifetime; /* seconds */ | 359 | extern u_int32_t ip6_temp_valid_lifetime; /* seconds */ | |
362 | extern int ip6_temp_regen_advance; /* seconds */ | 360 | extern int ip6_temp_regen_advance; /* seconds */ | |
363 | extern int nd6_numroutes; | 361 | extern int nd6_numroutes; | |
364 | 362 | |||
365 | union nd_opts { | 363 | union nd_opts { | |
366 | struct nd_opt_hdr *nd_opt_array[8]; | 364 | struct nd_opt_hdr *nd_opt_array[8]; | |
367 | struct { | 365 | struct { | |
368 | struct nd_opt_hdr *zero; | 366 | struct nd_opt_hdr *zero; | |
369 | struct nd_opt_hdr *src_lladdr; | 367 | struct nd_opt_hdr *src_lladdr; | |
@@ -392,27 +390,26 @@ union nd_opts { | @@ -392,27 +390,26 @@ union nd_opts { | |||
392 | /* XXX: need nd6_var.h?? */ | 390 | /* XXX: need nd6_var.h?? */ | |
393 | /* nd6.c */ | 391 | /* nd6.c */ | |
394 | void nd6_init(void); | 392 | void nd6_init(void); | |
395 | struct nd_ifinfo *nd6_ifattach(struct ifnet *); | 393 | struct nd_ifinfo *nd6_ifattach(struct ifnet *); | |
396 | void nd6_ifdetach(struct ifnet *, struct in6_ifextra *); | 394 | void nd6_ifdetach(struct ifnet *, struct in6_ifextra *); | |
397 | int nd6_is_addr_neighbor(const struct sockaddr_in6 *, struct ifnet *); | 395 | int nd6_is_addr_neighbor(const struct sockaddr_in6 *, struct ifnet *); | |
398 | void nd6_option_init(void *, int, union nd_opts *); | 396 | void nd6_option_init(void *, int, union nd_opts *); | |
399 | struct nd_opt_hdr *nd6_option(union nd_opts *); | 397 | struct nd_opt_hdr *nd6_option(union nd_opts *); | |
400 | int nd6_options(union nd_opts *); | 398 | int nd6_options(union nd_opts *); | |
401 | struct rtentry *nd6_lookup(const struct in6_addr *, int, struct ifnet *); | 399 | struct rtentry *nd6_lookup(const struct in6_addr *, int, struct ifnet *); | |
402 | void nd6_setmtu(struct ifnet *); | 400 | void nd6_setmtu(struct ifnet *); | |
403 | void nd6_llinfo_settimer(struct llentry *, time_t); | 401 | void nd6_llinfo_settimer(struct llentry *, time_t); | |
404 | void nd6_llinfo_settimer_locked(struct llentry *, time_t); | 402 | void nd6_llinfo_settimer_locked(struct llentry *, time_t); | |
405 | void nd6_timer(void *); | |||
406 | void nd6_purge(struct ifnet *, struct in6_ifextra *); | 403 | void nd6_purge(struct ifnet *, struct in6_ifextra *); | |
407 | void nd6_nud_hint(struct rtentry *); | 404 | void nd6_nud_hint(struct rtentry *); | |
408 | int nd6_resolve(struct ifnet *, struct rtentry *, | 405 | int nd6_resolve(struct ifnet *, struct rtentry *, | |
409 | struct mbuf *, struct sockaddr *, u_char *); | 406 | struct mbuf *, struct sockaddr *, u_char *); | |
410 | void nd6_rtrequest(int, struct rtentry *, const struct rt_addrinfo *); | 407 | void nd6_rtrequest(int, struct rtentry *, const struct rt_addrinfo *); | |
411 | int nd6_ioctl(u_long, void *, struct ifnet *); | 408 | int nd6_ioctl(u_long, void *, struct ifnet *); | |
412 | void nd6_cache_lladdr(struct ifnet *, struct in6_addr *, | 409 | void nd6_cache_lladdr(struct ifnet *, struct in6_addr *, | |
413 | char *, int, int, int); | 410 | char *, int, int, int); | |
414 | int nd6_output(struct ifnet *, struct ifnet *, struct mbuf *, | 411 | int nd6_output(struct ifnet *, struct ifnet *, struct mbuf *, | |
415 | const struct sockaddr_in6 *, struct rtentry *); | 412 | const struct sockaddr_in6 *, struct rtentry *); | |
416 | int nd6_storelladdr(const struct ifnet *, const struct rtentry *, struct mbuf *, | 413 | int nd6_storelladdr(const struct ifnet *, const struct rtentry *, struct mbuf *, | |
417 | const struct sockaddr *, uint8_t *, size_t); | 414 | const struct sockaddr *, uint8_t *, size_t); | |
418 | int nd6_sysctl(int, void *, size_t *, void *, size_t); | 415 | int nd6_sysctl(int, void *, size_t *, void *, size_t); |