1139826Simp/*-
253541Sshin * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
353541Sshin * All rights reserved.
453541Sshin *
553541Sshin * Redistribution and use in source and binary forms, with or without
653541Sshin * modification, are permitted provided that the following conditions
753541Sshin * are met:
853541Sshin * 1. Redistributions of source code must retain the above copyright
953541Sshin *    notice, this list of conditions and the following disclaimer.
1053541Sshin * 2. Redistributions in binary form must reproduce the above copyright
1153541Sshin *    notice, this list of conditions and the following disclaimer in the
1253541Sshin *    documentation and/or other materials provided with the distribution.
1353541Sshin * 3. Neither the name of the project nor the names of its contributors
1453541Sshin *    may be used to endorse or promote products derived from this software
1553541Sshin *    without specific prior written permission.
1653541Sshin *
1753541Sshin * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
1853541Sshin * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1953541Sshin * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2053541Sshin * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
2153541Sshin * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2253541Sshin * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2353541Sshin * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2453541Sshin * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2553541Sshin * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2653541Sshin * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2753541Sshin * SUCH DAMAGE.
28174510Sobrien *
29174510Sobrien *	$KAME: nd6.h,v 1.76 2001/12/18 02:10:31 itojun Exp $
30174510Sobrien * $FreeBSD: releng/10.3/sys/netinet6/nd6.h 285825 2015-07-23 19:58:56Z hrs $
3153541Sshin */
3253541Sshin
3353541Sshin#ifndef _NETINET6_ND6_H_
3462587Sitojun#define _NETINET6_ND6_H_
3553541Sshin
3662587Sitojun/* see net/route.h, or net/if_inarp.h */
3762587Sitojun#ifndef RTF_ANNOUNCE
3862587Sitojun#define RTF_ANNOUNCE	RTF_PROTO2
3962587Sitojun#endif
4062587Sitojun
4153541Sshin#include <sys/queue.h>
4278064Sume#include <sys/callout.h>
4353541Sshin
44186119Sqinglistruct llentry;
45151539Ssuz
4662587Sitojun#define ND6_LLINFO_NOSTATE	-2
4778064Sume/*
4878064Sume * We don't need the WAITDELETE state any more, but we keep the definition
4978064Sume * in a comment line instead of removing it. This is necessary to avoid
5078064Sume * unintentionally reusing the value for another purpose, which might
5178064Sume * affect backward compatibility with old applications.
5278064Sume * (20000711 jinmei@kame.net)
5378064Sume */
5478064Sume/* #define ND6_LLINFO_WAITDELETE	-1 */
5562587Sitojun#define ND6_LLINFO_INCOMPLETE	0
5662587Sitojun#define ND6_LLINFO_REACHABLE	1
5762587Sitojun#define ND6_LLINFO_STALE	2
5862587Sitojun#define ND6_LLINFO_DELAY	3
5962587Sitojun#define ND6_LLINFO_PROBE	4
6053541Sshin
6162587Sitojun#define ND6_IS_LLINFO_PROBREACH(n) ((n)->ln_state > ND6_LLINFO_INCOMPLETE)
62186119Sqingli#define ND6_LLINFO_PERMANENT(n) (((n)->la_expire == 0) && ((n)->ln_state > ND6_LLINFO_INCOMPLETE))
6362587Sitojun
6453541Sshinstruct nd_ifinfo {
6562587Sitojun	u_int32_t linkmtu;		/* LinkMTU */
6662587Sitojun	u_int32_t maxmtu;		/* Upper bound of LinkMTU */
6762587Sitojun	u_int32_t basereachable;	/* BaseReachableTime */
6862587Sitojun	u_int32_t reachable;		/* Reachable Time */
6962587Sitojun	u_int32_t retrans;		/* Retrans Timer */
7062587Sitojun	u_int32_t flags;		/* Flags */
7162587Sitojun	int recalctm;			/* BaseReacable re-calculation timer */
7262587Sitojun	u_int8_t chlim;			/* CurHopLimit */
73121161Sume	u_int8_t initialized; /* Flag to see the entry is initialized */
7495023Ssuz	/* the following 3 members are for privacy extension for addrconf */
7578064Sume	u_int8_t randomseed0[8]; /* upper 64 bits of MD5 digest */
7678064Sume	u_int8_t randomseed1[8]; /* lower 64 bits (usually the EUI64 IFID) */
7778064Sume	u_int8_t randomid[8];	/* current random ID */
7853541Sshin};
7953541Sshin
8062587Sitojun#define ND6_IFF_PERFORMNUD	0x1
81118498Sume#define ND6_IFF_ACCEPT_RTADV	0x2
82238273Shrs#define ND6_IFF_PREFER_SOURCE	0x4 /* Not used in FreeBSD. */
83151474Ssuz#define ND6_IFF_IFDISABLED	0x8 /* IPv6 operation is disabled due to
84151474Ssuz				     * DAD failure.  (XXX: not ND-specific)
85151474Ssuz				     */
86151539Ssuz#define ND6_IFF_DONT_SET_IFROUTE	0x10
87197138Shrs#define ND6_IFF_AUTO_LINKLOCAL	0x20
88222728Shrs#define	ND6_IFF_NO_RADR		0x40
89245230Sume#define ND6_IFF_NO_PREFER_IFACE	0x80 /* XXX: not related to ND. */
90285825Shrs#define ND6_IFF_NO_DAD		0x100
9162587Sitojun
92186119Sqingli#define	ND6_CREATE		LLE_CREATE
93186119Sqingli#define	ND6_EXCLUSIVE		LLE_EXCLUSIVE
94186119Sqingli
95121161Sume#ifdef _KERNEL
96121161Sume#define ND_IFINFO(ifp) \
97121161Sume	(((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->nd_ifinfo)
98121161Sume#define IN6_LINKMTU(ifp) \
99121161Sume	((ND_IFINFO(ifp)->linkmtu && ND_IFINFO(ifp)->linkmtu < (ifp)->if_mtu) \
100121161Sume	    ? ND_IFINFO(ifp)->linkmtu \
101121161Sume	    : ((ND_IFINFO(ifp)->maxmtu && ND_IFINFO(ifp)->maxmtu < (ifp)->if_mtu) \
102121161Sume		? ND_IFINFO(ifp)->maxmtu : (ifp)->if_mtu))
103121161Sume#endif
104121161Sume
10553541Sshinstruct in6_nbrinfo {
10662587Sitojun	char ifname[IFNAMSIZ];	/* if name, e.g. "en0" */
10762587Sitojun	struct in6_addr addr;	/* IPv6 address of the neighbor */
10853541Sshin	long	asked;		/* number of queries already sent for this addr */
10953541Sshin	int	isrouter;	/* if it acts as a router */
11053541Sshin	int	state;		/* reachability state */
11153541Sshin	int	expire;		/* lifetime for NDP state transition */
11253541Sshin};
11353541Sshin
11462587Sitojun#define DRLSTSIZ 10
11562587Sitojun#define PRLSTSIZ 10
11653541Sshinstruct	in6_drlist {
11762587Sitojun	char ifname[IFNAMSIZ];
11853541Sshin	struct {
11953541Sshin		struct	in6_addr rtaddr;
12053541Sshin		u_char	flags;
12153541Sshin		u_short	rtlifetime;
12253541Sshin		u_long	expire;
12362587Sitojun		u_short if_index;
12453541Sshin	} defrouter[DRLSTSIZ];
12553541Sshin};
12653541Sshin
12778064Sumestruct	in6_defrouter {
12878064Sume	struct	sockaddr_in6 rtaddr;
12978064Sume	u_char	flags;
13078064Sume	u_short	rtlifetime;
13178064Sume	u_long	expire;
13278064Sume	u_short if_index;
13381369Ssimokawa};
13478064Sume
135121472Sume#ifdef _KERNEL
136121472Sumestruct	in6_oprlist {
137121472Sume	char ifname[IFNAMSIZ];
138121472Sume	struct {
139121472Sume		struct	in6_addr prefix;
140121472Sume		struct prf_ra raflags;
141121472Sume		u_char	prefixlen;
142121472Sume		u_char	origin;
143121472Sume		u_long vltime;
144121472Sume		u_long pltime;
145121472Sume		u_long expire;
146121472Sume		u_short if_index;
147121472Sume		u_short advrtrs; /* number of advertisement routers */
148121472Sume		struct	in6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */
149121472Sume	} prefix[PRLSTSIZ];
150121472Sume};
151121472Sume#endif
152121472Sume
15353541Sshinstruct	in6_prlist {
15462587Sitojun	char ifname[IFNAMSIZ];
15553541Sshin	struct {
15653541Sshin		struct	in6_addr prefix;
15762587Sitojun		struct prf_ra raflags;
15853541Sshin		u_char	prefixlen;
15962587Sitojun		u_char	origin;
16095023Ssuz		u_int32_t vltime;
16195023Ssuz		u_int32_t pltime;
16295023Ssuz		time_t expire;
16362587Sitojun		u_short if_index;
16462587Sitojun		u_short advrtrs; /* number of advertisement routers */
16553541Sshin		struct	in6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */
16653541Sshin	} prefix[PRLSTSIZ];
16753541Sshin};
16853541Sshin
16978064Sumestruct in6_prefix {
17078064Sume	struct	sockaddr_in6 prefix;
17178064Sume	struct prf_ra raflags;
17278064Sume	u_char	prefixlen;
17378064Sume	u_char	origin;
174121472Sume	u_int32_t vltime;
175121472Sume	u_int32_t pltime;
176121472Sume	time_t expire;
17778064Sume	u_int32_t flags;
17878064Sume	int refcnt;
17978064Sume	u_short if_index;
18078064Sume	u_short advrtrs; /* number of advertisement routers */
18178064Sume	/* struct sockaddr_in6 advrtr[] */
18281369Ssimokawa};
18378064Sume
18478064Sume#ifdef _KERNEL
18578064Sumestruct	in6_ondireq {
18678064Sume	char ifname[IFNAMSIZ];
18778064Sume	struct {
18878064Sume		u_int32_t linkmtu;	/* LinkMTU */
18978064Sume		u_int32_t maxmtu;	/* Upper bound of LinkMTU */
19078064Sume		u_int32_t basereachable; /* BaseReachableTime */
19178064Sume		u_int32_t reachable;	/* Reachable Time */
19278064Sume		u_int32_t retrans;	/* Retrans Timer */
19378064Sume		u_int32_t flags;	/* Flags */
19478064Sume		int recalctm;		/* BaseReacable re-calculation timer */
19578064Sume		u_int8_t chlim;		/* CurHopLimit */
19678064Sume		u_int8_t receivedra;
19778064Sume	} ndi;
19878064Sume};
19978064Sume#endif
20078064Sume
20153541Sshinstruct	in6_ndireq {
20262587Sitojun	char ifname[IFNAMSIZ];
20362587Sitojun	struct nd_ifinfo ndi;
20453541Sshin};
20553541Sshin
20662587Sitojunstruct	in6_ndifreq {
20762587Sitojun	char ifname[IFNAMSIZ];
20862587Sitojun	u_long ifindex;
20962587Sitojun};
21062587Sitojun
21178064Sume/* Prefix status */
21278064Sume#define NDPRF_ONLINK		0x1
21378064Sume#define NDPRF_DETACHED		0x2
21462587Sitojun
21553541Sshin/* protocol constants */
21695023Ssuz#define MAX_RTR_SOLICITATION_DELAY	1	/* 1sec */
21795023Ssuz#define RTR_SOLICITATION_INTERVAL	4	/* 4sec */
21862587Sitojun#define MAX_RTR_SOLICITATIONS		3
21953541Sshin
22062587Sitojun#define ND6_INFINITE_LIFETIME		0xffffffff
22153541Sshin
22253541Sshin#ifdef _KERNEL
22353541Sshin/* node constants */
22462587Sitojun#define MAX_REACHABLE_TIME		3600000	/* msec */
22562587Sitojun#define REACHABLE_TIME			30000	/* msec */
22662587Sitojun#define RETRANS_TIMER			1000	/* msec */
22762587Sitojun#define MIN_RANDOM_FACTOR		512	/* 1024 * 0.5 */
22862587Sitojun#define MAX_RANDOM_FACTOR		1536	/* 1024 * 1.5 */
22978064Sume#define DEF_TEMP_VALID_LIFETIME		604800	/* 1 week */
23078064Sume#define DEF_TEMP_PREFERRED_LIFETIME	86400	/* 1 day */
23178064Sume#define TEMPADDR_REGEN_ADVANCE		5	/* sec */
23278064Sume#define MAX_TEMP_DESYNC_FACTOR		600	/* 10 min */
23362587Sitojun#define ND_COMPUTE_RTIME(x) \
234121807Sume		(((MIN_RANDOM_FACTOR * (x >> 10)) + (arc4random() & \
23553541Sshin		((MAX_RANDOM_FACTOR - MIN_RANDOM_FACTOR) * (x >> 10)))) /1000)
23653541Sshin
23762587SitojunTAILQ_HEAD(nd_drhead, nd_defrouter);
23853541Sshinstruct	nd_defrouter {
23962587Sitojun	TAILQ_ENTRY(nd_defrouter) dr_entry;
24053541Sshin	struct	in6_addr rtaddr;
24195023Ssuz	u_char	flags;		/* flags on RA message */
24253541Sshin	u_short	rtlifetime;
24353541Sshin	u_long	expire;
24462587Sitojun	struct  ifnet *ifp;
245151539Ssuz	int	installed;	/* is installed into kernel routing table */
24653541Sshin};
24753541Sshin
248151539Ssuzstruct nd_prefixctl {
249151539Ssuz	struct ifnet *ndpr_ifp;
250151539Ssuz
251151539Ssuz	/* prefix */
252151539Ssuz	struct sockaddr_in6 ndpr_prefix;
253151539Ssuz	u_char	ndpr_plen;
254151539Ssuz
255151539Ssuz	u_int32_t ndpr_vltime;	/* advertised valid lifetime */
256151539Ssuz	u_int32_t ndpr_pltime;	/* advertised preferred lifetime */
257151539Ssuz
258151539Ssuz	struct prf_ra ndpr_flags;
259151539Ssuz};
260151539Ssuz
261151539Ssuz
26253541Sshinstruct nd_prefix {
26362587Sitojun	struct ifnet *ndpr_ifp;
26460938Sjake	LIST_ENTRY(nd_prefix) ndpr_entry;
26562587Sitojun	struct sockaddr_in6 ndpr_prefix;	/* prefix */
26662587Sitojun	struct in6_addr ndpr_mask; /* netmask derived from the prefix */
267151539Ssuz
26862587Sitojun	u_int32_t ndpr_vltime;	/* advertised valid lifetime */
26962587Sitojun	u_int32_t ndpr_pltime;	/* advertised preferred lifetime */
270151539Ssuz
27162587Sitojun	time_t ndpr_expire;	/* expiration time of the prefix */
27262587Sitojun	time_t ndpr_preferred;	/* preferred time of the prefix */
273151539Ssuz	time_t ndpr_lastupdate; /* reception time of last advertisement */
274151539Ssuz
27562587Sitojun	struct prf_ra ndpr_flags;
27678064Sume	u_int32_t ndpr_stateflags; /* actual state flags */
27753541Sshin	/* list of routers that advertise the prefix: */
27860938Sjake	LIST_HEAD(pr_rtrhead, nd_pfxrouter) ndpr_advrtrs;
27953541Sshin	u_char	ndpr_plen;
28078064Sume	int	ndpr_refcnt;	/* reference couter from addresses */
28153541Sshin};
28253541Sshin
28362587Sitojun#define ndpr_raf		ndpr_flags
28462587Sitojun#define ndpr_raf_onlink		ndpr_flags.onlink
28562587Sitojun#define ndpr_raf_auto		ndpr_flags.autonomous
286151539Ssuz#define ndpr_raf_router		ndpr_flags.router
28753541Sshin
28853541Sshin/*
28953541Sshin * Message format for use in obtaining information about prefixes
29053541Sshin * from inet6 sysctl function
29153541Sshin */
29253541Sshinstruct inet6_ndpr_msghdr {
29353541Sshin	u_short	inpm_msglen;	/* to skip over non-understood messages */
29472093Sasmodai	u_char	inpm_version;	/* future binary compatibility */
29553541Sshin	u_char	inpm_type;	/* message type */
29662587Sitojun	struct in6_addr inpm_prefix;
29753541Sshin	u_long	prm_vltim;
29853541Sshin	u_long	prm_pltime;
29953541Sshin	u_long	prm_expire;
30053541Sshin	u_long	prm_preferred;
30162587Sitojun	struct in6_prflags prm_flags;
30253541Sshin	u_short	prm_index;	/* index for associated ifp */
30353541Sshin	u_char	prm_plen;	/* length of prefix in bits */
30453541Sshin};
30553541Sshin
30662587Sitojun#define prm_raf_onlink		prm_flags.prf_ra.onlink
30762587Sitojun#define prm_raf_auto		prm_flags.prf_ra.autonomous
30853541Sshin
30962587Sitojun#define prm_statef_onlink	prm_flags.prf_state.onlink
31053541Sshin
31162587Sitojun#define prm_rrf_decrvalid	prm_flags.prf_rr.decrvalid
31262587Sitojun#define prm_rrf_decrprefd	prm_flags.prf_rr.decrprefd
31353541Sshin
31453541Sshinstruct nd_pfxrouter {
31560938Sjake	LIST_ENTRY(nd_pfxrouter) pfr_entry;
31662587Sitojun	struct nd_defrouter *router;
31753541Sshin};
31853541Sshin
31960938SjakeLIST_HEAD(nd_prhead, nd_prefix);
32053541Sshin
32153541Sshin/* nd6.c */
322195699SrwatsonVNET_DECLARE(int, nd6_prune);
323195699SrwatsonVNET_DECLARE(int, nd6_delay);
324195699SrwatsonVNET_DECLARE(int, nd6_umaxtries);
325195699SrwatsonVNET_DECLARE(int, nd6_mmaxtries);
326195699SrwatsonVNET_DECLARE(int, nd6_useloopback);
327195699SrwatsonVNET_DECLARE(int, nd6_maxnudhint);
328195699SrwatsonVNET_DECLARE(int, nd6_gctimer);
329195699SrwatsonVNET_DECLARE(struct nd_drhead, nd_defrouter);
330195699SrwatsonVNET_DECLARE(struct nd_prhead, nd_prefix);
331195699SrwatsonVNET_DECLARE(int, nd6_debug);
332195699SrwatsonVNET_DECLARE(int, nd6_onlink_ns_rfc4861);
333195727Srwatson#define	V_nd6_prune			VNET(nd6_prune)
334195727Srwatson#define	V_nd6_delay			VNET(nd6_delay)
335195727Srwatson#define	V_nd6_umaxtries			VNET(nd6_umaxtries)
336195727Srwatson#define	V_nd6_mmaxtries			VNET(nd6_mmaxtries)
337195727Srwatson#define	V_nd6_useloopback		VNET(nd6_useloopback)
338195727Srwatson#define	V_nd6_maxnudhint		VNET(nd6_maxnudhint)
339195727Srwatson#define	V_nd6_gctimer			VNET(nd6_gctimer)
340195727Srwatson#define	V_nd_defrouter			VNET(nd_defrouter)
341195727Srwatson#define	V_nd_prefix			VNET(nd_prefix)
342195727Srwatson#define	V_nd6_debug			VNET(nd6_debug)
343195727Srwatson#define	V_nd6_onlink_ns_rfc4861		VNET(nd6_onlink_ns_rfc4861)
344207369Sbz
345207369Sbz#define nd6log(x)	do { if (V_nd6_debug) log x; } while (/*CONSTCOND*/ 0)
346207369Sbz
347207369SbzVNET_DECLARE(struct callout, nd6_timer_ch);
348195727Srwatson#define	V_nd6_timer_ch			VNET(nd6_timer_ch)
34978064Sume
35062587Sitojun/* nd6_rtr.c */
351195699SrwatsonVNET_DECLARE(int, nd6_defifindex);
352195699SrwatsonVNET_DECLARE(int, ip6_desync_factor);	/* seconds */
353195699SrwatsonVNET_DECLARE(u_int32_t, ip6_temp_preferred_lifetime); /* seconds */
354195699SrwatsonVNET_DECLARE(u_int32_t, ip6_temp_valid_lifetime); /* seconds */
355195699SrwatsonVNET_DECLARE(int, ip6_temp_regen_advance); /* seconds */
356195727Srwatson#define	V_nd6_defifindex		VNET(nd6_defifindex)
357195727Srwatson#define	V_ip6_desync_factor		VNET(ip6_desync_factor)
358195727Srwatson#define	V_ip6_temp_preferred_lifetime	VNET(ip6_temp_preferred_lifetime)
359195727Srwatson#define	V_ip6_temp_valid_lifetime	VNET(ip6_temp_valid_lifetime)
360195727Srwatson#define	V_ip6_temp_regen_advance	VNET(ip6_temp_regen_advance)
361195699Srwatson
36253541Sshinunion nd_opts {
363282622Shiren	struct nd_opt_hdr *nd_opt_array[16];	/* max = ND_OPT_NONCE */
36453541Sshin	struct {
36562587Sitojun		struct nd_opt_hdr *zero;
36662587Sitojun		struct nd_opt_hdr *src_lladdr;
36762587Sitojun		struct nd_opt_hdr *tgt_lladdr;
36895023Ssuz		struct nd_opt_prefix_info *pi_beg; /* multiple opts, start */
36962587Sitojun		struct nd_opt_rd_hdr *rh;
37062587Sitojun		struct nd_opt_mtu *mtu;
371282622Shiren		struct nd_opt_hdr *__res6;
372282622Shiren		struct nd_opt_hdr *__res7;
373282622Shiren		struct nd_opt_hdr *__res8;
374282622Shiren		struct nd_opt_hdr *__res9;
375282622Shiren		struct nd_opt_hdr *__res10;
376282622Shiren		struct nd_opt_hdr *__res11;
377282622Shiren		struct nd_opt_hdr *__res12;
378282622Shiren		struct nd_opt_hdr *__res13;
379282622Shiren		struct nd_opt_nonce *nonce;
380282622Shiren		struct nd_opt_hdr *__res15;
38162587Sitojun		struct nd_opt_hdr *search;	/* multiple opts */
38262587Sitojun		struct nd_opt_hdr *last;	/* multiple opts */
38362587Sitojun		int done;
38462587Sitojun		struct nd_opt_prefix_info *pi_end;/* multiple opts, end */
38553541Sshin	} nd_opt_each;
38653541Sshin};
38762587Sitojun#define nd_opts_src_lladdr	nd_opt_each.src_lladdr
38862587Sitojun#define nd_opts_tgt_lladdr	nd_opt_each.tgt_lladdr
38962587Sitojun#define nd_opts_pi		nd_opt_each.pi_beg
39062587Sitojun#define nd_opts_pi_end		nd_opt_each.pi_end
39162587Sitojun#define nd_opts_rh		nd_opt_each.rh
39262587Sitojun#define nd_opts_mtu		nd_opt_each.mtu
393282622Shiren#define nd_opts_nonce		nd_opt_each.nonce
39462587Sitojun#define nd_opts_search		nd_opt_each.search
39562587Sitojun#define nd_opts_last		nd_opt_each.last
39662587Sitojun#define nd_opts_done		nd_opt_each.done
39753541Sshin
39853541Sshin/* XXX: need nd6_var.h?? */
39953541Sshin/* nd6.c */
400241916Sdelphijvoid nd6_init(void);
401193731Szec#ifdef VIMAGE
402241916Sdelphijvoid nd6_destroy(void);
403193731Szec#endif
404241916Sdelphijstruct nd_ifinfo *nd6_ifattach(struct ifnet *);
405241916Sdelphijvoid nd6_ifdetach(struct nd_ifinfo *);
406241916Sdelphijint nd6_is_addr_neighbor(struct sockaddr_in6 *, struct ifnet *);
407241916Sdelphijvoid nd6_option_init(void *, int, union nd_opts *);
408241916Sdelphijstruct nd_opt_hdr *nd6_option(union nd_opts *);
409241916Sdelphijint nd6_options(union nd_opts *);
410241916Sdelphijstruct	llentry *nd6_lookup(struct in6_addr *, int, struct ifnet *);
411241916Sdelphijvoid nd6_setmtu(struct ifnet *);
412241916Sdelphijvoid nd6_llinfo_settimer(struct llentry *, long);
413241916Sdelphijvoid nd6_llinfo_settimer_locked(struct llentry *, long);
414241916Sdelphijvoid nd6_timer(void *);
415241916Sdelphijvoid nd6_purge(struct ifnet *);
416241916Sdelphijvoid nd6_nud_hint(struct rtentry *, struct in6_addr *, int);
417241916Sdelphijint nd6_resolve(struct ifnet *, struct rtentry *, struct mbuf *,
418241916Sdelphij	struct sockaddr *, u_char *);
419241916Sdelphijvoid nd6_rtrequest(int, struct rtentry *, struct rt_addrinfo *);
420241916Sdelphijint nd6_ioctl(u_long, caddr_t, struct ifnet *);
421241916Sdelphijstruct llentry *nd6_cache_lladdr(struct ifnet *, struct in6_addr *,
422241916Sdelphij	char *, int, int, int);
423241916Sdelphijint nd6_output(struct ifnet *, struct ifnet *, struct mbuf *,
424241916Sdelphij	struct sockaddr_in6 *, struct rtentry *);
425282622Shirenvoid nd6_grab_holdchain(struct llentry *, struct mbuf **,
426282622Shiren    struct sockaddr_in6 *);
427282622Shirenint nd6_flush_holdchain(struct ifnet *, struct ifnet *, struct mbuf *,
428282622Shiren    struct sockaddr_in6 *);
429241916Sdelphijint nd6_need_cache(struct ifnet *);
430241916Sdelphijint nd6_storelladdr(struct ifnet *, struct mbuf *,
431249925Sglebius	const struct sockaddr *, u_char *, struct llentry **);
43253541Sshin
43353541Sshin/* nd6_nbr.c */
434241916Sdelphijvoid nd6_na_input(struct mbuf *, int, int);
435241916Sdelphijvoid nd6_na_output(struct ifnet *, const struct in6_addr *,
436241916Sdelphij	const struct in6_addr *, u_long, int, struct sockaddr *);
437241916Sdelphijvoid nd6_ns_input(struct mbuf *, int, int);
438241916Sdelphijvoid nd6_ns_output(struct ifnet *, const struct in6_addr *,
439282622Shiren	const struct in6_addr *, struct llentry *, uint8_t *);
440241916Sdelphijcaddr_t nd6_ifptomac(struct ifnet *);
441282622Shirenvoid nd6_dad_init(void);
442241916Sdelphijvoid nd6_dad_start(struct ifaddr *, int);
443241916Sdelphijvoid nd6_dad_stop(struct ifaddr *);
44453541Sshin
44553541Sshin/* nd6_rtr.c */
446241916Sdelphijvoid nd6_rs_input(struct mbuf *, int, int);
447241916Sdelphijvoid nd6_ra_input(struct mbuf *, int, int);
448241916Sdelphijvoid prelist_del(struct nd_prefix *);
449241916Sdelphijvoid defrouter_reset(void);
450241916Sdelphijvoid defrouter_select(void);
451241916Sdelphijvoid defrtrlist_del(struct nd_defrouter *);
452241916Sdelphijvoid prelist_remove(struct nd_prefix *);
453241916Sdelphijint nd6_prelist_add(struct nd_prefixctl *, struct nd_defrouter *,
454241916Sdelphij	struct nd_prefix **);
455241916Sdelphijvoid pfxlist_onlink_check(void);
456241916Sdelphijstruct nd_defrouter *defrouter_lookup(struct in6_addr *, struct ifnet *);
457241916Sdelphijstruct nd_prefix *nd6_prefix_lookup(struct nd_prefixctl *);
458241916Sdelphijvoid rt6_flush(struct in6_addr *, struct ifnet *);
459241916Sdelphijint nd6_setdefaultiface(int);
460241916Sdelphijint in6_tmpifadd(const struct in6_ifaddr *, int, int);
46153541Sshin
46253541Sshin#endif /* _KERNEL */
46353541Sshin
46453541Sshin#endif /* _NETINET6_ND6_H_ */
465