xref: /onnv-gate/usr/src/cmd/cmd-inet/usr.lib/in.ndpd/tables.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef	_NDPD_TABLES_H
28*0Sstevel@tonic-gate #define	_NDPD_TABLES_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #ifdef	__cplusplus
33*0Sstevel@tonic-gate extern "C" {
34*0Sstevel@tonic-gate #endif
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate enum adv_states { NO_ADV = 0, REG_ADV, INIT_ADV, SOLICIT_ADV, FINAL_ADV };
37*0Sstevel@tonic-gate enum adv_events { ADV_OFF, START_INIT_ADV, START_FINAL_ADV, RECEIVED_SOLICIT,
38*0Sstevel@tonic-gate 			ADV_TIMER };
39*0Sstevel@tonic-gate 
40*0Sstevel@tonic-gate enum solicit_states { NO_SOLICIT = 0, INIT_SOLICIT, DONE_SOLICIT };
41*0Sstevel@tonic-gate enum solicit_events { SOLICIT_OFF, START_INIT_SOLICIT, SOL_TIMER,
42*0Sstevel@tonic-gate 			SOLICIT_DONE };
43*0Sstevel@tonic-gate 
44*0Sstevel@tonic-gate /*
45*0Sstevel@tonic-gate  * Data structures used to handle configuration variables set in ndpd.conf.
46*0Sstevel@tonic-gate  * cf_notdefault is set for variables explicitly set in ndpd.conf.
47*0Sstevel@tonic-gate  */
48*0Sstevel@tonic-gate struct confvar {
49*0Sstevel@tonic-gate 	uint_t		cf_value;
50*0Sstevel@tonic-gate 	boolean_t	cf_notdefault;
51*0Sstevel@tonic-gate };
52*0Sstevel@tonic-gate 
53*0Sstevel@tonic-gate extern struct confvar ifdefaults[];
54*0Sstevel@tonic-gate 
55*0Sstevel@tonic-gate /*
56*0Sstevel@tonic-gate  * Interfaces configuration variable indicies
57*0Sstevel@tonic-gate  */
58*0Sstevel@tonic-gate #define	I_DupAddrDetectTransmits	0	/* From RFC 2462 */
59*0Sstevel@tonic-gate #define	I_AdvSendAdvertisements		1
60*0Sstevel@tonic-gate #define	I_MaxRtrAdvInterval		2	/* In seconds */
61*0Sstevel@tonic-gate #define	I_MinRtrAdvInterval		3	/* In seconds */
62*0Sstevel@tonic-gate #define	I_AdvManagedFlag		4
63*0Sstevel@tonic-gate #define	I_AdvOtherConfigFlag		5
64*0Sstevel@tonic-gate #define	I_AdvLinkMTU			6
65*0Sstevel@tonic-gate #define	I_AdvReachableTime		7	/* In milliseconds */
66*0Sstevel@tonic-gate #define	I_AdvRetransTimer		8	/* In milliseconds */
67*0Sstevel@tonic-gate #define	I_AdvCurHopLimit		9
68*0Sstevel@tonic-gate #define	I_AdvDefaultLifetime		10	/* In seconds */
69*0Sstevel@tonic-gate #define	I_StatelessAddrConf		11
70*0Sstevel@tonic-gate #define	I_TmpAddrsEnabled		12	/* From RFC 3041 */
71*0Sstevel@tonic-gate #define	I_TmpValidLifetime		13	/* In seconds */
72*0Sstevel@tonic-gate #define	I_TmpPreferredLifetime		14	/* In seconds */
73*0Sstevel@tonic-gate #define	I_TmpRegenAdvance		15	/* In seconds */
74*0Sstevel@tonic-gate #define	I_TmpMaxDesyncFactor		16	/* In seconds */
75*0Sstevel@tonic-gate #define	I_IFSIZE			17	/* # of variables */
76*0Sstevel@tonic-gate 
77*0Sstevel@tonic-gate /*
78*0Sstevel@tonic-gate  * A doubly linked list of all physical interfaces that each contain a
79*0Sstevel@tonic-gate  * doubly linked list of prefixes (i.e. logical interfaces) and default
80*0Sstevel@tonic-gate  * routers.
81*0Sstevel@tonic-gate  */
82*0Sstevel@tonic-gate struct phyint {
83*0Sstevel@tonic-gate 	struct phyint	*pi_next;
84*0Sstevel@tonic-gate 	struct phyint	*pi_prev;
85*0Sstevel@tonic-gate 	struct prefix	*pi_prefix_list;	/* Doubly linked prefixes */
86*0Sstevel@tonic-gate 	struct router	*pi_router_list;	/* Doubly linked routers */
87*0Sstevel@tonic-gate 	struct adv_prefix *pi_adv_prefix_list;	/* Doubly linked adv.prefixes */
88*0Sstevel@tonic-gate 
89*0Sstevel@tonic-gate 	uint_t		pi_index;		/* Identifier > 0 */
90*0Sstevel@tonic-gate 	char		pi_name[LIFNAMSIZ];	/* Used to identify it */
91*0Sstevel@tonic-gate 	int		pi_sock;		/* For sending and receiving */
92*0Sstevel@tonic-gate 	struct in6_addr	pi_ifaddr;		/* Local address */
93*0Sstevel@tonic-gate 	uint_t		pi_flags;		/* IFF_* flags */
94*0Sstevel@tonic-gate 	uint_t		pi_hdw_addr_len;
95*0Sstevel@tonic-gate 	uchar_t		pi_hdw_addr[ND_MAX_HDW_LEN];
96*0Sstevel@tonic-gate 	uint_t		pi_mtu;			/* From SIOCGLIFMTU */
97*0Sstevel@tonic-gate 	struct in6_addr pi_token;
98*0Sstevel@tonic-gate 	uint_t		pi_token_length;
99*0Sstevel@tonic-gate 	struct in6_addr	pi_tmp_token;		/* For RFC3041 addrs */
100*0Sstevel@tonic-gate 	struct in6_addr	pi_dst_token;		/* For POINTOPOINT */
101*0Sstevel@tonic-gate 
102*0Sstevel@tonic-gate 	uint_t		pi_state;		/* PI_* below */
103*0Sstevel@tonic-gate 	uint_t		pi_kernel_state;	/* PI_* below */
104*0Sstevel@tonic-gate 	boolean_t	pi_onlink_default;	/* Has onlink default route */
105*0Sstevel@tonic-gate 	uint_t		pi_num_k_routers;	/* # routers in kernel */
106*0Sstevel@tonic-gate 	uint_t		pi_reach_time_since_random;	/* In milliseconds */
107*0Sstevel@tonic-gate 
108*0Sstevel@tonic-gate 	/* Applies if pi_AdvSendAdvertisements */
109*0Sstevel@tonic-gate 	uint_t		pi_adv_time_left;	/* In milliseconds */
110*0Sstevel@tonic-gate 	uint_t		pi_adv_time_since_sent;	/* In milliseconds */
111*0Sstevel@tonic-gate 	enum adv_states	pi_adv_state;
112*0Sstevel@tonic-gate 	uint_t		pi_adv_count;
113*0Sstevel@tonic-gate 
114*0Sstevel@tonic-gate 	/* Applies if not pi_AdvSendAdvertisements */
115*0Sstevel@tonic-gate 	uint_t		pi_sol_time_left;	/* In milliseconds */
116*0Sstevel@tonic-gate 	enum solicit_states pi_sol_state;
117*0Sstevel@tonic-gate 	uint_t		pi_sol_count;
118*0Sstevel@tonic-gate 
119*0Sstevel@tonic-gate 	/* Interface specific configurable variables */
120*0Sstevel@tonic-gate 	struct confvar	pi_config[I_IFSIZE];
121*0Sstevel@tonic-gate #define	pi_DupAddrDetectTransmits pi_config[I_DupAddrDetectTransmits].cf_value
122*0Sstevel@tonic-gate #define	pi_AdvSendAdvertisements pi_config[I_AdvSendAdvertisements].cf_value
123*0Sstevel@tonic-gate #define	pi_MaxRtrAdvInterval	pi_config[I_MaxRtrAdvInterval].cf_value
124*0Sstevel@tonic-gate #define	pi_MinRtrAdvInterval	pi_config[I_MinRtrAdvInterval].cf_value
125*0Sstevel@tonic-gate #define	pi_AdvManagedFlag	pi_config[I_AdvManagedFlag].cf_value
126*0Sstevel@tonic-gate #define	pi_AdvOtherConfigFlag	pi_config[I_AdvOtherConfigFlag].cf_value
127*0Sstevel@tonic-gate #define	pi_AdvLinkMTU		pi_config[I_AdvLinkMTU].cf_value
128*0Sstevel@tonic-gate #define	pi_AdvReachableTime	pi_config[I_AdvReachableTime].cf_value
129*0Sstevel@tonic-gate #define	pi_AdvRetransTimer	pi_config[I_AdvRetransTimer].cf_value
130*0Sstevel@tonic-gate #define	pi_AdvCurHopLimit	pi_config[I_AdvCurHopLimit].cf_value
131*0Sstevel@tonic-gate #define	pi_AdvDefaultLifetime	pi_config[I_AdvDefaultLifetime].cf_value
132*0Sstevel@tonic-gate #define	pi_StatelessAddrConf	pi_config[I_StatelessAddrConf].cf_value
133*0Sstevel@tonic-gate #define	pi_TmpAddrsEnabled	pi_config[I_TmpAddrsEnabled].cf_value
134*0Sstevel@tonic-gate #define	pi_TmpValidLifetime	pi_config[I_TmpValidLifetime].cf_value
135*0Sstevel@tonic-gate #define	pi_TmpPreferredLifetime	pi_config[I_TmpPreferredLifetime].cf_value
136*0Sstevel@tonic-gate #define	pi_TmpRegenAdvance	pi_config[I_TmpRegenAdvance].cf_value
137*0Sstevel@tonic-gate #define	pi_TmpMaxDesyncFactor	pi_config[I_TmpMaxDesyncFactor].cf_value
138*0Sstevel@tonic-gate 
139*0Sstevel@tonic-gate 	/* Recorded variables for RFC3041 addresses */
140*0Sstevel@tonic-gate 	uint_t		pi_TmpDesyncFactor;		/* In milliseconds */
141*0Sstevel@tonic-gate 	uint_t		pi_TmpRegenCountdown;		/* In milliseconds */
142*0Sstevel@tonic-gate 
143*0Sstevel@tonic-gate 	/* Recorded variables on node/host */
144*0Sstevel@tonic-gate 	uint_t		pi_LinkMTU;
145*0Sstevel@tonic-gate 	uint_t		pi_CurHopLimit;
146*0Sstevel@tonic-gate 	uint_t		pi_BaseReachableTime;		/* In milliseconds */
147*0Sstevel@tonic-gate 	uint_t		pi_ReachableTime;		/* In milliseconds */
148*0Sstevel@tonic-gate 	/*
149*0Sstevel@tonic-gate 	 * The above value should be a uniformly-distributed random
150*0Sstevel@tonic-gate 	 * value between ND_MIN_RANDOM_FACTOR and
151*0Sstevel@tonic-gate 	 * ND_MAX_RANDOM_FACTOR times BaseReachableTime
152*0Sstevel@tonic-gate 	 * milliseconds.  A new random value should be
153*0Sstevel@tonic-gate 	 * calculated when BaseReachableTime changes (due to
154*0Sstevel@tonic-gate 	 * Router Advertisements) or at least every few hours
155*0Sstevel@tonic-gate 	 * even if no Router Advertisements are received.
156*0Sstevel@tonic-gate 	 * Tracked using pi_each_time_since_random.
157*0Sstevel@tonic-gate 	 */
158*0Sstevel@tonic-gate 	uint_t		pi_RetransTimer;		/* In milliseconds */
159*0Sstevel@tonic-gate 	char		*pi_group_name;
160*0Sstevel@tonic-gate };
161*0Sstevel@tonic-gate 
162*0Sstevel@tonic-gate /*
163*0Sstevel@tonic-gate  * pi_state/pr_kernel_state values
164*0Sstevel@tonic-gate  */
165*0Sstevel@tonic-gate #define	PI_PRESENT		0x01
166*0Sstevel@tonic-gate #define	PI_JOINED_ALLNODES	0x02	/* allnodes multicast joined */
167*0Sstevel@tonic-gate #define	PI_JOINED_ALLROUTERS	0x04	/* allrouters multicast joined */
168*0Sstevel@tonic-gate 
169*0Sstevel@tonic-gate /*
170*0Sstevel@tonic-gate  * Prefix configuration variable indices
171*0Sstevel@tonic-gate  */
172*0Sstevel@tonic-gate #define	I_AdvValidLifetime	0	/* In seconds */
173*0Sstevel@tonic-gate #define	I_AdvOnLinkFlag		1
174*0Sstevel@tonic-gate #define	I_AdvPreferredLifetime	2	/* In seconds */
175*0Sstevel@tonic-gate #define	I_AdvAutonomousFlag	3
176*0Sstevel@tonic-gate #define	I_AdvValidExpiration	4	/* Seconds left */
177*0Sstevel@tonic-gate #define	I_AdvPreferredExpiration 5	/* Seconds left */
178*0Sstevel@tonic-gate #define	I_PREFIXSIZE		6	/* # of variables */
179*0Sstevel@tonic-gate 
180*0Sstevel@tonic-gate /*
181*0Sstevel@tonic-gate  * A doubly linked list of prefixes for onlink and addrconf.
182*0Sstevel@tonic-gate  */
183*0Sstevel@tonic-gate struct prefix {
184*0Sstevel@tonic-gate 	struct prefix	*pr_next;	/* Next prefix for this physical */
185*0Sstevel@tonic-gate 	struct prefix	*pr_prev;	/* Prev prefix for this physical */
186*0Sstevel@tonic-gate 	struct phyint	*pr_physical;	/* Back pointer */
187*0Sstevel@tonic-gate 
188*0Sstevel@tonic-gate 	struct in6_addr	pr_prefix;	/* Used to indentify prefix */
189*0Sstevel@tonic-gate 	uint_t		pr_prefix_len;	/* Num bits valid */
190*0Sstevel@tonic-gate 
191*0Sstevel@tonic-gate 	char		pr_name[LIFNAMSIZ];
192*0Sstevel@tonic-gate 	struct in6_addr	pr_address;
193*0Sstevel@tonic-gate 	uint64_t	pr_flags;	/* IFF_* flags */
194*0Sstevel@tonic-gate 
195*0Sstevel@tonic-gate 	uint_t		pr_state;	/* PR_ONLINK | PR_AUTO etc */
196*0Sstevel@tonic-gate 	uint_t		pr_kernel_state; /* PR_ONLINK | PR_AUTO etc */
197*0Sstevel@tonic-gate 	boolean_t	pr_in_use;	/* To detect removed prefixes */
198*0Sstevel@tonic-gate 
199*0Sstevel@tonic-gate 	/* Recorded variables on node/host */
200*0Sstevel@tonic-gate 	uint_t		pr_ValidLifetime;	/* In ms w/ 2 hour rule */
201*0Sstevel@tonic-gate 	uint_t		pr_PreferredLifetime;	/* In millseconds */
202*0Sstevel@tonic-gate 	uint_t		pr_OnLinkLifetime;	/* ms valid w/o 2 hour rule */
203*0Sstevel@tonic-gate 	boolean_t	pr_OnLinkFlag;
204*0Sstevel@tonic-gate 	boolean_t	pr_AutonomousFlag;
205*0Sstevel@tonic-gate 
206*0Sstevel@tonic-gate 	uint_t		pr_CreateTime;		/* tmpaddr creation time */
207*0Sstevel@tonic-gate 						/* in SECONDS */
208*0Sstevel@tonic-gate };
209*0Sstevel@tonic-gate 
210*0Sstevel@tonic-gate /*
211*0Sstevel@tonic-gate  * Flags used for pr_kernel_state and pr_state where the latter is
212*0Sstevel@tonic-gate  * user-level state.
213*0Sstevel@tonic-gate  */
214*0Sstevel@tonic-gate #define	PR_ONLINK	0x01		/* On-link */
215*0Sstevel@tonic-gate #define	PR_AUTO		0x02		/* Stateless addrconf */
216*0Sstevel@tonic-gate #define	PR_DEPRECATED	0x04		/* Address is deprecated */
217*0Sstevel@tonic-gate #define	PR_STATIC	0x08		/* Not created by ndpd */
218*0Sstevel@tonic-gate 
219*0Sstevel@tonic-gate /*
220*0Sstevel@tonic-gate  * The sum of all possible state string lengths, plus terminating
221*0Sstevel@tonic-gate  * null character; if new states are added, this needs to be updated.
222*0Sstevel@tonic-gate  * Useful for passing an appropriately sized buffer to prefix_print_state().
223*0Sstevel@tonic-gate  *
224*0Sstevel@tonic-gate  * Current strings: "ONLINK ", "AUTO ", "DEPRECATED ", "STATIC ", "\n"
225*0Sstevel@tonic-gate  *                      7     +   5    +     11       +    7     +  1
226*0Sstevel@tonic-gate  */
227*0Sstevel@tonic-gate #define	PREFIX_STATESTRLEN	31
228*0Sstevel@tonic-gate 
229*0Sstevel@tonic-gate /* Prefix used for storing advertisement specific stuff */
230*0Sstevel@tonic-gate struct adv_prefix {
231*0Sstevel@tonic-gate 	struct adv_prefix	*adv_pr_next;	/* Next prefix */
232*0Sstevel@tonic-gate 	struct adv_prefix	*adv_pr_prev;	/* Prev prefix */
233*0Sstevel@tonic-gate 	struct phyint		*adv_pr_physical;	/* Back pointer */
234*0Sstevel@tonic-gate 
235*0Sstevel@tonic-gate 	struct in6_addr		adv_pr_prefix;	/* Used to indentify prefix */
236*0Sstevel@tonic-gate 	uint_t			adv_pr_prefix_len;	/* Num bits valid */
237*0Sstevel@tonic-gate 
238*0Sstevel@tonic-gate 	/* Used when sending advertisements */
239*0Sstevel@tonic-gate 	struct confvar		adv_pr_config[I_PREFIXSIZE];
240*0Sstevel@tonic-gate #define	adv_pr_AdvValidLifetime	adv_pr_config[I_AdvValidLifetime].cf_value
241*0Sstevel@tonic-gate #define	adv_pr_AdvOnLinkFlag	adv_pr_config[I_AdvOnLinkFlag].cf_value
242*0Sstevel@tonic-gate #define	adv_pr_AdvPreferredLifetime	\
243*0Sstevel@tonic-gate 			adv_pr_config[I_AdvPreferredLifetime].cf_value
244*0Sstevel@tonic-gate #define	adv_pr_AdvAutonomousFlag	\
245*0Sstevel@tonic-gate 			adv_pr_config[I_AdvAutonomousFlag].cf_value
246*0Sstevel@tonic-gate #define	adv_pr_AdvValidExpiration	\
247*0Sstevel@tonic-gate 			adv_pr_config[I_AdvValidExpiration].cf_value
248*0Sstevel@tonic-gate #define	adv_pr_AdvPreferredExpiration	\
249*0Sstevel@tonic-gate 			adv_pr_config[I_AdvPreferredExpiration].cf_value
250*0Sstevel@tonic-gate 	/* The two below are set if the timers decrement in real time */
251*0Sstevel@tonic-gate #define	adv_pr_AdvValidRealTime		\
252*0Sstevel@tonic-gate 			adv_pr_config[I_AdvValidExpiration].cf_notdefault
253*0Sstevel@tonic-gate #define	adv_pr_AdvPreferredRealTime	\
254*0Sstevel@tonic-gate 			adv_pr_config[I_AdvPreferredExpiration].cf_notdefault
255*0Sstevel@tonic-gate };
256*0Sstevel@tonic-gate 
257*0Sstevel@tonic-gate /*
258*0Sstevel@tonic-gate  * Doubly-linked list of default routers on a phyint.
259*0Sstevel@tonic-gate  */
260*0Sstevel@tonic-gate struct router {
261*0Sstevel@tonic-gate 	struct router	*dr_next;	/* Next router for this physical */
262*0Sstevel@tonic-gate 	struct router	*dr_prev;	/* Prev router for this physical */
263*0Sstevel@tonic-gate 	struct phyint	*dr_physical;	/* Back pointer */
264*0Sstevel@tonic-gate 
265*0Sstevel@tonic-gate 	struct in6_addr	dr_address;	/* Used to identify the router */
266*0Sstevel@tonic-gate 	uint_t		dr_lifetime;	/* In milliseconds */
267*0Sstevel@tonic-gate 	boolean_t	dr_inkernel;	/* Route added to kernel */
268*0Sstevel@tonic-gate 	boolean_t	dr_onlink;	/* Is this the onlink default route? */
269*0Sstevel@tonic-gate };
270*0Sstevel@tonic-gate 
271*0Sstevel@tonic-gate /*
272*0Sstevel@tonic-gate  * Globals
273*0Sstevel@tonic-gate  */
274*0Sstevel@tonic-gate extern struct phyint *phyints;
275*0Sstevel@tonic-gate 
276*0Sstevel@tonic-gate 
277*0Sstevel@tonic-gate /*
278*0Sstevel@tonic-gate  * Functions
279*0Sstevel@tonic-gate  */
280*0Sstevel@tonic-gate extern uint_t		getcurrenttime(void);
281*0Sstevel@tonic-gate 
282*0Sstevel@tonic-gate extern struct phyint	*phyint_lookup(char *name);
283*0Sstevel@tonic-gate extern struct phyint	*phyint_lookup_on_index(uint_t ifindex);
284*0Sstevel@tonic-gate extern struct phyint	*phyint_create(char *name);
285*0Sstevel@tonic-gate extern int		phyint_init_from_k(struct phyint *pi);
286*0Sstevel@tonic-gate extern void		phyint_delete(struct phyint *pi);
287*0Sstevel@tonic-gate extern uint_t		phyint_timer(struct phyint *pi, uint_t elapsed);
288*0Sstevel@tonic-gate extern void		phyint_print_all(void);
289*0Sstevel@tonic-gate extern void		phyint_reach_random(struct phyint *pi,
290*0Sstevel@tonic-gate 			    boolean_t set_needed);
291*0Sstevel@tonic-gate extern void		phyint_cleanup(struct phyint *pi);
292*0Sstevel@tonic-gate 
293*0Sstevel@tonic-gate extern boolean_t	tmptoken_create(struct phyint *pi);
294*0Sstevel@tonic-gate extern void		tmptoken_delete(struct phyint *pi);
295*0Sstevel@tonic-gate extern uint_t		tmptoken_timer(struct phyint *pi, uint_t elapsed);
296*0Sstevel@tonic-gate extern boolean_t	token_equal(struct in6_addr t1, struct in6_addr t2,
297*0Sstevel@tonic-gate 			    int bits);
298*0Sstevel@tonic-gate 
299*0Sstevel@tonic-gate extern struct prefix	*prefix_create(struct phyint *pi, struct in6_addr addr,
300*0Sstevel@tonic-gate 			    int addrlen, uint64_t flags);
301*0Sstevel@tonic-gate extern struct prefix	*prefix_lookup_name(struct phyint *pi, char *name);
302*0Sstevel@tonic-gate extern struct prefix	*prefix_lookup_addr_match(struct prefix *pr);
303*0Sstevel@tonic-gate extern struct prefix	*prefix_create_name(struct phyint *pi, char *name);
304*0Sstevel@tonic-gate extern int		prefix_init_from_k(struct prefix *pr);
305*0Sstevel@tonic-gate extern void		prefix_delete(struct prefix *pr);
306*0Sstevel@tonic-gate extern boolean_t	prefix_equal(struct in6_addr p1, struct in6_addr p2,
307*0Sstevel@tonic-gate 			    int bits);
308*0Sstevel@tonic-gate extern void		prefix_update_k(struct prefix *pr);
309*0Sstevel@tonic-gate extern uint_t		prefix_timer(struct prefix *pr, uint_t elapsed);
310*0Sstevel@tonic-gate extern uint_t		adv_prefix_timer(struct adv_prefix *adv_pr,
311*0Sstevel@tonic-gate 			    uint_t elapsed);
312*0Sstevel@tonic-gate extern boolean_t	prefix_token_match(struct phyint *pi,
313*0Sstevel@tonic-gate 			    struct prefix *pr, uint64_t flags);
314*0Sstevel@tonic-gate extern struct prefix	*prefix_lookup_addr(struct phyint *pi,
315*0Sstevel@tonic-gate 			    struct in6_addr prefix);
316*0Sstevel@tonic-gate 
317*0Sstevel@tonic-gate extern struct adv_prefix *adv_prefix_lookup(struct phyint *pi,
318*0Sstevel@tonic-gate 			    struct in6_addr addr, int addrlen);
319*0Sstevel@tonic-gate extern struct adv_prefix *adv_prefix_create(struct phyint *pi,
320*0Sstevel@tonic-gate 			    struct in6_addr addr, int addrlen);
321*0Sstevel@tonic-gate 
322*0Sstevel@tonic-gate extern struct router	*router_lookup(struct phyint *pi, struct in6_addr addr);
323*0Sstevel@tonic-gate extern struct router	*router_create(struct phyint *pi, struct in6_addr addr,
324*0Sstevel@tonic-gate 			    uint_t lifetime);
325*0Sstevel@tonic-gate extern struct router	*router_create_onlink(struct phyint *pi);
326*0Sstevel@tonic-gate extern void		router_update_k(struct router *dr);
327*0Sstevel@tonic-gate extern uint_t		router_timer(struct router *dr, uint_t elapsed);
328*0Sstevel@tonic-gate 
329*0Sstevel@tonic-gate 
330*0Sstevel@tonic-gate extern void	logperror_pi(struct phyint *pi, char *str);
331*0Sstevel@tonic-gate extern void	logperror_pr(struct prefix *pr, char *str);
332*0Sstevel@tonic-gate extern void	check_to_advertise(struct phyint *pi, enum adv_events event);
333*0Sstevel@tonic-gate extern void	check_to_solicit(struct phyint *pi,
334*0Sstevel@tonic-gate 		    enum solicit_events event);
335*0Sstevel@tonic-gate extern uint_t	advertise_event(struct phyint *pi, enum adv_events event,
336*0Sstevel@tonic-gate 		    uint_t elapsed);
337*0Sstevel@tonic-gate extern uint_t	solicit_event(struct phyint *pi, enum solicit_events event,
338*0Sstevel@tonic-gate 		    uint_t elapsed);
339*0Sstevel@tonic-gate 
340*0Sstevel@tonic-gate extern void	print_route_sol(char *str, struct phyint *pi,
341*0Sstevel@tonic-gate 		    struct nd_router_solicit *rs, int len,
342*0Sstevel@tonic-gate 		    struct sockaddr_in6 *addr);
343*0Sstevel@tonic-gate extern void	print_route_adv(char *str, struct phyint *pi,
344*0Sstevel@tonic-gate 		    struct nd_router_advert *ra, int len,
345*0Sstevel@tonic-gate 		    struct sockaddr_in6 *addr);
346*0Sstevel@tonic-gate extern void	print_iflist(struct confvar *confvar);
347*0Sstevel@tonic-gate extern void	print_prefixlist(struct confvar *confvar);
348*0Sstevel@tonic-gate 
349*0Sstevel@tonic-gate extern void	in_data(struct phyint *pi);
350*0Sstevel@tonic-gate 
351*0Sstevel@tonic-gate extern void	incoming_ra(struct phyint *pi, struct nd_router_advert *ra,
352*0Sstevel@tonic-gate 		    int len, struct sockaddr_in6 *from, boolean_t loopback);
353*0Sstevel@tonic-gate 
354*0Sstevel@tonic-gate extern boolean_t incoming_prefix_addrconf_process(struct phyint *pi,
355*0Sstevel@tonic-gate 		    struct prefix *pr, uchar_t *opt,
356*0Sstevel@tonic-gate 		    struct sockaddr_in6 *from, boolean_t loopback,
357*0Sstevel@tonic-gate 		    boolean_t new_prefix);
358*0Sstevel@tonic-gate 
359*0Sstevel@tonic-gate extern void	incoming_prefix_onlink_process(struct prefix *pr,
360*0Sstevel@tonic-gate 		    uchar_t *opt);
361*0Sstevel@tonic-gate 
362*0Sstevel@tonic-gate #ifdef	__cplusplus
363*0Sstevel@tonic-gate }
364*0Sstevel@tonic-gate #endif
365*0Sstevel@tonic-gate 
366*0Sstevel@tonic-gate #endif	/* _NDPD_TABLES_H */
367