nd.c revision 1.7 1 1.7 riastrad /* $NetBSD: nd.c,v 1.7 2024/05/30 23:00:39 riastradh Exp $ */
2 1.1 roy
3 1.1 roy /*
4 1.1 roy * Copyright (c) 2020 The NetBSD Foundation, Inc.
5 1.1 roy *
6 1.1 roy * This code is derived from software contributed to The NetBSD Foundation
7 1.1 roy * by Roy Marples.
8 1.1 roy *
9 1.1 roy * Redistribution and use in source and binary forms, with or without
10 1.1 roy * modification, are permitted provided that the following conditions
11 1.1 roy * are met:
12 1.1 roy * 1. Redistributions of source code must retain the above copyright
13 1.1 roy * notice, this list of conditions and the following disclaimer.
14 1.1 roy * 2. Redistributions in binary form must reproduce the above copyright
15 1.1 roy * notice, this list of conditions and the following disclaimer in the
16 1.1 roy * documentation and/or other materials provided with the distribution.
17 1.1 roy *
18 1.1 roy * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 1.1 roy * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 1.1 roy * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 1.1 roy * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 1.1 roy * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 1.1 roy * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 1.1 roy * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 1.1 roy * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 1.1 roy * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 1.1 roy * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 1.1 roy */
29 1.1 roy
30 1.1 roy #include <sys/cdefs.h>
31 1.7 riastrad __KERNEL_RCSID(0, "$NetBSD: nd.c,v 1.7 2024/05/30 23:00:39 riastradh Exp $");
32 1.1 roy
33 1.1 roy #include <sys/callout.h>
34 1.1 roy #include <sys/mbuf.h>
35 1.1 roy #include <sys/socketvar.h> /* for softnet_lock */
36 1.1 roy
37 1.1 roy #include <net/if_llatbl.h>
38 1.1 roy #include <net/nd.h>
39 1.1 roy #include <net/route.h>
40 1.1 roy
41 1.1 roy #include <netinet/in.h>
42 1.1 roy #include <netinet/ip6.h>
43 1.1 roy
44 1.1 roy static struct nd_domain *nd_domains[AF_MAX];
45 1.1 roy
46 1.1 roy static int nd_gctimer = (60 * 60 * 24); /* 1 day: garbage collection timer */
47 1.1 roy
48 1.1 roy static void nd_set_timertick(struct llentry *, time_t);
49 1.1 roy static struct nd_domain *nd_find_domain(int);
50 1.1 roy
51 1.1 roy static void
52 1.1 roy nd_timer(void *arg)
53 1.1 roy {
54 1.1 roy struct llentry *ln = arg;
55 1.1 roy struct nd_domain *nd;
56 1.1 roy struct ifnet *ifp = NULL;
57 1.1 roy struct psref psref;
58 1.1 roy struct mbuf *m = NULL;
59 1.3 roy bool send_ns = false;
60 1.4 roy int16_t missed = ND_LLINFO_NOSTATE;
61 1.2 roy union l3addr taddr, *daddrp = NULL;
62 1.1 roy
63 1.1 roy SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();
64 1.1 roy LLE_WLOCK(ln);
65 1.1 roy
66 1.1 roy if (!(ln->la_flags & LLE_LINKED))
67 1.1 roy goto out;
68 1.1 roy if (ln->ln_ntick > 0) {
69 1.1 roy nd_set_timer(ln, ND_TIMER_TICK);
70 1.1 roy goto out;
71 1.1 roy }
72 1.1 roy
73 1.1 roy nd = nd_find_domain(ln->lle_tbl->llt_af);
74 1.1 roy ifp = ln->lle_tbl->llt_ifp;
75 1.1 roy KASSERT(ifp != NULL);
76 1.1 roy if_acquire(ifp, &psref);
77 1.1 roy
78 1.1 roy memcpy(&taddr, &ln->r_l3addr, sizeof(taddr));
79 1.1 roy
80 1.1 roy switch (ln->ln_state) {
81 1.1 roy case ND_LLINFO_WAITDELETE:
82 1.1 roy LLE_REMREF(ln);
83 1.1 roy nd->nd_free(ln, 0);
84 1.1 roy ln = NULL;
85 1.1 roy break;
86 1.1 roy
87 1.1 roy case ND_LLINFO_INCOMPLETE:
88 1.3 roy send_ns = true;
89 1.3 roy if (ln->ln_asked++ < nd->nd_mmaxtries)
90 1.1 roy break;
91 1.1 roy
92 1.1 roy if (ln->ln_hold) {
93 1.1 roy struct mbuf *m0, *mnxt;
94 1.1 roy
95 1.1 roy /*
96 1.1 roy * Assuming every packet in ln_hold
97 1.1 roy * has the same IP header.
98 1.1 roy */
99 1.1 roy m = ln->ln_hold;
100 1.1 roy for (m0 = m->m_nextpkt; m0 != NULL; m0 = mnxt) {
101 1.1 roy mnxt = m0->m_nextpkt;
102 1.1 roy m0->m_nextpkt = NULL;
103 1.1 roy m_freem(m0);
104 1.1 roy }
105 1.1 roy
106 1.1 roy m->m_nextpkt = NULL;
107 1.1 roy ln->ln_hold = NULL;
108 1.7 riastrad ln->la_numheld = 0;
109 1.1 roy }
110 1.1 roy
111 1.7 riastrad KASSERTMSG(ln->la_numheld == 0, "la_numheld=%d",
112 1.7 riastrad ln->la_numheld);
113 1.7 riastrad
114 1.3 roy missed = ND_LLINFO_INCOMPLETE;
115 1.1 roy ln->ln_state = ND_LLINFO_WAITDELETE;
116 1.1 roy break;
117 1.1 roy
118 1.1 roy case ND_LLINFO_REACHABLE:
119 1.1 roy if (!ND_IS_LLINFO_PERMANENT(ln)) {
120 1.1 roy ln->ln_state = ND_LLINFO_STALE;
121 1.1 roy nd_set_timer(ln, ND_TIMER_GC);
122 1.1 roy }
123 1.1 roy break;
124 1.1 roy
125 1.1 roy case ND_LLINFO_PURGE: /* FALLTHROUGH */
126 1.1 roy case ND_LLINFO_STALE:
127 1.1 roy if (!ND_IS_LLINFO_PERMANENT(ln)) {
128 1.1 roy LLE_REMREF(ln);
129 1.1 roy nd->nd_free(ln, 1);
130 1.1 roy ln = NULL;
131 1.1 roy }
132 1.1 roy break;
133 1.1 roy
134 1.1 roy case ND_LLINFO_DELAY:
135 1.1 roy if (nd->nd_nud_enabled(ifp)) {
136 1.1 roy ln->ln_asked = 1;
137 1.1 roy ln->ln_state = ND_LLINFO_PROBE;
138 1.1 roy send_ns = true;
139 1.1 roy daddrp = &taddr;
140 1.1 roy } else {
141 1.1 roy ln->ln_state = ND_LLINFO_STALE;
142 1.1 roy nd_set_timer(ln, ND_TIMER_GC);
143 1.1 roy }
144 1.1 roy break;
145 1.1 roy
146 1.1 roy case ND_LLINFO_PROBE:
147 1.3 roy send_ns = true;
148 1.3 roy if (ln->ln_asked++ < nd->nd_umaxtries) {
149 1.1 roy daddrp = &taddr;
150 1.1 roy } else {
151 1.3 roy ln->ln_state = ND_LLINFO_UNREACHABLE;
152 1.3 roy ln->ln_asked = 1;
153 1.3 roy missed = ND_LLINFO_PROBE;
154 1.3 roy /* nd_missed() consumers can use missed to know if
155 1.3 roy * they need to send ICMP UNREACHABLE or not. */
156 1.1 roy }
157 1.1 roy break;
158 1.3 roy case ND_LLINFO_UNREACHABLE:
159 1.3 roy /*
160 1.3 roy * RFC 7048 Section 3 says in the UNREACHABLE state
161 1.3 roy * packets continue to be sent to the link-layer address and
162 1.3 roy * then backoff exponentially.
163 1.3 roy * We adjust this slightly and move to the INCOMPLETE state
164 1.3 roy * after nd_mmaxtries probes and then start backing off.
165 1.3 roy *
166 1.3 roy * This results in simpler code whilst providing a more robust
167 1.3 roy * model which doubles the time to failure over what we did
168 1.3 roy * before. We don't want to be back to the old ARP model where
169 1.3 roy * no unreachability errors are returned because very
170 1.3 roy * few applications would look at unreachability hints provided
171 1.3 roy * such as ND_LLINFO_UNREACHABLE or RTM_MISS.
172 1.3 roy */
173 1.3 roy send_ns = true;
174 1.3 roy if (ln->ln_asked++ < nd->nd_mmaxtries)
175 1.3 roy break;
176 1.3 roy
177 1.3 roy missed = ND_LLINFO_UNREACHABLE;
178 1.3 roy ln->ln_state = ND_LLINFO_WAITDELETE;
179 1.3 roy ln->la_flags &= ~LLE_VALID;
180 1.3 roy break;
181 1.1 roy }
182 1.1 roy
183 1.1 roy if (send_ns) {
184 1.1 roy uint8_t lladdr[255], *lladdrp;
185 1.2 roy union l3addr src, *psrc;
186 1.1 roy
187 1.3 roy if (ln->ln_state == ND_LLINFO_WAITDELETE)
188 1.3 roy nd_set_timer(ln, ND_TIMER_RETRANS_BACKOFF);
189 1.3 roy else
190 1.3 roy nd_set_timer(ln, ND_TIMER_RETRANS);
191 1.1 roy if (ln->ln_state > ND_LLINFO_INCOMPLETE &&
192 1.1 roy ln->la_flags & LLE_VALID)
193 1.1 roy {
194 1.1 roy KASSERT(sizeof(lladdr) >= ifp->if_addrlen);
195 1.1 roy memcpy(lladdr, &ln->ll_addr, ifp->if_addrlen);
196 1.1 roy lladdrp = lladdr;
197 1.1 roy } else
198 1.1 roy lladdrp = NULL;
199 1.1 roy psrc = nd->nd_holdsrc(ln, &src);
200 1.1 roy LLE_FREE_LOCKED(ln);
201 1.1 roy ln = NULL;
202 1.1 roy nd->nd_output(ifp, daddrp, &taddr, lladdrp, psrc);
203 1.1 roy }
204 1.1 roy
205 1.1 roy out:
206 1.1 roy if (ln != NULL)
207 1.1 roy LLE_FREE_LOCKED(ln);
208 1.1 roy SOFTNET_KERNEL_UNLOCK_UNLESS_NET_MPSAFE();
209 1.1 roy
210 1.4 roy if (missed != ND_LLINFO_NOSTATE)
211 1.3 roy nd->nd_missed(ifp, &taddr, missed, m);
212 1.1 roy if (ifp != NULL)
213 1.1 roy if_release(ifp, &psref);
214 1.1 roy }
215 1.1 roy
216 1.1 roy static void
217 1.1 roy nd_set_timertick(struct llentry *ln, time_t xtick)
218 1.1 roy {
219 1.1 roy
220 1.1 roy CTASSERT(sizeof(time_t) > sizeof(int));
221 1.1 roy KASSERT(xtick >= 0);
222 1.1 roy
223 1.1 roy /*
224 1.1 roy * We have to take care of a reference leak which occurs if
225 1.1 roy * callout_reset overwrites a pending callout schedule. Unfortunately
226 1.1 roy * we don't have a mean to know the overwrite, so we need to know it
227 1.1 roy * using callout_stop. We need to call callout_pending first to exclude
228 1.1 roy * the case that the callout has never been scheduled.
229 1.1 roy */
230 1.1 roy if (callout_pending(&ln->la_timer)) {
231 1.1 roy bool expired;
232 1.1 roy
233 1.1 roy expired = callout_stop(&ln->la_timer);
234 1.1 roy if (!expired)
235 1.1 roy LLE_REMREF(ln);
236 1.1 roy }
237 1.1 roy
238 1.1 roy ln->ln_expire = time_uptime + xtick / hz;
239 1.1 roy LLE_ADDREF(ln);
240 1.1 roy if (xtick > INT_MAX) {
241 1.1 roy ln->ln_ntick = xtick - INT_MAX;
242 1.1 roy xtick = INT_MAX;
243 1.1 roy } else {
244 1.1 roy ln->ln_ntick = 0;
245 1.1 roy }
246 1.1 roy callout_reset(&ln->ln_timer_ch, xtick, nd_timer, ln);
247 1.1 roy }
248 1.1 roy
249 1.1 roy void
250 1.1 roy nd_set_timer(struct llentry *ln, int type)
251 1.1 roy {
252 1.1 roy time_t xtick;
253 1.1 roy struct ifnet *ifp;
254 1.1 roy struct nd_domain *nd;
255 1.1 roy
256 1.1 roy LLE_WLOCK_ASSERT(ln);
257 1.1 roy
258 1.1 roy ifp = ln->lle_tbl->llt_ifp;
259 1.1 roy nd = nd_find_domain(ln->lle_tbl->llt_af);
260 1.1 roy
261 1.1 roy switch (type) {
262 1.1 roy case ND_TIMER_IMMEDIATE:
263 1.1 roy xtick = 0;
264 1.1 roy break;
265 1.1 roy case ND_TIMER_TICK:
266 1.1 roy xtick = ln->ln_ntick;
267 1.1 roy break;
268 1.1 roy case ND_TIMER_RETRANS:
269 1.1 roy xtick = nd->nd_retrans(ifp) * hz / 1000;
270 1.1 roy break;
271 1.3 roy case ND_TIMER_RETRANS_BACKOFF:
272 1.3 roy {
273 1.3 roy unsigned int retrans = nd->nd_retrans(ifp);
274 1.3 roy unsigned int attempts = ln->ln_asked - nd->nd_mmaxtries;
275 1.3 roy
276 1.3 roy xtick = retrans;
277 1.3 roy while (attempts-- != 0) {
278 1.3 roy xtick *= nd->nd_retransmultiple;
279 1.3 roy if (xtick > nd->nd_maxretrans || xtick < retrans) {
280 1.3 roy xtick = nd->nd_maxretrans;
281 1.3 roy break;
282 1.3 roy }
283 1.3 roy }
284 1.3 roy xtick = xtick * hz / 1000;
285 1.3 roy break;
286 1.3 roy }
287 1.1 roy case ND_TIMER_REACHABLE:
288 1.1 roy xtick = nd->nd_reachable(ifp) * hz / 1000;
289 1.1 roy break;
290 1.1 roy case ND_TIMER_EXPIRE:
291 1.1 roy if (ln->ln_expire > time_uptime)
292 1.1 roy xtick = (ln->ln_expire - time_uptime) * hz;
293 1.1 roy else
294 1.1 roy xtick = nd_gctimer * hz;
295 1.1 roy break;
296 1.1 roy case ND_TIMER_DELAY:
297 1.1 roy xtick = nd->nd_delay * hz;
298 1.1 roy break;
299 1.1 roy case ND_TIMER_GC:
300 1.1 roy xtick = nd_gctimer * hz;
301 1.1 roy break;
302 1.1 roy default:
303 1.1 roy panic("%s: invalid timer type\n", __func__);
304 1.1 roy }
305 1.1 roy
306 1.1 roy nd_set_timertick(ln, xtick);
307 1.1 roy }
308 1.1 roy
309 1.1 roy int
310 1.1 roy nd_resolve(struct llentry *ln, const struct rtentry *rt, struct mbuf *m,
311 1.1 roy uint8_t *lldst, size_t dstsize)
312 1.1 roy {
313 1.1 roy struct ifnet *ifp;
314 1.1 roy struct nd_domain *nd;
315 1.1 roy int error;
316 1.1 roy
317 1.1 roy LLE_WLOCK_ASSERT(ln);
318 1.1 roy
319 1.1 roy ifp = ln->lle_tbl->llt_ifp;
320 1.1 roy nd = nd_find_domain(ln->lle_tbl->llt_af);
321 1.1 roy
322 1.1 roy /* We don't have to do link-layer address resolution on a p2p link. */
323 1.1 roy if (ifp->if_flags & IFF_POINTOPOINT &&
324 1.1 roy ln->ln_state < ND_LLINFO_REACHABLE)
325 1.1 roy {
326 1.1 roy ln->ln_state = ND_LLINFO_STALE;
327 1.1 roy nd_set_timer(ln, ND_TIMER_GC);
328 1.1 roy }
329 1.1 roy
330 1.1 roy /*
331 1.1 roy * The first time we send a packet to a neighbor whose entry is
332 1.1 roy * STALE, we have to change the state to DELAY and a sets a timer to
333 1.1 roy * expire in DELAY_FIRST_PROBE_TIME seconds to ensure do
334 1.1 roy * neighbor unreachability detection on expiration.
335 1.1 roy * (RFC 2461 7.3.3)
336 1.1 roy */
337 1.1 roy if (ln->ln_state == ND_LLINFO_STALE) {
338 1.1 roy ln->ln_asked = 0;
339 1.1 roy ln->ln_state = ND_LLINFO_DELAY;
340 1.1 roy nd_set_timer(ln, ND_TIMER_DELAY);
341 1.1 roy }
342 1.1 roy
343 1.1 roy /*
344 1.1 roy * If the neighbor cache entry has a state other than INCOMPLETE
345 1.1 roy * (i.e. its link-layer address is already resolved), just
346 1.1 roy * send the packet.
347 1.1 roy */
348 1.1 roy if (ln->ln_state > ND_LLINFO_INCOMPLETE) {
349 1.1 roy KASSERT((ln->la_flags & LLE_VALID) != 0);
350 1.1 roy memcpy(lldst, &ln->ll_addr, MIN(dstsize, ifp->if_addrlen));
351 1.1 roy LLE_WUNLOCK(ln);
352 1.1 roy return 0;
353 1.1 roy }
354 1.1 roy
355 1.1 roy /*
356 1.1 roy * There is a neighbor cache entry, but no ethernet address
357 1.1 roy * response yet. Append this latest packet to the end of the
358 1.1 roy * packet queue in the mbuf, unless the number of the packet
359 1.1 roy * does not exceed maxqueuelen. When it exceeds maxqueuelen,
360 1.1 roy * the oldest packet in the queue will be removed.
361 1.1 roy */
362 1.1 roy if (ln->ln_state == ND_LLINFO_NOSTATE ||
363 1.1 roy ln->ln_state == ND_LLINFO_WAITDELETE)
364 1.1 roy ln->ln_state = ND_LLINFO_INCOMPLETE;
365 1.1 roy
366 1.5 yamt #ifdef MBUFTRACE
367 1.5 yamt m_claimm(m, ln->lle_tbl->llt_mowner);
368 1.5 yamt #endif
369 1.1 roy if (ln->ln_hold != NULL) {
370 1.1 roy struct mbuf *m_hold;
371 1.1 roy int i;
372 1.1 roy
373 1.1 roy i = 0;
374 1.1 roy for (m_hold = ln->ln_hold; m_hold; m_hold = m_hold->m_nextpkt) {
375 1.1 roy i++;
376 1.1 roy if (m_hold->m_nextpkt == NULL) {
377 1.1 roy m_hold->m_nextpkt = m;
378 1.1 roy break;
379 1.1 roy }
380 1.1 roy }
381 1.6 riastrad KASSERTMSG(ln->la_numheld == i, "la_numheld=%d i=%d",
382 1.6 riastrad ln->la_numheld, i);
383 1.1 roy while (i >= nd->nd_maxqueuelen) {
384 1.1 roy m_hold = ln->ln_hold;
385 1.1 roy ln->ln_hold = ln->ln_hold->m_nextpkt;
386 1.1 roy m_freem(m_hold);
387 1.1 roy i--;
388 1.6 riastrad ln->la_numheld--;
389 1.1 roy }
390 1.6 riastrad } else {
391 1.6 riastrad KASSERTMSG(ln->la_numheld == 0, "la_numheld=%d",
392 1.6 riastrad ln->la_numheld);
393 1.1 roy ln->ln_hold = m;
394 1.6 riastrad }
395 1.6 riastrad
396 1.6 riastrad KASSERTMSG(ln->la_numheld < nd->nd_maxqueuelen,
397 1.6 riastrad "la_numheld=%d nd_maxqueuelen=%d",
398 1.6 riastrad ln->la_numheld, nd->nd_maxqueuelen);
399 1.6 riastrad ln->la_numheld++;
400 1.1 roy
401 1.1 roy if (ln->ln_asked >= nd->nd_mmaxtries)
402 1.1 roy error = (rt != NULL && rt->rt_flags & RTF_GATEWAY) ?
403 1.1 roy EHOSTUNREACH : EHOSTDOWN;
404 1.1 roy else
405 1.1 roy error = EWOULDBLOCK;
406 1.1 roy
407 1.1 roy /*
408 1.1 roy * If there has been no NS for the neighbor after entering the
409 1.1 roy * INCOMPLETE state, send the first solicitation.
410 1.1 roy */
411 1.1 roy if (!ND_IS_LLINFO_PERMANENT(ln) && ln->ln_asked == 0) {
412 1.1 roy struct psref psref;
413 1.2 roy union l3addr dst, src, *psrc;
414 1.1 roy
415 1.1 roy ln->ln_asked++;
416 1.1 roy nd_set_timer(ln, ND_TIMER_RETRANS);
417 1.1 roy memcpy(&dst, &ln->r_l3addr, sizeof(dst));
418 1.1 roy psrc = nd->nd_holdsrc(ln, &src);
419 1.1 roy if_acquire(ifp, &psref);
420 1.1 roy LLE_WUNLOCK(ln);
421 1.1 roy
422 1.1 roy nd->nd_output(ifp, NULL, &dst, NULL, psrc);
423 1.1 roy if_release(ifp, &psref);
424 1.1 roy } else
425 1.1 roy LLE_WUNLOCK(ln);
426 1.1 roy
427 1.1 roy return error;
428 1.1 roy }
429 1.1 roy
430 1.1 roy void
431 1.1 roy nd_nud_hint(struct llentry *ln)
432 1.1 roy {
433 1.1 roy struct nd_domain *nd;
434 1.1 roy
435 1.1 roy if (ln == NULL)
436 1.1 roy return;
437 1.1 roy
438 1.1 roy LLE_WLOCK_ASSERT(ln);
439 1.1 roy
440 1.1 roy if (ln->ln_state < ND_LLINFO_REACHABLE)
441 1.1 roy goto done;
442 1.1 roy
443 1.1 roy nd = nd_find_domain(ln->lle_tbl->llt_af);
444 1.1 roy
445 1.1 roy /*
446 1.1 roy * if we get upper-layer reachability confirmation many times,
447 1.1 roy * it is possible we have false information.
448 1.1 roy */
449 1.1 roy ln->ln_byhint++;
450 1.1 roy if (ln->ln_byhint > nd->nd_maxnudhint)
451 1.1 roy goto done;
452 1.1 roy
453 1.1 roy ln->ln_state = ND_LLINFO_REACHABLE;
454 1.1 roy if (!ND_IS_LLINFO_PERMANENT(ln))
455 1.1 roy nd_set_timer(ln, ND_TIMER_REACHABLE);
456 1.1 roy
457 1.1 roy done:
458 1.1 roy LLE_WUNLOCK(ln);
459 1.1 roy
460 1.1 roy return;
461 1.1 roy }
462 1.1 roy
463 1.1 roy static struct nd_domain *
464 1.1 roy nd_find_domain(int af)
465 1.1 roy {
466 1.1 roy
467 1.1 roy KASSERT(af < __arraycount(nd_domains) && nd_domains[af] != NULL);
468 1.1 roy return nd_domains[af];
469 1.1 roy }
470 1.1 roy
471 1.1 roy void
472 1.1 roy nd_attach_domain(struct nd_domain *nd)
473 1.1 roy {
474 1.1 roy
475 1.1 roy KASSERT(nd->nd_family < __arraycount(nd_domains));
476 1.1 roy nd_domains[nd->nd_family] = nd;
477 1.1 roy }
478