17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
58121d73fSseb  * Common Development and Distribution License (the "License").
68121d73fSseb  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*6e91bba0SGirish Moodalbail  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_NDPD_TABLES_H
277c478bd9Sstevel@tonic-gate #define	_NDPD_TABLES_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
307c478bd9Sstevel@tonic-gate extern "C" {
317c478bd9Sstevel@tonic-gate #endif
327c478bd9Sstevel@tonic-gate 
33cc52cd5bSapersson #include <ndpd.h>
34*6e91bba0SGirish Moodalbail #include <libipadm.h>
353173664eSapersson 
367c478bd9Sstevel@tonic-gate enum adv_states { NO_ADV = 0, REG_ADV, INIT_ADV, SOLICIT_ADV, FINAL_ADV };
377c478bd9Sstevel@tonic-gate enum adv_events { ADV_OFF, START_INIT_ADV, START_FINAL_ADV, RECEIVED_SOLICIT,
387c478bd9Sstevel@tonic-gate 			ADV_TIMER };
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate enum solicit_states { NO_SOLICIT = 0, INIT_SOLICIT, DONE_SOLICIT };
417c478bd9Sstevel@tonic-gate enum solicit_events { SOLICIT_OFF, START_INIT_SOLICIT, SOL_TIMER,
42d04ccbb3Scarlsonj 			SOLICIT_DONE, RESTART_INIT_SOLICIT };
43d04ccbb3Scarlsonj 
447c478bd9Sstevel@tonic-gate /*
457c478bd9Sstevel@tonic-gate  * A doubly linked list of all physical interfaces that each contain a
467c478bd9Sstevel@tonic-gate  * doubly linked list of prefixes (i.e. logical interfaces) and default
477c478bd9Sstevel@tonic-gate  * routers.
487c478bd9Sstevel@tonic-gate  */
497c478bd9Sstevel@tonic-gate struct phyint {
507c478bd9Sstevel@tonic-gate 	struct phyint	*pi_next;
517c478bd9Sstevel@tonic-gate 	struct phyint	*pi_prev;
527c478bd9Sstevel@tonic-gate 	struct prefix	*pi_prefix_list;	/* Doubly linked prefixes */
537c478bd9Sstevel@tonic-gate 	struct router	*pi_router_list;	/* Doubly linked routers */
547c478bd9Sstevel@tonic-gate 	struct adv_prefix *pi_adv_prefix_list;	/* Doubly linked adv.prefixes */
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate 	uint_t		pi_index;		/* Identifier > 0 */
577c478bd9Sstevel@tonic-gate 	char		pi_name[LIFNAMSIZ];	/* Used to identify it */
587c478bd9Sstevel@tonic-gate 	int		pi_sock;		/* For sending and receiving */
597c478bd9Sstevel@tonic-gate 	struct in6_addr	pi_ifaddr;		/* Local address */
60e11c3f44Smeem 	uint64_t		pi_flags;		/* IFF_* flags */
617c478bd9Sstevel@tonic-gate 	uint_t		pi_mtu;			/* From SIOCGLIFMTU */
627c478bd9Sstevel@tonic-gate 	struct in6_addr pi_token;
637c478bd9Sstevel@tonic-gate 	uint_t		pi_token_length;
64*6e91bba0SGirish Moodalbail 	boolean_t	pi_stateless;
65*6e91bba0SGirish Moodalbail 	boolean_t	pi_stateful;
667c478bd9Sstevel@tonic-gate 	struct in6_addr	pi_tmp_token;		/* For RFC3041 addrs */
677c478bd9Sstevel@tonic-gate 	struct in6_addr	pi_dst_token;		/* For POINTOPOINT */
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate 	uint_t		pi_state;		/* PI_* below */
707c478bd9Sstevel@tonic-gate 	uint_t		pi_kernel_state;	/* PI_* below */
717c478bd9Sstevel@tonic-gate 	uint_t		pi_num_k_routers;	/* # routers in kernel */
727c478bd9Sstevel@tonic-gate 	uint_t		pi_reach_time_since_random;	/* In milliseconds */
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate 	/* Applies if pi_AdvSendAdvertisements */
757c478bd9Sstevel@tonic-gate 	uint_t		pi_adv_time_left;	/* In milliseconds */
767c478bd9Sstevel@tonic-gate 	uint_t		pi_adv_time_since_sent;	/* In milliseconds */
777c478bd9Sstevel@tonic-gate 	enum adv_states	pi_adv_state;
787c478bd9Sstevel@tonic-gate 	uint_t		pi_adv_count;
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate 	/* Applies if not pi_AdvSendAdvertisements */
817c478bd9Sstevel@tonic-gate 	uint_t		pi_sol_time_left;	/* In milliseconds */
827c478bd9Sstevel@tonic-gate 	enum solicit_states pi_sol_state;
837c478bd9Sstevel@tonic-gate 	uint_t		pi_sol_count;
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate 	/* Interface specific configurable variables */
867c478bd9Sstevel@tonic-gate 	struct confvar	pi_config[I_IFSIZE];
877c478bd9Sstevel@tonic-gate #define	pi_DupAddrDetectTransmits pi_config[I_DupAddrDetectTransmits].cf_value
887c478bd9Sstevel@tonic-gate #define	pi_AdvSendAdvertisements pi_config[I_AdvSendAdvertisements].cf_value
897c478bd9Sstevel@tonic-gate #define	pi_MaxRtrAdvInterval	pi_config[I_MaxRtrAdvInterval].cf_value
907c478bd9Sstevel@tonic-gate #define	pi_MinRtrAdvInterval	pi_config[I_MinRtrAdvInterval].cf_value
917c478bd9Sstevel@tonic-gate #define	pi_AdvManagedFlag	pi_config[I_AdvManagedFlag].cf_value
927c478bd9Sstevel@tonic-gate #define	pi_AdvOtherConfigFlag	pi_config[I_AdvOtherConfigFlag].cf_value
937c478bd9Sstevel@tonic-gate #define	pi_AdvLinkMTU		pi_config[I_AdvLinkMTU].cf_value
947c478bd9Sstevel@tonic-gate #define	pi_AdvReachableTime	pi_config[I_AdvReachableTime].cf_value
957c478bd9Sstevel@tonic-gate #define	pi_AdvRetransTimer	pi_config[I_AdvRetransTimer].cf_value
967c478bd9Sstevel@tonic-gate #define	pi_AdvCurHopLimit	pi_config[I_AdvCurHopLimit].cf_value
977c478bd9Sstevel@tonic-gate #define	pi_AdvDefaultLifetime	pi_config[I_AdvDefaultLifetime].cf_value
987c478bd9Sstevel@tonic-gate #define	pi_StatelessAddrConf	pi_config[I_StatelessAddrConf].cf_value
997c478bd9Sstevel@tonic-gate #define	pi_TmpAddrsEnabled	pi_config[I_TmpAddrsEnabled].cf_value
1007c478bd9Sstevel@tonic-gate #define	pi_TmpValidLifetime	pi_config[I_TmpValidLifetime].cf_value
1017c478bd9Sstevel@tonic-gate #define	pi_TmpPreferredLifetime	pi_config[I_TmpPreferredLifetime].cf_value
1027c478bd9Sstevel@tonic-gate #define	pi_TmpRegenAdvance	pi_config[I_TmpRegenAdvance].cf_value
1037c478bd9Sstevel@tonic-gate #define	pi_TmpMaxDesyncFactor	pi_config[I_TmpMaxDesyncFactor].cf_value
104d04ccbb3Scarlsonj #define	pi_StatefulAddrConf	pi_config[I_StatefulAddrConf].cf_value
1057c478bd9Sstevel@tonic-gate 
1067c478bd9Sstevel@tonic-gate 	/* Recorded variables for RFC3041 addresses */
1077c478bd9Sstevel@tonic-gate 	uint_t		pi_TmpDesyncFactor;		/* In milliseconds */
1087c478bd9Sstevel@tonic-gate 	uint_t		pi_TmpRegenCountdown;		/* In milliseconds */
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate 	/* Recorded variables on node/host */
1117c478bd9Sstevel@tonic-gate 	uint_t		pi_LinkMTU;
1127c478bd9Sstevel@tonic-gate 	uint_t		pi_CurHopLimit;
1137c478bd9Sstevel@tonic-gate 	uint_t		pi_BaseReachableTime;		/* In milliseconds */
1147c478bd9Sstevel@tonic-gate 	uint_t		pi_ReachableTime;		/* In milliseconds */
1157c478bd9Sstevel@tonic-gate 	/*
1167c478bd9Sstevel@tonic-gate 	 * The above value should be a uniformly-distributed random
1177c478bd9Sstevel@tonic-gate 	 * value between ND_MIN_RANDOM_FACTOR and
1187c478bd9Sstevel@tonic-gate 	 * ND_MAX_RANDOM_FACTOR times BaseReachableTime
1197c478bd9Sstevel@tonic-gate 	 * milliseconds.  A new random value should be
1207c478bd9Sstevel@tonic-gate 	 * calculated when BaseReachableTime changes (due to
1217c478bd9Sstevel@tonic-gate 	 * Router Advertisements) or at least every few hours
1227c478bd9Sstevel@tonic-gate 	 * even if no Router Advertisements are received.
1237c478bd9Sstevel@tonic-gate 	 * Tracked using pi_each_time_since_random.
1247c478bd9Sstevel@tonic-gate 	 */
125*6e91bba0SGirish Moodalbail 	uint_t		pi_RetransTimer;	/* In milliseconds */
126d04ccbb3Scarlsonj 
127*6e91bba0SGirish Moodalbail 	uint_t		pi_ra_flags;	/* Detect when to start DHCP */
128*6e91bba0SGirish Moodalbail 	boolean_t	pi_autoconf;	/* Enable/Disable autoconfiguration */
129*6e91bba0SGirish Moodalbail 	boolean_t	pi_default_token;	/* Use default token */
130*6e91bba0SGirish Moodalbail 	char		pi_ipadm_aobjname[IPADM_AOBJSIZ];
1317c478bd9Sstevel@tonic-gate };
1327c478bd9Sstevel@tonic-gate 
1337c478bd9Sstevel@tonic-gate /*
1347c478bd9Sstevel@tonic-gate  * pi_state/pr_kernel_state values
1357c478bd9Sstevel@tonic-gate  */
1367c478bd9Sstevel@tonic-gate #define	PI_PRESENT		0x01
1377c478bd9Sstevel@tonic-gate #define	PI_JOINED_ALLNODES	0x02	/* allnodes multicast joined */
1387c478bd9Sstevel@tonic-gate #define	PI_JOINED_ALLROUTERS	0x04	/* allrouters multicast joined */
1397c478bd9Sstevel@tonic-gate 
1407c478bd9Sstevel@tonic-gate /*
1417c478bd9Sstevel@tonic-gate  * Prefix configuration variable indices
1427c478bd9Sstevel@tonic-gate  */
1437c478bd9Sstevel@tonic-gate #define	I_AdvValidLifetime	0	/* In seconds */
1447c478bd9Sstevel@tonic-gate #define	I_AdvOnLinkFlag		1
1457c478bd9Sstevel@tonic-gate #define	I_AdvPreferredLifetime	2	/* In seconds */
1467c478bd9Sstevel@tonic-gate #define	I_AdvAutonomousFlag	3
1477c478bd9Sstevel@tonic-gate #define	I_AdvValidExpiration	4	/* Seconds left */
1487c478bd9Sstevel@tonic-gate #define	I_AdvPreferredExpiration 5	/* Seconds left */
1497c478bd9Sstevel@tonic-gate #define	I_PREFIXSIZE		6	/* # of variables */
1507c478bd9Sstevel@tonic-gate 
1517c478bd9Sstevel@tonic-gate /*
152d04ccbb3Scarlsonj  * A doubly-linked list of prefixes for onlink and addrconf.
153d04ccbb3Scarlsonj  * ("Prefixes" in this context are identical to logical interfaces.)
1547c478bd9Sstevel@tonic-gate  */
1557c478bd9Sstevel@tonic-gate struct prefix {
1567c478bd9Sstevel@tonic-gate 	struct prefix	*pr_next;	/* Next prefix for this physical */
1577c478bd9Sstevel@tonic-gate 	struct prefix	*pr_prev;	/* Prev prefix for this physical */
1587c478bd9Sstevel@tonic-gate 	struct phyint	*pr_physical;	/* Back pointer */
1597c478bd9Sstevel@tonic-gate 
1607c478bd9Sstevel@tonic-gate 	struct in6_addr	pr_prefix;	/* Used to indentify prefix */
1617c478bd9Sstevel@tonic-gate 	uint_t		pr_prefix_len;	/* Num bits valid */
1627c478bd9Sstevel@tonic-gate 
1637c478bd9Sstevel@tonic-gate 	char		pr_name[LIFNAMSIZ];
1647c478bd9Sstevel@tonic-gate 	struct in6_addr	pr_address;
1657c478bd9Sstevel@tonic-gate 	uint64_t	pr_flags;	/* IFF_* flags */
1667c478bd9Sstevel@tonic-gate 
1677c478bd9Sstevel@tonic-gate 	uint_t		pr_state;	/* PR_ONLINK | PR_AUTO etc */
1687c478bd9Sstevel@tonic-gate 	uint_t		pr_kernel_state; /* PR_ONLINK | PR_AUTO etc */
1697c478bd9Sstevel@tonic-gate 	boolean_t	pr_in_use;	/* To detect removed prefixes */
1707c478bd9Sstevel@tonic-gate 
1717c478bd9Sstevel@tonic-gate 	/* Recorded variables on node/host */
1727c478bd9Sstevel@tonic-gate 	uint_t		pr_ValidLifetime;	/* In ms w/ 2 hour rule */
1737c478bd9Sstevel@tonic-gate 	uint_t		pr_PreferredLifetime;	/* In millseconds */
1747c478bd9Sstevel@tonic-gate 	uint_t		pr_OnLinkLifetime;	/* ms valid w/o 2 hour rule */
1757c478bd9Sstevel@tonic-gate 	boolean_t	pr_OnLinkFlag;
1767c478bd9Sstevel@tonic-gate 	boolean_t	pr_AutonomousFlag;
1777c478bd9Sstevel@tonic-gate 
1787c478bd9Sstevel@tonic-gate 	uint_t		pr_CreateTime;		/* tmpaddr creation time */
1797c478bd9Sstevel@tonic-gate 						/* in SECONDS */
18069bb4bb4Scarlsonj 	uint_t		pr_attempts;	/* attempts to configure */
1817c478bd9Sstevel@tonic-gate };
1827c478bd9Sstevel@tonic-gate 
1837c478bd9Sstevel@tonic-gate /*
1847c478bd9Sstevel@tonic-gate  * Flags used for pr_kernel_state and pr_state where the latter is
1857c478bd9Sstevel@tonic-gate  * user-level state.
1867c478bd9Sstevel@tonic-gate  */
1877c478bd9Sstevel@tonic-gate #define	PR_ONLINK	0x01		/* On-link */
1887c478bd9Sstevel@tonic-gate #define	PR_AUTO		0x02		/* Stateless addrconf */
1897c478bd9Sstevel@tonic-gate #define	PR_DEPRECATED	0x04		/* Address is deprecated */
1907c478bd9Sstevel@tonic-gate #define	PR_STATIC	0x08		/* Not created by ndpd */
1917c478bd9Sstevel@tonic-gate 
1927c478bd9Sstevel@tonic-gate /*
1937c478bd9Sstevel@tonic-gate  * The sum of all possible state string lengths, plus terminating
1947c478bd9Sstevel@tonic-gate  * null character; if new states are added, this needs to be updated.
1957c478bd9Sstevel@tonic-gate  * Useful for passing an appropriately sized buffer to prefix_print_state().
1967c478bd9Sstevel@tonic-gate  *
1977c478bd9Sstevel@tonic-gate  * Current strings: "ONLINK ", "AUTO ", "DEPRECATED ", "STATIC ", "\n"
1987c478bd9Sstevel@tonic-gate  *                      7     +   5    +     11       +    7     +  1
1997c478bd9Sstevel@tonic-gate  */
2007c478bd9Sstevel@tonic-gate #define	PREFIX_STATESTRLEN	31
2017c478bd9Sstevel@tonic-gate 
2027c478bd9Sstevel@tonic-gate /* Prefix used for storing advertisement specific stuff */
2037c478bd9Sstevel@tonic-gate struct adv_prefix {
2047c478bd9Sstevel@tonic-gate 	struct adv_prefix	*adv_pr_next;	/* Next prefix */
2057c478bd9Sstevel@tonic-gate 	struct adv_prefix	*adv_pr_prev;	/* Prev prefix */
2067c478bd9Sstevel@tonic-gate 	struct phyint		*adv_pr_physical;	/* Back pointer */
2077c478bd9Sstevel@tonic-gate 
2087c478bd9Sstevel@tonic-gate 	struct in6_addr		adv_pr_prefix;	/* Used to indentify prefix */
2097c478bd9Sstevel@tonic-gate 	uint_t			adv_pr_prefix_len;	/* Num bits valid */
2107c478bd9Sstevel@tonic-gate 
2117c478bd9Sstevel@tonic-gate 	/* Used when sending advertisements */
2127c478bd9Sstevel@tonic-gate 	struct confvar		adv_pr_config[I_PREFIXSIZE];
2137c478bd9Sstevel@tonic-gate #define	adv_pr_AdvValidLifetime	adv_pr_config[I_AdvValidLifetime].cf_value
2147c478bd9Sstevel@tonic-gate #define	adv_pr_AdvOnLinkFlag	adv_pr_config[I_AdvOnLinkFlag].cf_value
2157c478bd9Sstevel@tonic-gate #define	adv_pr_AdvPreferredLifetime	\
2167c478bd9Sstevel@tonic-gate 			adv_pr_config[I_AdvPreferredLifetime].cf_value
2177c478bd9Sstevel@tonic-gate #define	adv_pr_AdvAutonomousFlag	\
2187c478bd9Sstevel@tonic-gate 			adv_pr_config[I_AdvAutonomousFlag].cf_value
2197c478bd9Sstevel@tonic-gate #define	adv_pr_AdvValidExpiration	\
2207c478bd9Sstevel@tonic-gate 			adv_pr_config[I_AdvValidExpiration].cf_value
2217c478bd9Sstevel@tonic-gate #define	adv_pr_AdvPreferredExpiration	\
2227c478bd9Sstevel@tonic-gate 			adv_pr_config[I_AdvPreferredExpiration].cf_value
2237c478bd9Sstevel@tonic-gate 	/* The two below are set if the timers decrement in real time */
2247c478bd9Sstevel@tonic-gate #define	adv_pr_AdvValidRealTime		\
2257c478bd9Sstevel@tonic-gate 			adv_pr_config[I_AdvValidExpiration].cf_notdefault
2267c478bd9Sstevel@tonic-gate #define	adv_pr_AdvPreferredRealTime	\
2277c478bd9Sstevel@tonic-gate 			adv_pr_config[I_AdvPreferredExpiration].cf_notdefault
2287c478bd9Sstevel@tonic-gate };
2297c478bd9Sstevel@tonic-gate 
2307c478bd9Sstevel@tonic-gate /*
2317c478bd9Sstevel@tonic-gate  * Doubly-linked list of default routers on a phyint.
2327c478bd9Sstevel@tonic-gate  */
2337c478bd9Sstevel@tonic-gate struct router {
2347c478bd9Sstevel@tonic-gate 	struct router	*dr_next;	/* Next router for this physical */
2357c478bd9Sstevel@tonic-gate 	struct router	*dr_prev;	/* Prev router for this physical */
2367c478bd9Sstevel@tonic-gate 	struct phyint	*dr_physical;	/* Back pointer */
2377c478bd9Sstevel@tonic-gate 
2387c478bd9Sstevel@tonic-gate 	struct in6_addr	dr_address;	/* Used to identify the router */
2397c478bd9Sstevel@tonic-gate 	uint_t		dr_lifetime;	/* In milliseconds */
2407c478bd9Sstevel@tonic-gate 	boolean_t	dr_inkernel;	/* Route added to kernel */
2417c478bd9Sstevel@tonic-gate };
2427c478bd9Sstevel@tonic-gate 
2437c478bd9Sstevel@tonic-gate /*
2447c478bd9Sstevel@tonic-gate  * Globals
2457c478bd9Sstevel@tonic-gate  */
2467c478bd9Sstevel@tonic-gate extern struct phyint *phyints;
2473173664eSapersson extern int num_of_phyints;
2487c478bd9Sstevel@tonic-gate 
2497c478bd9Sstevel@tonic-gate /*
2507c478bd9Sstevel@tonic-gate  * Functions
2517c478bd9Sstevel@tonic-gate  */
2527c478bd9Sstevel@tonic-gate extern uint_t		getcurrenttime(void);
2537c478bd9Sstevel@tonic-gate 
2547c478bd9Sstevel@tonic-gate extern struct phyint	*phyint_lookup(char *name);
2557c478bd9Sstevel@tonic-gate extern struct phyint	*phyint_lookup_on_index(uint_t ifindex);
2567c478bd9Sstevel@tonic-gate extern struct phyint	*phyint_create(char *name);
2577c478bd9Sstevel@tonic-gate extern int		phyint_init_from_k(struct phyint *pi);
2587c478bd9Sstevel@tonic-gate extern void		phyint_delete(struct phyint *pi);
2597c478bd9Sstevel@tonic-gate extern uint_t		phyint_timer(struct phyint *pi, uint_t elapsed);
2607c478bd9Sstevel@tonic-gate extern void		phyint_print_all(void);
261e11c3f44Smeem extern int		phyint_get_lla(struct phyint *pi, struct lifreq *lifrp);
2627c478bd9Sstevel@tonic-gate extern void		phyint_reach_random(struct phyint *pi,
2637c478bd9Sstevel@tonic-gate 			    boolean_t set_needed);
2647c478bd9Sstevel@tonic-gate extern void		phyint_cleanup(struct phyint *pi);
2657c478bd9Sstevel@tonic-gate 
2667c478bd9Sstevel@tonic-gate extern boolean_t	tmptoken_create(struct phyint *pi);
2677c478bd9Sstevel@tonic-gate extern void		tmptoken_delete(struct phyint *pi);
2687c478bd9Sstevel@tonic-gate extern uint_t		tmptoken_timer(struct phyint *pi, uint_t elapsed);
2697c478bd9Sstevel@tonic-gate extern boolean_t	token_equal(struct in6_addr t1, struct in6_addr t2,
2707c478bd9Sstevel@tonic-gate 			    int bits);
2717c478bd9Sstevel@tonic-gate 
2727c478bd9Sstevel@tonic-gate extern struct prefix	*prefix_create(struct phyint *pi, struct in6_addr addr,
2737c478bd9Sstevel@tonic-gate 			    int addrlen, uint64_t flags);
2747c478bd9Sstevel@tonic-gate extern struct prefix	*prefix_lookup_name(struct phyint *pi, char *name);
2757c478bd9Sstevel@tonic-gate extern struct prefix	*prefix_lookup_addr_match(struct prefix *pr);
2767c478bd9Sstevel@tonic-gate extern struct prefix	*prefix_create_name(struct phyint *pi, char *name);
2777c478bd9Sstevel@tonic-gate extern int		prefix_init_from_k(struct prefix *pr);
2787c478bd9Sstevel@tonic-gate extern void		prefix_delete(struct prefix *pr);
2797c478bd9Sstevel@tonic-gate extern boolean_t	prefix_equal(struct in6_addr p1, struct in6_addr p2,
2807c478bd9Sstevel@tonic-gate 			    int bits);
281d04ccbb3Scarlsonj extern void		prefix_update_dhcp(struct prefix *pr);
2827c478bd9Sstevel@tonic-gate extern void		prefix_update_k(struct prefix *pr);
2837c478bd9Sstevel@tonic-gate extern uint_t		prefix_timer(struct prefix *pr, uint_t elapsed);
2847c478bd9Sstevel@tonic-gate extern uint_t		adv_prefix_timer(struct adv_prefix *adv_pr,
2857c478bd9Sstevel@tonic-gate 			    uint_t elapsed);
2867c478bd9Sstevel@tonic-gate extern struct prefix	*prefix_lookup_addr(struct phyint *pi,
2877c478bd9Sstevel@tonic-gate 			    struct in6_addr prefix);
2887c478bd9Sstevel@tonic-gate 
2897c478bd9Sstevel@tonic-gate extern struct adv_prefix *adv_prefix_lookup(struct phyint *pi,
2907c478bd9Sstevel@tonic-gate 			    struct in6_addr addr, int addrlen);
2917c478bd9Sstevel@tonic-gate extern struct adv_prefix *adv_prefix_create(struct phyint *pi,
2927c478bd9Sstevel@tonic-gate 			    struct in6_addr addr, int addrlen);
2937c478bd9Sstevel@tonic-gate 
2947c478bd9Sstevel@tonic-gate extern struct router	*router_lookup(struct phyint *pi, struct in6_addr addr);
2957c478bd9Sstevel@tonic-gate extern struct router	*router_create(struct phyint *pi, struct in6_addr addr,
2967c478bd9Sstevel@tonic-gate 			    uint_t lifetime);
2977c478bd9Sstevel@tonic-gate extern void		router_update_k(struct router *dr);
2987c478bd9Sstevel@tonic-gate extern uint_t		router_timer(struct router *dr, uint_t elapsed);
2997c478bd9Sstevel@tonic-gate 
3007c478bd9Sstevel@tonic-gate extern void	check_to_advertise(struct phyint *pi, enum adv_events event);
3017c478bd9Sstevel@tonic-gate extern void	check_to_solicit(struct phyint *pi,
3027c478bd9Sstevel@tonic-gate 		    enum solicit_events event);
3037c478bd9Sstevel@tonic-gate extern uint_t	advertise_event(struct phyint *pi, enum adv_events event,
3047c478bd9Sstevel@tonic-gate 		    uint_t elapsed);
3057c478bd9Sstevel@tonic-gate extern uint_t	solicit_event(struct phyint *pi, enum solicit_events event,
3067c478bd9Sstevel@tonic-gate 		    uint_t elapsed);
3077c478bd9Sstevel@tonic-gate 
3087c478bd9Sstevel@tonic-gate extern void	print_route_sol(char *str, struct phyint *pi,
3097c478bd9Sstevel@tonic-gate 		    struct nd_router_solicit *rs, int len,
3107c478bd9Sstevel@tonic-gate 		    struct sockaddr_in6 *addr);
3117c478bd9Sstevel@tonic-gate extern void	print_route_adv(char *str, struct phyint *pi,
3127c478bd9Sstevel@tonic-gate 		    struct nd_router_advert *ra, int len,
3137c478bd9Sstevel@tonic-gate 		    struct sockaddr_in6 *addr);
3147c478bd9Sstevel@tonic-gate extern void	print_iflist(struct confvar *confvar);
3157c478bd9Sstevel@tonic-gate extern void	print_prefixlist(struct confvar *confvar);
3167c478bd9Sstevel@tonic-gate 
3177c478bd9Sstevel@tonic-gate extern void	in_data(struct phyint *pi);
3187c478bd9Sstevel@tonic-gate 
319d04ccbb3Scarlsonj extern void	start_dhcp(struct phyint *pi);
320*6e91bba0SGirish Moodalbail extern void	release_dhcp(struct phyint *pi);
321d04ccbb3Scarlsonj 
3227c478bd9Sstevel@tonic-gate extern void	incoming_ra(struct phyint *pi, struct nd_router_advert *ra,
3237c478bd9Sstevel@tonic-gate 		    int len, struct sockaddr_in6 *from, boolean_t loopback);
3247c478bd9Sstevel@tonic-gate 
3257c478bd9Sstevel@tonic-gate extern boolean_t incoming_prefix_addrconf_process(struct phyint *pi,
3267c478bd9Sstevel@tonic-gate 		    struct prefix *pr, uchar_t *opt,
3277c478bd9Sstevel@tonic-gate 		    struct sockaddr_in6 *from, boolean_t loopback,
3287c478bd9Sstevel@tonic-gate 		    boolean_t new_prefix);
3297c478bd9Sstevel@tonic-gate 
3307c478bd9Sstevel@tonic-gate extern void	incoming_prefix_onlink_process(struct prefix *pr,
3317c478bd9Sstevel@tonic-gate 		    uchar_t *opt);
3327c478bd9Sstevel@tonic-gate 
333*6e91bba0SGirish Moodalbail extern void	check_autoconf_var_consistency(struct phyint *, boolean_t,
334*6e91bba0SGirish Moodalbail     boolean_t);
335*6e91bba0SGirish Moodalbail extern void	prefix_update_ipadm_addrobj(struct prefix *pr, boolean_t add);
3367c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3377c478bd9Sstevel@tonic-gate }
3387c478bd9Sstevel@tonic-gate #endif
3397c478bd9Sstevel@tonic-gate 
3407c478bd9Sstevel@tonic-gate #endif	/* _NDPD_TABLES_H */
341