#ifndef _NETINET6_ND6_H_
#define _NETINET6_ND6_H_
#include <sys/appleapiopts.h>
#include <net/net_kev.h>
#ifndef RTF_ANNOUNCE
#define RTF_ANNOUNCE RTF_PROTO2
#endif
#include <sys/queue.h>
#ifdef BSD_KERNEL_PRIVATE
#include <net/flowadv.h>
#include <kern/locks.h>
#include <sys/tree.h>
#include <sys/eventhandler.h>
#include <netinet6/nd6_var.h>
struct llinfo_nd6 {
struct llinfo_nd6 *ln_next;
struct llinfo_nd6 *ln_prev;
struct rtentry *ln_rt;
struct ifnet *ln_exclifp;
struct mbuf *ln_hold;
uint32_t ln_asked;
short ln_state;
short ln_router;
u_int32_t ln_flags;
u_int64_t ln_expire;
u_int64_t ln_lastused;
struct if_llreach *ln_llreach;
};
#define ND6_LNF_TIMER_SKIP 0x1
#define ND6_LNF_IN_USE 0x2
#endif
#define ND6_LLINFO_PURGE -3
#define ND6_LLINFO_NOSTATE -2
#define ND6_LLINFO_INCOMPLETE 0
#define ND6_LLINFO_REACHABLE 1
#define ND6_LLINFO_STALE 2
#define ND6_LLINFO_DELAY 3
#define ND6_LLINFO_PROBE 4
#ifdef BSD_KERNEL_PRIVATE
#define ND6_CACHE_STATE_TRANSITION(ln, nstate) do {\
struct rtentry *ln_rt = (ln)->ln_rt; \
if (nd6_debug >= 1) {\
nd6log((LOG_INFO,\
"[%s:%d]: NDP cache entry changed from %s -> %s",\
__func__,\
__LINE__,\
ndcache_state2str((ln)->ln_state),\
ndcache_state2str(nstate)));\
if (ln_rt != NULL)\
nd6log((LOG_INFO,\
" for address: %s.\n",\
ip6_sprintf(&SIN6(rt_key(ln_rt))->sin6_addr)));\
else\
nd6log((LOG_INFO, "\n"));\
}\
(ln)->ln_state = nstate;\
} while(0)
#define ND6_IS_LLINFO_PROBREACH(n) ((n)->ln_state > ND6_LLINFO_INCOMPLETE)
#define ND6_LLINFO_PERMANENT(n) \
(((n)->ln_expire == 0) && ((n)->ln_state > ND6_LLINFO_INCOMPLETE))
#define ND6_EUI64_GBIT 0x01
#define ND6_EUI64_UBIT 0x02
#define ND6_EUI64_TO_IFID(in6) \
do {(in6)->s6_addr[8] ^= ND6_EUI64_UBIT; } while (0)
#define ND6_EUI64_GROUP(in6) ((in6)->s6_addr[8] & ND6_EUI64_GBIT)
#define ND6_EUI64_INDIVIDUAL(in6) (!ND6_EUI64_GROUP(in6))
#define ND6_EUI64_LOCAL(in6) ((in6)->s6_addr[8] & ND6_EUI64_UBIT)
#define ND6_EUI64_UNIVERSAL(in6) (!ND6_EUI64_LOCAL(in6))
#define ND6_IFID_LOCAL(in6) (!ND6_EUI64_LOCAL(in6))
#define ND6_IFID_UNIVERSAL(in6) (!ND6_EUI64_UNIVERSAL(in6))
#endif
#if !defined(BSD_KERNEL_PRIVATE)
struct nd_ifinfo {
#else
struct nd_ifinfo_compat {
#endif
u_int32_t linkmtu;
u_int32_t maxmtu;
u_int32_t basereachable;
u_int32_t reachable;
u_int32_t retrans;
u_int32_t flags;
int recalctm;
u_int8_t chlim;
u_int8_t receivedra;
u_int8_t randomseed0[8];
u_int8_t randomseed1[8];
u_int8_t randomid[8];
};
#define ND6_IFF_PERFORMNUD 0x1
#if defined(PRIVATE)
#define ND6_IFF_ACCEPT_RTADV 0x2
#define ND6_IFF_PREFER_SOURCE 0x4
#define ND6_IFF_IFDISABLED 0x8
#define ND6_IFF_DONT_SET_IFROUTE 0x10
#endif
#define ND6_IFF_PROXY_PREFIXES 0x20
#define ND6_IFF_IGNORE_NA 0x40
#if defined(PRIVATE)
#define ND6_IFF_INSECURE 0x80
#endif
#define ND6_IFF_REPLICATED 0x100
#define ND6_IFF_DAD 0x200
struct in6_nbrinfo {
char ifname[IFNAMSIZ];
struct in6_addr addr;
long asked;
int isrouter;
int state;
int expire;
};
#if defined(BSD_KERNEL_PRIVATE)
struct in6_nbrinfo_32 {
char ifname[IFNAMSIZ];
struct in6_addr addr;
u_int32_t asked;
int isrouter;
int state;
int expire;
};
struct in6_nbrinfo_64 {
char ifname[IFNAMSIZ];
struct in6_addr addr;
long asked;
int isrouter __attribute__((aligned(8)));
int state;
int expire;
} __attribute__((aligned(8)));
#endif
#define DRLSTSIZ 10
#define PRLSTSIZ 10
struct in6_drlist {
char ifname[IFNAMSIZ];
struct {
struct in6_addr rtaddr;
u_char flags;
u_short rtlifetime;
u_long expire;
u_short if_index;
} defrouter[DRLSTSIZ];
};
#if defined(BSD_KERNEL_PRIVATE)
struct in6_drlist_32 {
char ifname[IFNAMSIZ];
struct {
struct in6_addr rtaddr;
u_char flags;
u_short rtlifetime;
u_int32_t expire;
u_short if_index;
} defrouter[DRLSTSIZ];
};
struct in6_drlist_64 {
char ifname[IFNAMSIZ];
struct {
struct in6_addr rtaddr;
u_char flags;
u_short rtlifetime;
u_long expire __attribute__((aligned(8)));
u_short if_index __attribute__((aligned(8)));
} defrouter[DRLSTSIZ] __attribute__((aligned(8)));
};
#endif
#define NDDRF_INSTALLED 0x1
#define NDDRF_IFSCOPE 0x2
#define NDDRF_STATIC 0x4
#define NDDRF_MAPPED 0x8
struct in6_defrouter {
struct sockaddr_in6 rtaddr;
u_char flags;
u_char stateflags;
u_short rtlifetime;
u_long expire;
u_short if_index;
};
#if defined(BSD_KERNEL_PRIVATE)
struct in6_defrouter_32 {
struct sockaddr_in6 rtaddr;
u_char flags;
u_char stateflags;
u_short rtlifetime;
u_int32_t expire;
u_short if_index;
};
struct in6_defrouter_64 {
struct sockaddr_in6 rtaddr;
u_char flags;
u_char stateflags;
u_short rtlifetime;
u_long expire __attribute__((aligned(8)));
u_short if_index __attribute__((aligned(8)));
} __attribute__((aligned(8)));
#endif
struct in6_prlist {
char ifname[IFNAMSIZ];
struct {
struct in6_addr prefix;
struct prf_ra raflags;
u_char prefixlen;
u_char origin;
u_long vltime;
u_long pltime;
u_long expire;
u_short if_index;
u_short advrtrs;
struct in6_addr advrtr[DRLSTSIZ];
} prefix[PRLSTSIZ];
};
#if defined(BSD_KERNEL_PRIVATE)
struct in6_prlist_32 {
char ifname[IFNAMSIZ];
struct {
struct in6_addr prefix;
struct prf_ra raflags;
u_char prefixlen;
u_char origin;
u_int32_t vltime;
u_int32_t pltime;
u_int32_t expire;
u_short if_index;
u_short advrtrs;
struct in6_addr advrtr[DRLSTSIZ];
} prefix[PRLSTSIZ];
};
struct in6_prlist_64 {
char ifname[IFNAMSIZ];
struct {
struct in6_addr prefix;
struct prf_ra raflags;
u_char prefixlen;
u_char origin;
u_long vltime __attribute__((aligned(8)));
u_long pltime __attribute__((aligned(8)));
u_long expire __attribute__((aligned(8)));
u_short if_index;
u_short advrtrs;
u_int32_t pad;
struct in6_addr advrtr[DRLSTSIZ];
} prefix[PRLSTSIZ];
};
#endif
struct in6_prefix {
struct sockaddr_in6 prefix;
struct prf_ra raflags;
u_char prefixlen;
u_char origin;
u_long vltime;
u_long pltime;
u_long expire;
u_int32_t flags;
int refcnt;
u_short if_index;
u_short advrtrs;
};
#if defined(BSD_KERNEL_PRIVATE)
struct in6_prefix_32 {
struct sockaddr_in6 prefix;
struct prf_ra raflags;
u_char prefixlen;
u_char origin;
u_int32_t vltime;
u_int32_t pltime;
u_int32_t expire;
u_int32_t flags;
int refcnt;
u_short if_index;
u_short advrtrs;
};
struct in6_prefix_64 {
struct sockaddr_in6 prefix;
struct prf_ra raflags;
u_char prefixlen;
u_char origin;
u_long vltime __attribute__((aligned(8)));
u_long pltime __attribute__((aligned(8)));
u_long expire __attribute__((aligned(8)));
u_int32_t flags __attribute__((aligned(8)));
int refcnt;
u_short if_index;
u_short advrtrs;
};
#endif
struct in6_ondireq {
char ifname[IFNAMSIZ];
struct {
u_int32_t linkmtu;
u_int32_t maxmtu;
u_int32_t basereachable;
u_int32_t reachable;
u_int32_t retrans;
u_int32_t flags;
int recalctm;
u_int8_t chlim;
u_int8_t receivedra;
} ndi;
};
#if !defined(BSD_KERNEL_PRIVATE)
struct in6_ndireq {
char ifname[IFNAMSIZ];
struct nd_ifinfo ndi;
};
#else
struct in6_ndireq {
char ifname[IFNAMSIZ];
struct nd_ifinfo_compat ndi;
};
#endif
struct in6_ndifreq {
char ifname[IFNAMSIZ];
u_long ifindex;
};
#define MAX_RTR_SOLICITATION_DELAY 1
#define RTR_SOLICITATION_INTERVAL 4
#if defined(BSD_KERNEL_PRIVATE)
struct in6_ndifreq_32 {
char ifname[IFNAMSIZ];
u_int32_t ifindex;
};
struct in6_ndifreq_64 {
char ifname[IFNAMSIZ];
u_long ifindex __attribute__((aligned(8)));
};
#endif
#define NDPRF_ONLINK 0x1
#define NDPRF_DETACHED 0x2
#define NDPRF_STATIC 0x100
#define NDPRF_IFSCOPE 0x1000
#define NDPRF_PRPROXY 0x2000
#ifdef BSD_KERNEL_PRIVATE
#define NDPRF_PROCESSED_ONLINK 0x08000
#define NDPRF_PROCESSED_SERVICE 0x10000
#define NDPRF_DEFUNCT 0x20000
#define NDPRF_CLAT46 0x40000
#endif
#define MAX_RTR_SOLICITATION_DELAY 1
#define RTR_SOLICITATION_INTERVAL 4
#define MAX_RTR_SOLICITATIONS 3
#define ND6_INFINITE_LIFETIME 0xffffffff
#define ND6_MAX_LIFETIME 0x7fffffff
#ifdef BSD_KERNEL_PRIVATE
#define ND_IFINFO(ifp) \
((ifp == NULL) ? NULL : \
((IN6_IFEXTRA(ifp) == NULL) ? NULL : \
(&IN6_IFEXTRA(ifp)->nd_ifinfo)))
#define IN6_LINKMTU(ifp) \
(ifp == NULL ? IPV6_MMTU : \
(ND_IFINFO(ifp) == NULL || !ND_IFINFO(ifp)->initialized) ? \
(ifp)->if_mtu : ((ND_IFINFO(ifp)->linkmtu && \
ND_IFINFO(ifp)->linkmtu < (ifp)->if_mtu) ? ND_IFINFO(ifp)->linkmtu : \
((ND_IFINFO(ifp)->maxmtu && ND_IFINFO(ifp)->maxmtu < (ifp)->if_mtu) ? \
ND_IFINFO(ifp)->maxmtu : (ifp)->if_mtu)))
#define MAX_REACHABLE_TIME 3600000
#define REACHABLE_TIME 30000
#define RETRANS_TIMER 1000
#define MIN_RANDOM_FACTOR 512
#define MAX_RANDOM_FACTOR 1536
#define DEF_TEMP_VALID_LIFETIME 604800
#define DEF_TEMP_PREFERRED_LIFETIME 86400
#define TEMPADDR_REGEN_ADVANCE 5
#define MAX_TEMP_DESYNC_FACTOR 600
#define ND_COMPUTE_RTIME(x) \
(((MIN_RANDOM_FACTOR * (x >> 10)) + (RandomULong() & \
((MAX_RANDOM_FACTOR - MIN_RANDOM_FACTOR) * (x >> 10)))) /1000)
#define ND6_PREFIX_EXPIRY_UNSPEC -1
#define ND6_PREFIX_EXPIRY_NEVER 0
TAILQ_HEAD(nd_drhead, nd_defrouter);
struct nd_defrouter {
decl_lck_mtx_data(, nddr_lock);
TAILQ_ENTRY(nd_defrouter) dr_entry;
struct in6_addr rtaddr;
u_int32_t nddr_refcount;
u_int32_t nddr_debug;
u_int64_t expire;
u_int64_t base_calendartime;
u_int64_t base_uptime;
u_char flags;
u_char stateflags;
u_short rtlifetime;
int err;
struct ifnet *ifp;
struct in6_addr rtaddr_mapped;
void (*nddr_trace)(struct nd_defrouter *, int);
};
#define NDDR_LOCK_ASSERT_HELD(_nddr) \
LCK_MTX_ASSERT(&(_nddr)->nddr_lock, LCK_MTX_ASSERT_OWNED)
#define NDDR_LOCK_ASSERT_NOTHELD(_nddr) \
LCK_MTX_ASSERT(&(_nddr)->nddr_lock, LCK_MTX_ASSERT_NOTOWNED)
#define NDDR_LOCK(_nddr) \
lck_mtx_lock(&(_nddr)->nddr_lock)
#define NDDR_LOCK_SPIN(_nddr) \
lck_mtx_lock_spin(&(_nddr)->nddr_lock)
#define NDDR_CONVERT_LOCK(_nddr) do { \
NDPR_LOCK_ASSERT_HELD(_nddr); \
lck_mtx_convert_spin(&(_nddr)->nddr_lock); \
} while (0)
#define NDDR_UNLOCK(_nddr) \
lck_mtx_unlock(&(_nddr)->nddr_lock)
#define NDDR_ADDREF(_nddr) \
nddr_addref(_nddr, 0)
#define NDDR_ADDREF_LOCKED(_nddr) \
nddr_addref(_nddr, 1)
#define NDDR_REMREF(_nddr) do { \
(void) nddr_remref(_nddr, 0); \
} while (0)
#define NDDR_REMREF_LOCKED(_nddr) \
nddr_remref(_nddr, 1)
RB_HEAD(prproxy_sols_tree, nd6_prproxy_soltgt);
struct nd_prefix {
decl_lck_mtx_data(, ndpr_lock);
u_int32_t ndpr_refcount;
u_int32_t ndpr_debug;
struct ifnet *ndpr_ifp;
struct rtentry *ndpr_rt;
LIST_ENTRY(nd_prefix) ndpr_entry;
struct sockaddr_in6 ndpr_prefix;
struct in6_addr ndpr_mask;
struct in6_addr ndpr_addr;
u_int32_t ndpr_vltime;
u_int32_t ndpr_pltime;
u_int64_t ndpr_preferred;
u_int64_t ndpr_expire;
u_int64_t ndpr_lastupdate;
u_int64_t ndpr_base_calendartime;
u_int64_t ndpr_base_uptime;
struct prf_ra ndpr_flags;
unsigned int ndpr_genid;
u_int32_t ndpr_stateflags;
LIST_HEAD(pr_rtrhead, nd_pfxrouter) ndpr_advrtrs;
u_char ndpr_plen;
int ndpr_addrcnt;
u_int32_t ndpr_allmulti_cnt;
u_int32_t ndpr_prproxy_sols_cnt;
struct prproxy_sols_tree ndpr_prproxy_sols;
void (*ndpr_trace)(struct nd_prefix *, int);
};
#define ndpr_next ndpr_entry.le_next
#define ndpr_raf ndpr_flags
#define ndpr_raf_onlink ndpr_flags.onlink
#define ndpr_raf_auto ndpr_flags.autonomous
#define ndpr_raf_router ndpr_flags.router
#define NDPR_KEEP_EXPIRED (1800 * 2)
#define NDPR_LOCK_ASSERT_HELD(_ndpr) \
LCK_MTX_ASSERT(&(_ndpr)->ndpr_lock, LCK_MTX_ASSERT_OWNED)
#define NDPR_LOCK_ASSERT_NOTHELD(_ndpr) \
LCK_MTX_ASSERT(&(_ndpr)->ndpr_lock, LCK_MTX_ASSERT_NOTOWNED)
#define NDPR_LOCK(_ndpr) \
lck_mtx_lock(&(_ndpr)->ndpr_lock)
#define NDPR_LOCK_SPIN(_ndpr) \
lck_mtx_lock_spin(&(_ndpr)->ndpr_lock)
#define NDPR_CONVERT_LOCK(_ndpr) do { \
NDPR_LOCK_ASSERT_HELD(_ndpr); \
lck_mtx_convert_spin(&(_ndpr)->ndpr_lock); \
} while (0)
#define NDPR_UNLOCK(_ndpr) \
lck_mtx_unlock(&(_ndpr)->ndpr_lock)
#define NDPR_ADDREF(_ndpr) \
ndpr_addref(_ndpr, 0)
#define NDPR_ADDREF_LOCKED(_ndpr) \
ndpr_addref(_ndpr, 1)
#define NDPR_REMREF(_ndpr) do { \
(void) ndpr_remref(_ndpr, 0); \
} while (0)
#define NDPR_REMREF_LOCKED(_ndpr) \
ndpr_remref(_ndpr, 1)
struct inet6_ndpr_msghdr {
u_short inpm_msglen;
u_char inpm_version;
u_char inpm_type;
struct in6_addr inpm_prefix;
u_int32_t prm_vltim;
u_int32_t prm_pltime;
u_int32_t prm_expire;
u_int32_t prm_preferred;
struct in6_prflags prm_flags;
u_short prm_index;
u_char prm_plen;
};
#define prm_raf_onlink prm_flags.prf_ra.onlink
#define prm_raf_auto prm_flags.prf_ra.autonomous
#define prm_statef_onlink prm_flags.prf_state.onlink
#define prm_rrf_decrvalid prm_flags.prf_rr.decrvalid
#define prm_rrf_decrprefd prm_flags.prf_rr.decrprefd
struct nd_pfxrouter {
LIST_ENTRY(nd_pfxrouter) pfr_entry;
#define pfr_next pfr_entry.le_next
struct nd_defrouter *router;
};
LIST_HEAD(nd_prhead, nd_prefix);
struct nd_prefix_list {
struct nd_prefix_list *next;
struct nd_prefix pr;
};
#endif
#if defined(PRIVATE)
struct kev_nd6_ndfailure {
struct net_event_data link_data;
};
struct kev_nd6_ndalive {
struct net_event_data link_data;
};
struct nd6_ra_prefix {
struct sockaddr_in6 prefix;
struct prf_ra raflags;
u_int32_t prefixlen;
u_int32_t origin;
u_int64_t vltime;
u_int64_t pltime;
u_int64_t expire;
u_int32_t flags;
u_int32_t refcnt;
u_int32_t if_index;
u_int32_t pad;
};
#define KEV_ND6_DATA_VALID_MTU (0x1 << 0)
#define KEV_ND6_DATA_VALID_PREFIX (0x1 << 1)
struct kev_nd6_ra_data {
u_int32_t mtu;
u_int32_t list_index;
u_int32_t list_length;
u_int32_t flags;
struct nd6_ra_prefix prefix;
u_int32_t pad;
};
struct kev_nd6_event {
struct net_event_data link_data;
struct in6_addr in6_address;
uint32_t val;
};
struct nd6_lookup_ipv6_args {
char ifname[IFNAMSIZ];
struct sockaddr_in6 ip6_dest;
u_int32_t ll_dest_len;
union {
char buffer[256];
struct sockaddr_dl _sdl;
} ll_dest_;
};
#define ll_dest_sdl ll_dest_._sdl
#endif
#if defined(BSD_KERNEL_PRIVATE)
extern int nd6_prune;
extern int nd6_prune_lazy;
extern int nd6_delay;
extern int nd6_umaxtries;
extern int nd6_mmaxtries;
extern int nd6_useloopback;
extern int nd6_accept_6to4;
extern int nd6_maxnudhint;
extern int nd6_gctimer;
extern struct llinfo_nd6 llinfo_nd6;
extern struct nd_drhead nd_defrouter;
extern struct nd_prhead nd_prefix;
extern int nd6_debug;
extern int nd6_onlink_ns_rfc4861;
extern int nd6_optimistic_dad;
#define nd6log0(x) do { log x; } while (0)
#define nd6log(x) do { if (nd6_debug >= 1) log x; } while (0)
#define nd6log2(x) do { if (nd6_debug >= 2) log x; } while (0)
#define ND6_OPTIMISTIC_DAD_LINKLOCAL (1 << 0)
#define ND6_OPTIMISTIC_DAD_AUTOCONF (1 << 1)
#define ND6_OPTIMISTIC_DAD_TEMPORARY (1 << 2)
#define ND6_OPTIMISTIC_DAD_DYNAMIC (1 << 3)
#define ND6_OPTIMISTIC_DAD_SECURED (1 << 4)
#define ND6_OPTIMISTIC_DAD_MANUAL (1 << 5)
extern int nd6_defifindex;
extern int ip6_desync_factor;
extern u_int32_t ip6_temp_preferred_lifetime;
extern u_int32_t ip6_temp_valid_lifetime;
extern int ip6_temp_regen_advance;
union nd_opts {
struct nd_opt_hdr *nd_opt_array[16];
struct {
struct nd_opt_hdr *zero;
struct nd_opt_hdr *src_lladdr;
struct nd_opt_hdr *tgt_lladdr;
struct nd_opt_prefix_info *pi_beg;
struct nd_opt_rd_hdr *rh;
struct nd_opt_mtu *mtu;
struct nd_opt_hdr *__res6;
struct nd_opt_hdr *__res7;
struct nd_opt_hdr *__res8;
struct nd_opt_hdr *__res9;
struct nd_opt_hdr *__res10;
struct nd_opt_hdr *__res11;
struct nd_opt_hdr *__res12;
struct nd_opt_hdr *__res13;
struct nd_opt_nonce *nonce;
struct nd_opt_hdr *__res15;
struct nd_opt_hdr *search;
struct nd_opt_hdr *last;
int done;
struct nd_opt_prefix_info *pi_end;
} nd_opt_each;
};
#define nd_opts_src_lladdr nd_opt_each.src_lladdr
#define nd_opts_tgt_lladdr nd_opt_each.tgt_lladdr
#define nd_opts_pi nd_opt_each.pi_beg
#define nd_opts_pi_end nd_opt_each.pi_end
#define nd_opts_rh nd_opt_each.rh
#define nd_opts_mtu nd_opt_each.mtu
#define nd_opts_nonce nd_opt_each.nonce
#define nd_opts_search nd_opt_each.search
#define nd_opts_last nd_opt_each.last
#define nd_opts_done nd_opt_each.done
extern int nd6_sched_timeout_want;
extern void nd6_sched_timeout(struct timeval *, struct timeval *);
extern void nd6_init(void);
extern void nd6_ifreset(struct ifnet *ifp);
extern void nd6_ifattach(struct ifnet *);
extern int nd6_is_addr_neighbor(struct sockaddr_in6 *, struct ifnet *, int);
extern void nd6_option_init(void *, int, union nd_opts *);
extern struct nd_opt_hdr *nd6_option(union nd_opts *);
extern int nd6_options(union nd_opts *);
extern struct rtentry *nd6_lookup(struct in6_addr *, int, struct ifnet *, int);
extern void nd6_setmtu(struct ifnet *);
extern void nd6_purge(struct ifnet *);
extern void nd6_free(struct rtentry *);
extern void nd6_nud_hint(struct rtentry *, struct in6_addr *, int);
extern int nd6_resolve(struct ifnet *, struct rtentry *,
struct mbuf *, struct sockaddr *, u_char *);
extern void nd6_rtrequest(int, struct rtentry *, struct sockaddr *);
extern int nd6_ioctl(u_long, caddr_t, struct ifnet *);
extern void nd6_cache_lladdr(struct ifnet *, struct in6_addr *,
char *, int, int, int);
extern int nd6_output_list(struct ifnet *, struct ifnet *, struct mbuf *,
struct sockaddr_in6 *, struct rtentry *, struct flowadv *);
extern int nd6_output(struct ifnet *, struct ifnet *, struct mbuf *,
struct sockaddr_in6 *, struct rtentry *, struct flowadv *);
extern int nd6_storelladdr(struct ifnet *, struct rtentry *, struct mbuf *,
struct sockaddr *, u_char *);
extern int nd6_need_cache(struct ifnet *);
extern void nd6_drain(void *);
extern void nd6_post_msg(u_int32_t, struct nd_prefix_list *, u_int32_t,
u_int32_t);
extern int nd6_setifinfo(struct ifnet *, u_int32_t, u_int32_t);
extern const char *ndcache_state2str(short);
extern void ln_setexpire(struct llinfo_nd6 *, uint64_t);
extern void nd6_nbr_init(void);
extern void nd6_na_input(struct mbuf *, int, int);
extern void nd6_na_output(struct ifnet *, const struct in6_addr *,
const struct in6_addr *, u_int32_t, int, struct sockaddr *);
extern void nd6_ns_input(struct mbuf *, int, int);
extern void nd6_ns_output(struct ifnet *, const struct in6_addr *,
const struct in6_addr *, struct llinfo_nd6 *, uint8_t *);
extern caddr_t nd6_ifptomac(struct ifnet *);
extern void nd6_dad_start(struct ifaddr *, int *);
extern void nd6_dad_stop(struct ifaddr *);
extern void nd6_dad_duplicated(struct ifaddr *);
extern void nd6_llreach_alloc(struct rtentry *, struct ifnet *, void *,
unsigned int, boolean_t);
extern void nd6_llreach_set_reachable(struct ifnet *, void *, unsigned int);
extern void nd6_llreach_use(struct llinfo_nd6 *);
extern void nd6_alt_node_addr_decompose(struct ifnet *, struct sockaddr *,
struct sockaddr_dl *, struct sockaddr_in6 *);
extern void nd6_alt_node_present(struct ifnet *, struct sockaddr_in6 *,
struct sockaddr_dl *, int32_t, int, int);
extern void nd6_alt_node_absent(struct ifnet *, struct sockaddr_in6 *);
extern struct in6_ifaddr *in6_pfx_newpersistaddr(struct nd_prefix *, int,
int *, boolean_t);
extern void nd6_rtr_init(void);
extern void nd6_rs_input(struct mbuf *, int, int);
extern void nd6_ra_input(struct mbuf *, int, int);
extern void prelist_del(struct nd_prefix *);
extern void defrouter_select(struct ifnet *);
extern void defrouter_reset(void);
extern int defrtrlist_ioctl(u_long, caddr_t);
extern void defrtrlist_del(struct nd_defrouter *);
extern int defrtrlist_add_static(struct nd_defrouter *);
extern int defrtrlist_del_static(struct nd_defrouter *);
extern void prelist_remove(struct nd_prefix *);
extern int prelist_update(struct nd_prefix *, struct nd_defrouter *,
struct mbuf *, int);
extern int nd6_prelist_add(struct nd_prefix *, struct nd_defrouter *,
struct nd_prefix **, boolean_t);
extern int nd6_prefix_onlink(struct nd_prefix *);
extern int nd6_prefix_onlink_scoped(struct nd_prefix *, unsigned int);
extern int nd6_prefix_offlink(struct nd_prefix *);
extern void pfxlist_onlink_check(void);
extern struct nd_defrouter *defrouter_lookup(struct in6_addr *, struct ifnet *);
extern struct nd_prefix *nd6_prefix_lookup(struct nd_prefix *, int);
extern int in6_init_prefix_ltimes(struct nd_prefix *ndpr);
extern void rt6_flush(struct in6_addr *, struct ifnet *);
extern int nd6_setdefaultiface(int);
extern int in6_tmpifadd(const struct in6_ifaddr *, int);
extern void nddr_addref(struct nd_defrouter *, int);
extern struct nd_defrouter *nddr_remref(struct nd_defrouter *, int);
extern uint64_t nddr_getexpire(struct nd_defrouter *);
extern void ndpr_addref(struct nd_prefix *, int);
extern struct nd_prefix *ndpr_remref(struct nd_prefix *, int);
extern uint64_t ndpr_getexpire(struct nd_prefix *);
struct ip6_hdr;
extern u_int32_t nd6_prproxy;
extern void nd6_prproxy_init(void);
extern int nd6_if_prproxy(struct ifnet *, boolean_t);
extern void nd6_prproxy_prelist_update(struct nd_prefix *, struct nd_prefix *);
extern boolean_t nd6_prproxy_ifaddr(struct in6_ifaddr *);
extern void nd6_proxy_find_fwdroute(struct ifnet *, struct route_in6 *);
extern boolean_t nd6_prproxy_isours(struct mbuf *, struct ip6_hdr *,
struct route_in6 *, unsigned int);
extern void nd6_prproxy_ns_output(struct ifnet *, struct ifnet *,
struct in6_addr *, struct in6_addr *, struct llinfo_nd6 *);
extern void nd6_prproxy_ns_input(struct ifnet *, struct in6_addr *,
char *, int, struct in6_addr *, struct in6_addr *, uint8_t *nonce);
extern void nd6_prproxy_na_input(struct ifnet *, struct in6_addr *,
struct in6_addr *, struct in6_addr *, int);
extern void nd6_prproxy_sols_reap(struct nd_prefix *);
extern void nd6_prproxy_sols_prune(struct nd_prefix *, u_int32_t);
extern int nd6_if_disable(struct ifnet *, boolean_t);
void in6_ifaddr_set_dadprogress(struct in6_ifaddr *ia);
#endif
#ifdef KERNEL
extern errno_t nd6_lookup_ipv6(ifnet_t interface,
const struct sockaddr_in6 *ip6_dest, struct sockaddr_dl *ll_dest,
size_t ll_dest_len, route_t hint, mbuf_t packet);
#endif
#ifdef BSD_KERNEL_PRIVATE
extern int nd6_send_opstate;
#define ND6_SEND_OPMODE_DISABLED 0
#define ND6_SEND_OPMODE_CGA_QUIET 1
#endif
#endif