2 * Copyright (c) 2009 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 /* $FreeBSD: src/sys/netinet6/nd6.h,v 1.2.2.3 2001/08/13 01:10:49 simokawa Exp $ */
30 /* $KAME: nd6.h,v 1.55 2001/04/27 15:09:49 itojun Exp $ */
33 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
34 * All rights reserved.
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
39 * 1. Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 * 2. Redistributions in binary form must reproduce the above copyright
42 * notice, this list of conditions and the following disclaimer in the
43 * documentation and/or other materials provided with the distribution.
44 * 3. Neither the name of the project nor the names of its contributors
45 * may be used to endorse or promote products derived from this software
46 * without specific prior written permission.
48 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
49 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
61 #ifndef _NETINET6_ND6_H_
62 #define _NETINET6_ND6_H_
63 #include <sys/appleapiopts.h>
65 /* see net/route.h, or net/if_inarp.h */
67 #define RTF_ANNOUNCE RTF_PROTO2
70 #include <sys/queue.h>
73 #include <kern/locks.h>
77 * The following are protected by rnh_lock
79 struct llinfo_nd6
*ln_next
;
80 struct llinfo_nd6
*ln_prev
;
81 struct rtentry
*ln_rt
;
83 * The following are protected by rt_lock
85 struct mbuf
*ln_hold
; /* last packet until resolved/timeout */
86 long ln_asked
; /* number of queries already sent for this addr */
87 u_int32_t ln_expire
; /* lifetime for NDP state transition */
88 short ln_state
; /* reachability state */
89 short ln_router
; /* 2^0: ND6 router bit */
90 int ln_byhint
; /* # of times we made it reachable by UL hint */
91 u_int32_t ln_flags
; /* flags; see below */
94 /* Values for ln_flags */
95 #define ND6_LNF_TIMER_SKIP 0x1 /* modified by nd6_timer() */
96 #define ND6_LNF_IN_USE 0x2 /* currently in llinfo_nd6 list */
97 #endif /* KERNEL_PRIVATE */
99 #define ND6_LLINFO_PURGE -3
100 #define ND6_LLINFO_NOSTATE -2
102 * We don't need the WAITDELETE state any more, but we keep the definition
103 * in a comment line instead of removing it. This is necessary to avoid
104 * unintentionally reusing the value for another purpose, which might
105 * affect backward compatibility with old applications.
106 * (20000711 jinmei@kame.net)
108 /* #define ND6_LLINFO_WAITDELETE -1 */
109 #define ND6_LLINFO_INCOMPLETE 0
110 #define ND6_LLINFO_REACHABLE 1
111 #define ND6_LLINFO_STALE 2
112 #define ND6_LLINFO_DELAY 3
113 #define ND6_LLINFO_PROBE 4
115 #ifdef KERNEL_PRIVATE
116 #define ND6_IS_LLINFO_PROBREACH(n) ((n)->ln_state > ND6_LLINFO_INCOMPLETE)
117 #endif /* KERNEL_PRIVATE */
119 #if !defined(KERNEL_PRIVATE)
122 /* For binary compatibility, this structure must not change */
123 struct nd_ifinfo_compat
{
124 #endif /* !KERNEL_PRIVATE */
125 u_int32_t linkmtu
; /* LinkMTU */
126 u_int32_t maxmtu
; /* Upper bound of LinkMTU */
127 u_int32_t basereachable
; /* BaseReachableTime */
128 u_int32_t reachable
; /* Reachable Time */
129 u_int32_t retrans
; /* Retrans Timer */
130 u_int32_t flags
; /* Flags */
131 int recalctm
; /* BaseReacable re-calculation timer */
132 u_int8_t chlim
; /* CurHopLimit */
134 /* the following 3 members are for privacy extension for addrconf */
135 u_int8_t randomseed0
[8]; /* upper 64 bits of MD5 digest */
136 u_int8_t randomseed1
[8]; /* lower 64 bits (usually the EUI64 IFID) */
137 u_int8_t randomid
[8]; /* current random ID */
140 #if defined(KERNEL_PRIVATE)
142 u_int32_t linkmtu
; /* LinkMTU */
143 u_int32_t maxmtu
; /* Upper bound of LinkMTU */
144 u_int32_t basereachable
; /* BaseReachableTime */
145 u_int32_t reachable
; /* Reachable Time */
146 u_int32_t retrans
; /* Retrans Timer */
147 u_int32_t flags
; /* Flags */
148 int recalctm
; /* BaseReacable re-calculation timer */
149 u_int8_t chlim
; /* CurHopLimit */
151 /* the following 3 members are for privacy extension for addrconf */
152 u_int8_t randomseed0
[8]; /* upper 64 bits of MD5 digest */
153 u_int8_t randomseed1
[8]; /* lower 64 bits (usually the EUI64 IFID) */
154 u_int8_t randomid
[8]; /* current random ID */
155 /* keep track of routers and prefixes on this link */
159 #endif /* KERNEL_PRIVATE */
161 #define ND6_IFF_PERFORMNUD 0x1
164 char ifname
[IFNAMSIZ
]; /* if name, e.g. "en0" */
165 struct in6_addr addr
; /* IPv6 address of the neighbor */
166 long asked
; /* number of queries already sent for this addr */
167 int isrouter
; /* if it acts as a router */
168 int state
; /* reachability state */
169 int expire
; /* lifetime for NDP state transition */
172 #if defined(KERNEL_PRIVATE)
173 struct in6_nbrinfo_32
{
174 char ifname
[IFNAMSIZ
];
175 struct in6_addr addr
;
182 struct in6_nbrinfo_64
{
183 char ifname
[IFNAMSIZ
];
184 struct in6_addr addr
;
186 int isrouter
__attribute__((aligned(8)));
189 } __attribute__((aligned(8)));
190 #endif /* KERNEL_PRIVATE */
196 char ifname
[IFNAMSIZ
];
198 struct in6_addr rtaddr
;
203 } defrouter
[DRLSTSIZ
];
206 #if defined(KERNEL_PRIVATE)
207 struct in6_drlist_32
{
208 char ifname
[IFNAMSIZ
];
210 struct in6_addr rtaddr
;
215 } defrouter
[DRLSTSIZ
];
218 struct in6_drlist_64
{
219 char ifname
[IFNAMSIZ
];
221 struct in6_addr rtaddr
;
224 u_long expire
__attribute__((aligned(8)));
225 u_short if_index
__attribute__((aligned(8)));
226 } defrouter
[DRLSTSIZ
] __attribute__((aligned(8)));
228 #endif /* KERNEL_PRIVATE */
230 struct in6_defrouter
{
231 struct sockaddr_in6 rtaddr
;
238 #if defined(KERNEL_PRIVATE)
239 struct in6_defrouter_32
{
240 struct sockaddr_in6 rtaddr
;
247 struct in6_defrouter_64
{
248 struct sockaddr_in6 rtaddr
;
251 u_long expire
__attribute__((aligned(8)));
252 u_short if_index
__attribute__((aligned(8)));
253 } __attribute__((aligned(8)));
254 #endif /* KERNEL_PRIVATE */
257 char ifname
[IFNAMSIZ
];
259 struct in6_addr prefix
;
260 struct prf_ra raflags
;
267 u_short advrtrs
; /* number of advertisement routers */
268 struct in6_addr advrtr
[DRLSTSIZ
]; /* XXX: explicit limit */
272 #if defined(KERNEL_PRIVATE)
273 struct in6_prlist_32
{
274 char ifname
[IFNAMSIZ
];
276 struct in6_addr prefix
;
277 struct prf_ra raflags
;
285 struct in6_addr advrtr
[DRLSTSIZ
];
289 struct in6_prlist_64
{
290 char ifname
[IFNAMSIZ
];
292 struct in6_addr prefix
;
293 struct prf_ra raflags
;
296 u_long vltime
__attribute__((aligned(8)));
297 u_long pltime
__attribute__((aligned(8)));
298 u_long expire
__attribute__((aligned(8)));
302 struct in6_addr advrtr
[DRLSTSIZ
];
305 #endif /* KERNEL_PRIVATE */
308 struct sockaddr_in6 prefix
;
309 struct prf_ra raflags
;
318 u_short advrtrs
; /* number of advertisement routers */
319 /* struct sockaddr_in6 advrtr[] */
322 #if defined(KERNEL_PRIVATE)
323 struct in6_prefix_32
{
324 struct sockaddr_in6 prefix
;
325 struct prf_ra raflags
;
335 /* struct sockaddr_in6 advrtr[] */
338 struct in6_prefix_64
{
339 struct sockaddr_in6 prefix
;
340 struct prf_ra raflags
;
343 u_long vltime
__attribute__((aligned(8)));
344 u_long pltime
__attribute__((aligned(8)));
345 u_long expire
__attribute__((aligned(8)));
346 u_int32_t flags
__attribute__((aligned(8)));
350 /* struct sockaddr_in6 advrtr[] */
352 #endif /* KERNEL_PRIVATE */
355 char ifname
[IFNAMSIZ
];
357 u_int32_t linkmtu
; /* LinkMTU */
358 u_int32_t maxmtu
; /* Upper bound of LinkMTU */
359 u_int32_t basereachable
; /* BaseReachableTime */
360 u_int32_t reachable
; /* Reachable Time */
361 u_int32_t retrans
; /* Retrans Timer */
362 u_int32_t flags
; /* Flags */
363 int recalctm
; /* BaseReacable re-calculation timer */
364 u_int8_t chlim
; /* CurHopLimit */
369 #if !defined(KERNEL_PRIVATE)
371 char ifname
[IFNAMSIZ
];
372 struct nd_ifinfo ndi
;
376 char ifname
[IFNAMSIZ
];
377 struct nd_ifinfo_compat ndi
;
379 #endif /* !KERNEL_PRIVATE */
382 char ifname
[IFNAMSIZ
];
386 #if defined(KERNEL_PRIVATE)
387 struct in6_ndifreq_32
{
388 char ifname
[IFNAMSIZ
];
392 struct in6_ndifreq_64
{
393 char ifname
[IFNAMSIZ
];
394 u_long ifindex
__attribute__((aligned(8)));
396 #endif /* KERNEL_PRIVATE */
399 #define NDPRF_ONLINK 0x1
400 #define NDPRF_DETACHED 0x2
402 /* protocol constants */
403 #define MAX_RTR_SOLICITATION_DELAY 1 /*1sec*/
404 #define RTR_SOLICITATION_INTERVAL 4 /*4sec*/
405 #define MAX_RTR_SOLICITATIONS 3
407 #define ND6_INFINITE_LIFETIME 0xffffffff
409 #ifdef KERNEL_PRIVATE
411 * Protects nd_ifinfo[]
413 __private_extern__ lck_rw_t
*nd_if_rwlock
;
415 #define ND_IFINFO(ifp) \
416 ((ifp)->if_index < nd_ifinfo_indexlim ? &nd_ifinfo[(ifp)->if_index] : NULL)
419 * In a more readable form, we derive linkmtu based on:
421 * if (ND_IFINFO(ifp)->linkmtu && ND_IFINFO(ifp)->linkmtu < ifp->if_mtu)
422 * linkmtu = ND_IFINFO(ifp)->linkmtu;
423 * else if ((ND_IFINFO(ifp)->maxmtu && ND_IFINFO(ifp)->maxmtu < ifp->if_mtu))
424 * linkmtu = ND_IFINFO(ifp)->maxmtu;
426 * linkmtu = ifp->if_mtu;
428 #define IN6_LINKMTU(ifp) \
429 (ND_IFINFO(ifp) == NULL ? (ifp)->if_mtu : \
430 ((ND_IFINFO(ifp)->linkmtu && \
431 ND_IFINFO(ifp)->linkmtu < (ifp)->if_mtu) ? ND_IFINFO(ifp)->linkmtu : \
432 ((ND_IFINFO(ifp)->maxmtu && ND_IFINFO(ifp)->maxmtu < (ifp)->if_mtu) ? \
433 ND_IFINFO(ifp)->maxmtu : (ifp)->if_mtu)))
436 #define MAX_REACHABLE_TIME 3600000 /* msec */
437 #define REACHABLE_TIME 30000 /* msec */
438 #define RETRANS_TIMER 1000 /* msec */
439 #define MIN_RANDOM_FACTOR 512 /* 1024 * 0.5 */
440 #define MAX_RANDOM_FACTOR 1536 /* 1024 * 1.5 */
441 #define DEF_TEMP_VALID_LIFETIME 604800 /* 1 week */
442 #define DEF_TEMP_PREFERRED_LIFETIME 86400 /* 1 day */
443 #define TEMPADDR_REGEN_ADVANCE 5 /* sec */
444 #define MAX_TEMP_DESYNC_FACTOR 600 /* 10 min */
445 #define ND_COMPUTE_RTIME(x) \
446 (((MIN_RANDOM_FACTOR * (x >> 10)) + (random() & \
447 ((MAX_RANDOM_FACTOR - MIN_RANDOM_FACTOR) * (x >> 10)))) /1000)
449 TAILQ_HEAD(nd_drhead
, nd_defrouter
);
450 struct nd_defrouter
{
451 TAILQ_ENTRY(nd_defrouter
) dr_entry
;
452 struct in6_addr rtaddr
;
453 u_char flags
; /* flags on RA message */
456 u_int32_t advint
; /* Mobile IPv6 addition (milliseconds) */
457 u_int32_t advint_expire
; /* Mobile IPv6 addition */
458 int advints_lost
; /* Mobile IPv6 addition */
463 struct ifnet
*ndpr_ifp
;
464 LIST_ENTRY(nd_prefix
) ndpr_entry
;
465 struct sockaddr_in6 ndpr_prefix
; /* prefix */
466 struct in6_addr ndpr_mask
; /* netmask derived from the prefix */
467 struct in6_addr ndpr_addr
; /* address that is derived from the prefix */
468 u_int32_t ndpr_vltime
; /* advertised valid lifetime */
469 u_int32_t ndpr_pltime
; /* advertised preferred lifetime */
470 time_t ndpr_expire
; /* expiration time of the prefix */
471 time_t ndpr_preferred
; /* preferred time of the prefix */
472 struct prf_ra ndpr_flags
;
473 u_int32_t ndpr_stateflags
; /* actual state flags */
474 /* list of routers that advertise the prefix: */
475 LIST_HEAD(pr_rtrhead
, nd_pfxrouter
) ndpr_advrtrs
;
477 int ndpr_refcnt
; /* reference counter from addresses */
478 int ndpr_usecnt
; /* actual use count; prevents free */
481 #define ndpr_next ndpr_entry.le_next
483 #define ndpr_raf ndpr_flags
484 #define ndpr_raf_onlink ndpr_flags.onlink
485 #define ndpr_raf_auto ndpr_flags.autonomous
488 * We keep expired prefix for certain amount of time, for validation purposes.
489 * 1800s = MaxRtrAdvInterval
491 #define NDPR_KEEP_EXPIRED (1800 * 2)
494 * Message format for use in obtaining information about prefixes
495 * from inet6 sysctl function
497 struct inet6_ndpr_msghdr
{
498 u_short inpm_msglen
; /* to skip over non-understood messages */
499 u_char inpm_version
; /* future binary compatibility */
500 u_char inpm_type
; /* message type */
501 struct in6_addr inpm_prefix
;
503 u_int32_t prm_pltime
;
504 u_int32_t prm_expire
;
505 u_int32_t prm_preferred
;
506 struct in6_prflags prm_flags
;
507 u_short prm_index
; /* index for associated ifp */
508 u_char prm_plen
; /* length of prefix in bits */
511 #define prm_raf_onlink prm_flags.prf_ra.onlink
512 #define prm_raf_auto prm_flags.prf_ra.autonomous
514 #define prm_statef_onlink prm_flags.prf_state.onlink
516 #define prm_rrf_decrvalid prm_flags.prf_rr.decrvalid
517 #define prm_rrf_decrprefd prm_flags.prf_rr.decrprefd
519 #define ifpr2ndpr(ifpr) ((struct nd_prefix *)(ifpr))
520 #define ndpr2ifpr(ndpr) ((struct ifprefix *)(ndpr))
522 struct nd_pfxrouter
{
523 LIST_ENTRY(nd_pfxrouter
) pfr_entry
;
524 #define pfr_next pfr_entry.le_next
525 struct nd_defrouter
*router
;
528 LIST_HEAD(nd_prhead
, nd_prefix
);
531 extern int nd6_prune
;
532 extern int nd6_delay
;
533 extern int nd6_umaxtries
;
534 extern int nd6_mmaxtries
;
535 extern int nd6_useloopback
;
536 extern int nd6_maxnudhint
;
537 extern int nd6_gctimer
;
538 extern struct llinfo_nd6 llinfo_nd6
;
539 extern struct nd_ifinfo
*nd_ifinfo
;
540 extern struct nd_drhead nd_defrouter
;
541 extern struct nd_prhead nd_prefix
;
542 extern int nd6_debug
;
543 extern size_t nd_ifinfo_indexlim
;
545 #define nd6log(x) do { if (nd6_debug) log x; } while (0)
547 extern struct callout nd6_timer_ch
;
550 extern int nd6_defifindex
;
551 extern int ip6_desync_factor
; /* seconds */
552 extern u_int32_t ip6_temp_preferred_lifetime
; /* seconds */
553 extern u_int32_t ip6_temp_valid_lifetime
; /* seconds */
554 extern int ip6_temp_regen_advance
; /* seconds */
557 struct nd_opt_hdr
*nd_opt_array
[9]; /*max = home agent info*/
559 struct nd_opt_hdr
*zero
;
560 struct nd_opt_hdr
*src_lladdr
;
561 struct nd_opt_hdr
*tgt_lladdr
;
562 struct nd_opt_prefix_info
*pi_beg
; /* multiple opts, start */
563 struct nd_opt_rd_hdr
*rh
;
564 struct nd_opt_mtu
*mtu
;
565 struct nd_opt_hdr
*six
;
566 struct nd_opt_advint
*adv
;
567 struct nd_opt_hai
*hai
;
568 struct nd_opt_hdr
*search
; /* multiple opts */
569 struct nd_opt_hdr
*last
; /* multiple opts */
571 struct nd_opt_prefix_info
*pi_end
;/* multiple opts, end */
574 #define nd_opts_src_lladdr nd_opt_each.src_lladdr
575 #define nd_opts_tgt_lladdr nd_opt_each.tgt_lladdr
576 #define nd_opts_pi nd_opt_each.pi_beg
577 #define nd_opts_pi_end nd_opt_each.pi_end
578 #define nd_opts_rh nd_opt_each.rh
579 #define nd_opts_mtu nd_opt_each.mtu
580 #define nd_opts_adv nd_opt_each.adv
581 #define nd_opts_hai nd_opt_each.hai
582 #define nd_opts_search nd_opt_each.search
583 #define nd_opts_last nd_opt_each.last
584 #define nd_opts_done nd_opt_each.done
586 /* XXX: need nd6_var.h?? */
588 extern void nd6_init(void);
589 extern int nd6_ifattach(struct ifnet
*);
590 extern int nd6_is_addr_neighbor(struct sockaddr_in6
*, struct ifnet
*, int);
591 extern void nd6_option_init(void *, int, union nd_opts
*);
592 extern struct nd_opt_hdr
*nd6_option(union nd_opts
*);
593 extern int nd6_options(union nd_opts
*);
594 extern struct rtentry
*nd6_lookup(struct in6_addr
*, int, struct ifnet
*, int);
595 extern void nd6_setmtu(struct ifnet
*);
596 extern void nd6_timer(void *);
597 extern void nd6_purge(struct ifnet
*);
598 extern void nd6_free(struct rtentry
*);
599 extern void nd6_nud_hint(struct rtentry
*, struct in6_addr
*, int);
600 extern int nd6_resolve(struct ifnet
*, struct rtentry
*,
601 struct mbuf
*, struct sockaddr
*, u_char
*);
602 extern void nd6_rtrequest(int, struct rtentry
*, struct sockaddr
*);
603 extern int nd6_ioctl(u_long
, caddr_t
, struct ifnet
*);
604 extern void nd6_cache_lladdr(struct ifnet
*, struct in6_addr
*,
605 char *, int, int, int);
606 extern int nd6_output(struct ifnet
*, struct ifnet
*, struct mbuf
*,
607 struct sockaddr_in6
*, struct rtentry
*, int);
608 extern int nd6_storelladdr(struct ifnet
*, struct rtentry
*, struct mbuf
*,
609 struct sockaddr
*, u_char
*);
610 extern int nd6_need_cache(struct ifnet
*);
611 extern void nd6_drain(void *);
614 extern void nd6_na_input(struct mbuf
*, int, int);
615 extern void nd6_na_output(struct ifnet
*, const struct in6_addr
*,
616 const struct in6_addr
*, u_int32_t
, int, struct sockaddr
*);
617 extern void nd6_ns_input(struct mbuf
*, int, int);
618 extern void nd6_ns_output(struct ifnet
*, const struct in6_addr
*,
619 const struct in6_addr
*, struct llinfo_nd6
*, int, int);
620 extern caddr_t
nd6_ifptomac(struct ifnet
*);
621 extern void nd6_dad_start(struct ifaddr
*, int *);
622 extern void nd6_dad_stop(struct ifaddr
*);
623 extern void nd6_dad_duplicated(struct ifaddr
*);
626 extern void nd6_rs_input(struct mbuf
*, int, int);
627 extern void nd6_ra_input(struct mbuf
*, int, int);
628 extern void prelist_del(struct nd_prefix
*);
629 extern void defrouter_addreq(struct nd_defrouter
*);
630 extern void defrouter_delreq(struct nd_defrouter
*, int);
631 extern void defrouter_select(void);
632 extern void defrtrlist_del(struct nd_defrouter
*, int);
633 extern void prelist_remove(struct nd_prefix
*, int);
634 extern int prelist_update(struct nd_prefix
*, struct nd_defrouter
*,
636 extern int nd6_prelist_add(struct nd_prefix
*, struct nd_defrouter
*,
637 struct nd_prefix
**);
638 extern int nd6_prefix_onlink(struct nd_prefix
*, int, int);
639 extern int nd6_prefix_offlink(struct nd_prefix
*);
640 extern void pfxlist_onlink_check(int);
641 extern struct nd_defrouter
*defrouter_lookup(struct in6_addr
*, struct ifnet
*);
642 extern struct nd_prefix
*nd6_prefix_lookup(struct nd_prefix
*);
643 extern int in6_init_prefix_ltimes(struct nd_prefix
*ndpr
);
644 extern void rt6_flush(struct in6_addr
*, struct ifnet
*);
645 extern int nd6_setdefaultiface(int);
646 extern int in6_tmpifadd(const struct in6_ifaddr
*, int, int);
647 extern void ndpr_hold(struct nd_prefix
*, boolean_t
);
648 extern void ndpr_rele(struct nd_prefix
*, boolean_t
);
649 #endif /* KERNEL_PRIVATE */
654 @function nd6_lookup_ipv6
655 @discussion This function will check the routing table for a cached
656 neighbor discovery entry or trigger an neighbor discovery query
657 to resolve the IPv6 address to a link-layer address.
659 nd entries are stored in the routing table. This function will
660 lookup the IPv6 destination in the routing table. If the
661 destination requires forwarding to a gateway, the route of the
662 gateway will be looked up. The route entry is inspected to
663 determine if the link layer destination address is known. If
664 unknown, neighbor discovery will be used to resolve the entry.
665 @param interface The interface the packet is being sent on.
666 @param ip6_dest The IPv6 destination of the packet.
667 @param ll_dest On output, the link-layer destination.
668 @param ll_dest_len The length of the buffer for ll_dest.
669 @param hint Any routing hint passed down from the protocol.
670 @param packet The packet being transmitted.
671 @result May return an error such as EHOSTDOWN or ENETUNREACH. If
672 this function returns EJUSTRETURN, the packet has been queued
673 and will be sent when the address is resolved. If any other
674 value is returned, the caller is responsible for disposing of
677 extern errno_t
nd6_lookup_ipv6(ifnet_t interface
,
678 const struct sockaddr_in6
*ip6_dest
, struct sockaddr_dl
*ll_dest
,
679 size_t ll_dest_len
, route_t hint
, mbuf_t packet
);
682 #endif /* _NETINET6_ND6_H_ */