35#ifndef _NETINET6_ND6_H_
36#define _NETINET6_ND6_H_
40#define RTF_ANNOUNCE RTF_PROTO2
44#include <sys/callout.h>
48#define ND6_LLINFO_NOSTATE -2
57#define ND6_LLINFO_INCOMPLETE 0
58#define ND6_LLINFO_REACHABLE 1
59#define ND6_LLINFO_STALE 2
60#define ND6_LLINFO_DELAY 3
61#define ND6_LLINFO_PROBE 4
63#define ND6_IS_LLINFO_PROBREACH(n) ((n)->ln_state > ND6_LLINFO_INCOMPLETE)
64#define ND6_LLINFO_PERMANENT(n) (((n)->la_expire == 0) && ((n)->ln_state > ND6_LLINFO_INCOMPLETE))
82#define ND6_IFF_PERFORMNUD 0x1
83#define ND6_IFF_ACCEPT_RTADV 0x2
84#define ND6_IFF_PREFER_SOURCE 0x4
85#define ND6_IFF_IFDISABLED 0x8
88#define ND6_IFF_DONT_SET_IFROUTE 0x10
89#define ND6_IFF_AUTO_LINKLOCAL 0x20
90#define ND6_IFF_NO_RADR 0x40
91#define ND6_IFF_NO_PREFER_IFACE 0x80
92#define ND6_IFF_NO_DAD 0x100
95#define ND6_IFF_IPV6_ONLY 0x200
96#define ND6_IFF_IPV6_ONLY_MANUAL 0x400
97#define ND6_IFF_IPV6_ONLY_MASK (ND6_IFF_IPV6_ONLY|ND6_IFF_IPV6_ONLY_MANUAL)
101#define ND_IFINFO(ifp) \
102 (((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->nd_ifinfo)
103#define IN6_LINKMTU(ifp) \
104 ((ND_IFINFO(ifp)->linkmtu && ND_IFINFO(ifp)->linkmtu < (ifp)->if_mtu) \
105 ? ND_IFINFO(ifp)->linkmtu \
106 : ((ND_IFINFO(ifp)->maxmtu && ND_IFINFO(ifp)->maxmtu < (ifp)->if_mtu) \
107 ? ND_IFINFO(ifp)->maxmtu : (ifp)->if_mtu))
171#define NDPRF_ONLINK 0x1
172#define NDPRF_DETACHED 0x2
175#define MAX_RTR_SOLICITATION_DELAY 1
176#define RTR_SOLICITATION_INTERVAL 4
177#define MAX_RTR_SOLICITATIONS 3
179#define ND6_INFINITE_LIFETIME 0xffffffff
183#define MAX_REACHABLE_TIME 3600000
184#define REACHABLE_TIME 30000
185#define RETRANS_TIMER 1000
186#define MIN_RANDOM_FACTOR 512
187#define MAX_RANDOM_FACTOR 1536
188#define DEF_TEMP_VALID_LIFETIME 604800
189#define DEF_TEMP_PREFERRED_LIFETIME 86400
190#define TEMPADDR_REGEN_ADVANCE 5
191#define MAX_TEMP_DESYNC_FACTOR 600
192#define ND_COMPUTE_RTIME(x) \
193 (((MIN_RANDOM_FACTOR * (x >> 10)) + (arc4random() & \
194 ((MAX_RANDOM_FACTOR - MIN_RANDOM_FACTOR) * (x >> 10)))) /1000)
243#define ndpr_raf ndpr_flags
244#define ndpr_raf_onlink ndpr_flags.onlink
245#define ndpr_raf_auto ndpr_flags.autonomous
246#define ndpr_raf_router ndpr_flags.router
268#define V_nd6_prune VNET(nd6_prune)
269#define V_nd6_delay VNET(nd6_delay)
270#define V_nd6_umaxtries VNET(nd6_umaxtries)
271#define V_nd6_mmaxtries VNET(nd6_mmaxtries)
272#define V_nd6_useloopback VNET(nd6_useloopback)
273#define V_nd6_maxnudhint VNET(nd6_maxnudhint)
274#define V_nd6_gctimer VNET(nd6_gctimer)
275#define V_nd_prefix VNET(nd_prefix)
276#define V_nd6_debug VNET(nd6_debug)
277#define V_nd6_onlink_ns_rfc4861 VNET(nd6_onlink_ns_rfc4861)
282#define V_nd6_lock VNET(nd6_lock)
283#define V_nd6_list_genid VNET(nd6_list_genid)
285#define ND6_RLOCK() rw_rlock(&V_nd6_lock)
286#define ND6_RUNLOCK() rw_runlock(&V_nd6_lock)
287#define ND6_WLOCK() rw_wlock(&V_nd6_lock)
288#define ND6_WUNLOCK() rw_wunlock(&V_nd6_lock)
289#define ND6_TRY_UPGRADE() rw_try_upgrade(&V_nd6_lock)
290#define ND6_WLOCK_ASSERT() rw_assert(&V_nd6_lock, RA_WLOCKED)
291#define ND6_RLOCK_ASSERT() rw_assert(&V_nd6_lock, RA_RLOCKED)
292#define ND6_LOCK_ASSERT() rw_assert(&V_nd6_lock, RA_LOCKED)
293#define ND6_UNLOCK_ASSERT() rw_assert(&V_nd6_lock, RA_UNLOCKED)
297#define V_nd6_onlink_mtx VNET(nd6_onlink_mtx)
299#define ND6_ONLINK_LOCK() mtx_lock(&V_nd6_onlink_mtx)
300#define ND6_ONLINK_TRYLOCK() mtx_trylock(&V_nd6_onlink_mtx)
301#define ND6_ONLINK_UNLOCK() mtx_unlock(&V_nd6_onlink_mtx)
302#define ND6_ONLINK_LOCK_ASSERT() mtx_assert(&V_nd6_onlink_mtx, MA_OWNED)
303#define ND6_ONLINK_UNLOCK_ASSERT() mtx_assert(&V_nd6_onlink_mtx, MA_NOTOWNED)
305#define nd6log(x) do { if (V_nd6_debug) log x; } while ( 0)
313#define V_nd6_defifindex VNET(nd6_defifindex)
314#define V_ip6_desync_factor VNET(ip6_desync_factor)
315#define V_ip6_temp_preferred_lifetime VNET(ip6_temp_preferred_lifetime)
316#define V_ip6_temp_valid_lifetime VNET(ip6_temp_valid_lifetime)
317#define V_ip6_temp_regen_advance VNET(ip6_temp_regen_advance)
326 struct nd_opt_rd_hdr *
rh;
341 struct nd_opt_prefix_info *
pi_end;
344#define nd_opts_src_lladdr nd_opt_each.src_lladdr
345#define nd_opts_tgt_lladdr nd_opt_each.tgt_lladdr
346#define nd_opts_pi nd_opt_each.pi_beg
347#define nd_opts_pi_end nd_opt_each.pi_end
348#define nd_opts_rh nd_opt_each.rh
349#define nd_opts_mtu nd_opt_each.mtu
350#define nd_opts_nonce nd_opt_each.nonce
351#define nd_opts_search nd_opt_each.search
352#define nd_opts_last nd_opt_each.last
353#define nd_opts_done nd_opt_each.done
359void nd6_destroy(
void);
372int nd6_resolve_addr(
struct ifnet *ifp,
int flags,
const struct sockaddr *dst,
373 char *desten, uint32_t *pflags);
375 const struct sockaddr *, u_char *, uint32_t *,
struct llentry **);
376int nd6_ioctl(u_long, caddr_t,
struct ifnet *);
378 char *,
int,
int,
int);
396 const struct in6_addr *, u_long,
int,
struct sockaddr *);
MALLOC_DECLARE(M_IP6MADDR)
struct nd_ifinfo * nd6_ifattach(struct ifnet *)
void defrouter_rele(struct nd_defrouter *)
void defrouter_select_fib(int fibnum)
int nd6_setdefaultiface(int)
void nd6_rem_ifa_lle(struct in6_ifaddr *, int)
int nd6_is_addr_neighbor(const struct sockaddr_in6 *, struct ifnet *)
VNET_DECLARE(int, nd6_prune)
void pfxlist_onlink_check(void)
void nd6_ra_input(struct mbuf *, int, int)
void nd6_ns_output(struct ifnet *, const struct in6_addr *, const struct in6_addr *, const struct in6_addr *, uint8_t *)
int nd6_resolve(struct ifnet *, int, struct mbuf *, const struct sockaddr *, u_char *, uint32_t *, struct llentry **)
void nd6_dad_start(struct ifaddr *, int)
void nd6_option_init(void *, int, union nd_opts *)
void nd6_setmtu(struct ifnet *)
void nd6_prefix_ref(struct nd_prefix *)
void nd6_subscription_cb(struct rib_head *rnh, struct rib_cmd_info *rc, void *arg)
int nd6_prelist_add(struct nd_prefixctl *, struct nd_defrouter *, struct nd_prefix **)
void nd6_dad_stop(struct ifaddr *)
void nd6_prefix_unlink(struct nd_prefix *, struct nd_prhead *)
LIST_HEAD(nd_prhead, nd_prefix)
void nd6_defrouter_init(void)
void nd6_prefix_rele(struct nd_prefix *)
void nd6_purge(struct ifnet *)
void rt6_flush(struct in6_addr *, struct ifnet *)
void nd6_na_output(struct ifnet *, const struct in6_addr *, const struct in6_addr *, u_long, int, struct sockaddr *)
void nd6_rs_input(struct mbuf *, int, int)
void nd6_defrouter_flush_all(void)
int nd6_ioctl(u_long, caddr_t, struct ifnet *)
void nd6_flush_children_holdchain(struct ifnet *, struct llentry *)
int nd6_add_ifa_lle(struct in6_ifaddr *)
struct mbuf * nd6_grab_holdchain(struct llentry *)
void defrouter_reset(void)
struct nd_opt_hdr * nd6_option(union nd_opts *)
struct nd_prefix * nd6_prefix_lookup(struct nd_prefixctl *)
void nd6_cache_lladdr(struct ifnet *, struct in6_addr *, char *, int, int, int)
struct llentry * nd6_lookup(const struct in6_addr *, int, struct ifnet *)
void nd6_llinfo_setstate(struct llentry *lle, int newstate)
bool defrouter_remove(struct in6_addr *, struct ifnet *)
void nd6_ifdetach(struct ifnet *, struct nd_ifinfo *)
struct nd_defrouter * defrouter_lookup(const struct in6_addr *, struct ifnet *)
void nd6_defrouter_timer(void)
bool nd6_try_set_entry_addr(struct ifnet *ifp, struct llentry *lle, char *lladdr)
caddr_t nd6_ifptomac(struct ifnet *)
void nd6_ifnet_link_event(void *, struct ifnet *, int)
int nd6_output_ifp(struct ifnet *, struct ifnet *, struct mbuf *, struct sockaddr_in6 *, struct route *)
struct nd_defrouter * defrouter_lookup_locked(const struct in6_addr *, struct ifnet *)
int nd6_resolve_addr(struct ifnet *ifp, int flags, const struct sockaddr *dst, char *desten, uint32_t *pflags)
void nd6_prefix_del(struct nd_prefix *)
int nd6_options(union nd_opts *)
void nd6_defrouter_purge(struct ifnet *)
bool nd6_defrouter_list_empty(void)
int in6_tmpifadd(const struct in6_ifaddr *, int, int)
int nd6_flush_holdchain(struct ifnet *, struct llentry *, struct mbuf *)
void nd6_ns_input(struct mbuf *, int, int)
int nd6_prefix_offlink(struct nd_prefix *)
void nd6_na_input(struct mbuf *, int, int)
struct sockaddr_in6 rtaddr
struct in6_ondireq::@7 ndi
struct sockaddr_in6 prefix
TAILQ_ENTRY(nd_defrouter) dr_entry
LIST_ENTRY(nd_pfxrouter) pfr_entry
struct nd_defrouter * router
LIST_HEAD(pr_rtrhead, nd_pfxrouter) ndpr_advrtrs
u_int32_t ndpr_stateflags
volatile u_int ndpr_refcnt
struct sockaddr_in6 ndpr_prefix
struct in6_addr ndpr_mask
LIST_ENTRY(nd_prefix) ndpr_entry
struct sockaddr_in6 ndpr_prefix
struct nd_opt_prefix_info * pi_beg
struct nd_opt_hdr * __res6
struct nd_opt_hdr * __res13
struct nd_opt_hdr * search
struct nd_opt_hdr * __res11
struct nd_opt_nonce * nonce
struct nd_opt_hdr * src_lladdr
struct nd_opt_hdr * nd_opt_array[16]
struct nd_opt_prefix_info * pi_end
struct nd_opts::@8 nd_opt_each
struct nd_opt_hdr * tgt_lladdr
struct nd_opt_rd_hdr * rh
struct nd_opt_hdr * __res8
struct nd_opt_hdr * __res10
struct nd_opt_hdr * __res7
struct nd_opt_hdr * __res15
struct nd_opt_hdr * __res9
struct nd_opt_hdr * __res12