xref: /illumos-gate/usr/src/uts/common/inet/ip_ire.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1990 Mentat Inc. */
27*7c478bd9Sstevel@tonic-gate 
28*7c478bd9Sstevel@tonic-gate #ifndef	_INET_IP_IRE_H
29*7c478bd9Sstevel@tonic-gate #define	_INET_IP_IRE_H
30*7c478bd9Sstevel@tonic-gate 
31*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
32*7c478bd9Sstevel@tonic-gate 
33*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
34*7c478bd9Sstevel@tonic-gate extern "C" {
35*7c478bd9Sstevel@tonic-gate #endif
36*7c478bd9Sstevel@tonic-gate 
37*7c478bd9Sstevel@tonic-gate #define	IPV6_LL_PREFIXLEN	10	/* Number of bits in link-local pref */
38*7c478bd9Sstevel@tonic-gate 
39*7c478bd9Sstevel@tonic-gate #define	IP_FTABLE_HASH_SIZE	32	/* size of each hash table in ptrs */
40*7c478bd9Sstevel@tonic-gate #define	IP_CACHE_TABLE_SIZE	256
41*7c478bd9Sstevel@tonic-gate #define	IP_MRTUN_TABLE_SIZE	256	/* Mobile IP reverse tunnel table */
42*7c478bd9Sstevel@tonic-gate 					/* size. Only used by mipagent */
43*7c478bd9Sstevel@tonic-gate #define	IP_SRCIF_TABLE_SIZE	256	/* Per interface routing table size */
44*7c478bd9Sstevel@tonic-gate #define	IP_MASK_TABLE_SIZE	(IP_ABITS + 1)		/* 33 ptrs */
45*7c478bd9Sstevel@tonic-gate 
46*7c478bd9Sstevel@tonic-gate #define	IP6_FTABLE_HASH_SIZE	32	/* size of each hash table in ptrs */
47*7c478bd9Sstevel@tonic-gate #define	IP6_CACHE_TABLE_SIZE	256
48*7c478bd9Sstevel@tonic-gate #define	IP6_MASK_TABLE_SIZE	(IPV6_ABITS + 1)	/* 129 ptrs */
49*7c478bd9Sstevel@tonic-gate 
50*7c478bd9Sstevel@tonic-gate /*
51*7c478bd9Sstevel@tonic-gate  * We use the common modulo hash function.  In ip_ire_init(), we make
52*7c478bd9Sstevel@tonic-gate  * sure that the cache table size is always a power of 2.  That's why
53*7c478bd9Sstevel@tonic-gate  * we can use & instead of %.  Also note that we try hard to make sure
54*7c478bd9Sstevel@tonic-gate  * the lower bits of an address capture most info from the whole address.
55*7c478bd9Sstevel@tonic-gate  * The reason being that since our hash table is probably a lot smaller
56*7c478bd9Sstevel@tonic-gate  * than 2^32 buckets so the lower bits are the most important.
57*7c478bd9Sstevel@tonic-gate  */
58*7c478bd9Sstevel@tonic-gate #define	IRE_ADDR_HASH(addr, table_size) \
59*7c478bd9Sstevel@tonic-gate 	(((addr) ^ ((addr) >> 8) ^ ((addr) >> 16) ^ ((addr) >> 24)) &	\
60*7c478bd9Sstevel@tonic-gate 	((table_size) - 1))
61*7c478bd9Sstevel@tonic-gate 
62*7c478bd9Sstevel@tonic-gate /*
63*7c478bd9Sstevel@tonic-gate  * Exclusive-or those bytes that are likely to contain the MAC
64*7c478bd9Sstevel@tonic-gate  * address.  Assumes EUI-64 format for good hashing.
65*7c478bd9Sstevel@tonic-gate  */
66*7c478bd9Sstevel@tonic-gate #define	IRE_ADDR_HASH_V6(addr, table_size) 				\
67*7c478bd9Sstevel@tonic-gate 	(((addr).s6_addr32[3] ^						\
68*7c478bd9Sstevel@tonic-gate 	(((addr).s6_addr32[3] ^ (addr).s6_addr32[2]) >> 12)) &		\
69*7c478bd9Sstevel@tonic-gate 	((table_size) - 1))
70*7c478bd9Sstevel@tonic-gate /* This assumes that the ftable size is a power of 2. */
71*7c478bd9Sstevel@tonic-gate #define	IRE_ADDR_MASK_HASH_V6(addr, mask, table_size) 			\
72*7c478bd9Sstevel@tonic-gate 	((((addr).s6_addr8[8] & (mask).s6_addr8[8]) ^ 			\
73*7c478bd9Sstevel@tonic-gate 	((addr).s6_addr8[9] & (mask).s6_addr8[9]) ^			\
74*7c478bd9Sstevel@tonic-gate 	((addr).s6_addr8[10] & (mask).s6_addr8[10]) ^ 			\
75*7c478bd9Sstevel@tonic-gate 	((addr).s6_addr8[13] & (mask).s6_addr8[13]) ^ 			\
76*7c478bd9Sstevel@tonic-gate 	((addr).s6_addr8[14] & (mask).s6_addr8[14]) ^ 			\
77*7c478bd9Sstevel@tonic-gate 	((addr).s6_addr8[15] & (mask).s6_addr8[15])) & ((table_size) - 1))
78*7c478bd9Sstevel@tonic-gate 
79*7c478bd9Sstevel@tonic-gate /*
80*7c478bd9Sstevel@tonic-gate  * match parameter definitions for
81*7c478bd9Sstevel@tonic-gate  * IRE lookup routines.
82*7c478bd9Sstevel@tonic-gate  */
83*7c478bd9Sstevel@tonic-gate #define	MATCH_IRE_DSTONLY	0x0000	/* Match just the address */
84*7c478bd9Sstevel@tonic-gate #define	MATCH_IRE_TYPE		0x0001	/* Match IRE type */
85*7c478bd9Sstevel@tonic-gate #define	MATCH_IRE_SRC		0x0002	/* Match IRE source address */
86*7c478bd9Sstevel@tonic-gate #define	MATCH_IRE_MASK		0x0004	/* Match IRE mask */
87*7c478bd9Sstevel@tonic-gate #define	MATCH_IRE_WQ		0x0008	/* Match IRE Write Q */
88*7c478bd9Sstevel@tonic-gate #define	MATCH_IRE_GW		0x0010	/* Match IRE gateway */
89*7c478bd9Sstevel@tonic-gate #define	MATCH_IRE_IPIF		0x0020	/* Match IRE ipif */
90*7c478bd9Sstevel@tonic-gate #define	MATCH_IRE_RECURSIVE	0x0040	/* Do recursive lookup if necessary */
91*7c478bd9Sstevel@tonic-gate #define	MATCH_IRE_DEFAULT	0x0080	/* Return default route if no route */
92*7c478bd9Sstevel@tonic-gate 					/* found. */
93*7c478bd9Sstevel@tonic-gate #define	MATCH_IRE_RJ_BHOLE	0x0100	/* During lookup if we hit an ire */
94*7c478bd9Sstevel@tonic-gate 					/* with RTF_REJECT or RTF_BLACKHOLE, */
95*7c478bd9Sstevel@tonic-gate 					/* return the ire. No recursive */
96*7c478bd9Sstevel@tonic-gate 					/* lookup should be done. */
97*7c478bd9Sstevel@tonic-gate #define	MATCH_IRE_IHANDLE	0x0200	/* Match IRE on ihandle */
98*7c478bd9Sstevel@tonic-gate #define	MATCH_IRE_MARK_HIDDEN	0x0400	/* Match IRE ire_marks with */
99*7c478bd9Sstevel@tonic-gate 					/* IRE_MARK_HIDDEN. */
100*7c478bd9Sstevel@tonic-gate /*
101*7c478bd9Sstevel@tonic-gate  * MATCH_IRE_ILL is used whenever we want to specifically match an IRE
102*7c478bd9Sstevel@tonic-gate  * whose ire_ipif->ipif_ill or (ill_t *)ire_stq->q_ptr matches a given
103*7c478bd9Sstevel@tonic-gate  * ill. When MATCH_IRE_ILL is used to locate an IRE_CACHE, it implies
104*7c478bd9Sstevel@tonic-gate  * that the packet will not be load balanced. This is normally used
105*7c478bd9Sstevel@tonic-gate  * by in.mpathd to send out failure detection probes.
106*7c478bd9Sstevel@tonic-gate  *
107*7c478bd9Sstevel@tonic-gate  * MATCH_IRE_ILL_GROUP is used whenever we are not specific about which
108*7c478bd9Sstevel@tonic-gate  * interface (ill) the packet should be sent out. This implies that the
109*7c478bd9Sstevel@tonic-gate  * packets will be subjected to load balancing and it might go out on
110*7c478bd9Sstevel@tonic-gate  * any interface in the group. When there is only interface in the group,
111*7c478bd9Sstevel@tonic-gate  * MATCH_IRE_ILL_GROUP becomes MATCH_IRE_ILL. Most of the code uses
112*7c478bd9Sstevel@tonic-gate  * MATCH_IRE_ILL_GROUP and MATCH_IRE_ILL is used in very few cases where
113*7c478bd9Sstevel@tonic-gate  * we want to disable load balancing.
114*7c478bd9Sstevel@tonic-gate  *
115*7c478bd9Sstevel@tonic-gate  * MATCH_IRE_PARENT is used whenever we unconditionally want to get the
116*7c478bd9Sstevel@tonic-gate  * parent IRE (sire) while recursively searching IREs for an offsubnet
117*7c478bd9Sstevel@tonic-gate  * destination. With this flag, even if no IRE_CACHETABLE or IRE_INTERFACE
118*7c478bd9Sstevel@tonic-gate  * is found to help resolving IRE_OFFSUBNET in lookup routines, the
119*7c478bd9Sstevel@tonic-gate  * IRE_OFFSUBNET sire, if any, is returned to the caller.
120*7c478bd9Sstevel@tonic-gate  */
121*7c478bd9Sstevel@tonic-gate #define	MATCH_IRE_ILL_GROUP	0x0800	/* Match IRE on ill or the ill_group. */
122*7c478bd9Sstevel@tonic-gate #define	MATCH_IRE_ILL		0x1000	/* Match IRE on the ill only */
123*7c478bd9Sstevel@tonic-gate 
124*7c478bd9Sstevel@tonic-gate #define	MATCH_IRE_PARENT	0x2000	/* Match parent ire, if any, */
125*7c478bd9Sstevel@tonic-gate 					/* even if ire is not matched. */
126*7c478bd9Sstevel@tonic-gate #define	MATCH_IRE_ZONEONLY	0x4000	/* Match IREs in specified zone, ie */
127*7c478bd9Sstevel@tonic-gate 					/* don't match IRE_LOCALs from other */
128*7c478bd9Sstevel@tonic-gate 					/* zones or shared IREs */
129*7c478bd9Sstevel@tonic-gate 
130*7c478bd9Sstevel@tonic-gate /* Structure for ire_cache_count() */
131*7c478bd9Sstevel@tonic-gate typedef struct {
132*7c478bd9Sstevel@tonic-gate 	int	icc_total;	/* Total number of IRE_CACHE */
133*7c478bd9Sstevel@tonic-gate 	int	icc_unused;	/* # off/no PMTU unused since last reclaim */
134*7c478bd9Sstevel@tonic-gate 	int	icc_offlink;	/* # offlink without PMTU information */
135*7c478bd9Sstevel@tonic-gate 	int	icc_pmtu;	/* # offlink with PMTU information */
136*7c478bd9Sstevel@tonic-gate 	int	icc_onlink;	/* # onlink */
137*7c478bd9Sstevel@tonic-gate } ire_cache_count_t;
138*7c478bd9Sstevel@tonic-gate 
139*7c478bd9Sstevel@tonic-gate /*
140*7c478bd9Sstevel@tonic-gate  * Structure for ire_cache_reclaim(). Each field is a fraction i.e. 1 meaning
141*7c478bd9Sstevel@tonic-gate  * reclaim all, N meaning reclaim 1/Nth of all entries, 0 meaning reclaim none.
142*7c478bd9Sstevel@tonic-gate  */
143*7c478bd9Sstevel@tonic-gate typedef struct {
144*7c478bd9Sstevel@tonic-gate 	int	icr_unused;	/* Fraction for unused since last reclaim */
145*7c478bd9Sstevel@tonic-gate 	int	icr_offlink;	/* Fraction for offlink without PMTU info */
146*7c478bd9Sstevel@tonic-gate 	int	icr_pmtu;	/* Fraction for offlink with PMTU info */
147*7c478bd9Sstevel@tonic-gate 	int	icr_onlink;	/* Fraction for onlink */
148*7c478bd9Sstevel@tonic-gate } ire_cache_reclaim_t;
149*7c478bd9Sstevel@tonic-gate 
150*7c478bd9Sstevel@tonic-gate typedef struct {
151*7c478bd9Sstevel@tonic-gate 	uint64_t ire_stats_alloced;	/* # of ires alloced */
152*7c478bd9Sstevel@tonic-gate 	uint64_t ire_stats_freed;	/* # of ires freed */
153*7c478bd9Sstevel@tonic-gate 	uint64_t ire_stats_inserted;	/* # of ires inserted in the bucket */
154*7c478bd9Sstevel@tonic-gate 	uint64_t ire_stats_deleted;	/* # of ires deleted from the bucket */
155*7c478bd9Sstevel@tonic-gate } ire_stats_t;
156*7c478bd9Sstevel@tonic-gate 
157*7c478bd9Sstevel@tonic-gate extern ire_stats_t ire_stats_v4;
158*7c478bd9Sstevel@tonic-gate 
159*7c478bd9Sstevel@tonic-gate /*
160*7c478bd9Sstevel@tonic-gate  * We use atomics so that we get an accurate accounting on the ires.
161*7c478bd9Sstevel@tonic-gate  * Otherwise we can't determine leaks correctly.
162*7c478bd9Sstevel@tonic-gate  */
163*7c478bd9Sstevel@tonic-gate #define	BUMP_IRE_STATS(ire_stats, x) atomic_add_64(&(ire_stats).x, 1)
164*7c478bd9Sstevel@tonic-gate 
165*7c478bd9Sstevel@tonic-gate extern irb_t *ip_forwarding_table_v6[];
166*7c478bd9Sstevel@tonic-gate extern irb_t *ip_cache_table_v6;
167*7c478bd9Sstevel@tonic-gate extern irb_t *ip_mrtun_table;
168*7c478bd9Sstevel@tonic-gate extern irb_t *ip_srcif_table;
169*7c478bd9Sstevel@tonic-gate extern kmutex_t ire_ft_init_lock;
170*7c478bd9Sstevel@tonic-gate extern kmutex_t	ire_mrtun_lock;
171*7c478bd9Sstevel@tonic-gate extern kmutex_t ire_srcif_table_lock;
172*7c478bd9Sstevel@tonic-gate extern ire_stats_t ire_stats_v6;
173*7c478bd9Sstevel@tonic-gate extern uint_t	ire_mrtun_count;
174*7c478bd9Sstevel@tonic-gate extern uint_t ire_srcif_table_count;
175*7c478bd9Sstevel@tonic-gate 
176*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL
177*7c478bd9Sstevel@tonic-gate extern	ipaddr_t	ip_plen_to_mask(uint_t);
178*7c478bd9Sstevel@tonic-gate extern	in6_addr_t	*ip_plen_to_mask_v6(uint_t, in6_addr_t *);
179*7c478bd9Sstevel@tonic-gate 
180*7c478bd9Sstevel@tonic-gate extern	int	ip_ire_advise(queue_t *, mblk_t *, cred_t *);
181*7c478bd9Sstevel@tonic-gate extern	int	ip_ire_delete(queue_t *, mblk_t *, cred_t *);
182*7c478bd9Sstevel@tonic-gate extern	boolean_t ip_ire_clookup_and_delete(ipaddr_t, ipif_t *);
183*7c478bd9Sstevel@tonic-gate extern	void	ip_ire_clookup_and_delete_v6(const in6_addr_t *);
184*7c478bd9Sstevel@tonic-gate 
185*7c478bd9Sstevel@tonic-gate extern	int	ip_ire_report(queue_t *, mblk_t *, caddr_t, cred_t *);
186*7c478bd9Sstevel@tonic-gate extern	int	ip_ire_report_mrtun(queue_t *, mblk_t *, caddr_t, cred_t *);
187*7c478bd9Sstevel@tonic-gate extern	int	ip_ire_report_srcif(queue_t *, mblk_t *, caddr_t, cred_t *);
188*7c478bd9Sstevel@tonic-gate extern	int	ip_ire_report_v6(queue_t *, mblk_t *, caddr_t, cred_t *);
189*7c478bd9Sstevel@tonic-gate 
190*7c478bd9Sstevel@tonic-gate extern	void	ip_ire_req(queue_t *, mblk_t *);
191*7c478bd9Sstevel@tonic-gate 
192*7c478bd9Sstevel@tonic-gate extern	int	ip_mask_to_plen(ipaddr_t);
193*7c478bd9Sstevel@tonic-gate extern	int	ip_mask_to_plen_v6(const in6_addr_t *);
194*7c478bd9Sstevel@tonic-gate 
195*7c478bd9Sstevel@tonic-gate extern	ire_t	*ipif_to_ire(ipif_t *);
196*7c478bd9Sstevel@tonic-gate extern	ire_t	*ipif_to_ire_v6(ipif_t *);
197*7c478bd9Sstevel@tonic-gate 
198*7c478bd9Sstevel@tonic-gate extern	int	ire_add(ire_t **, queue_t *, mblk_t *, ipsq_func_t);
199*7c478bd9Sstevel@tonic-gate extern	int	ire_add_mrtun(ire_t **, queue_t *, mblk_t *, ipsq_func_t);
200*7c478bd9Sstevel@tonic-gate extern	void	ire_add_then_send(queue_t *, ire_t *, mblk_t *);
201*7c478bd9Sstevel@tonic-gate extern	int	ire_add_v6(ire_t **, queue_t *, mblk_t *, ipsq_func_t);
202*7c478bd9Sstevel@tonic-gate extern	int	ire_atomic_start(irb_t *irb_ptr, ire_t *ire, queue_t *q,
203*7c478bd9Sstevel@tonic-gate     mblk_t *mp, ipsq_func_t func);
204*7c478bd9Sstevel@tonic-gate extern	void	ire_atomic_end(irb_t *irb_ptr, ire_t *ire);
205*7c478bd9Sstevel@tonic-gate 
206*7c478bd9Sstevel@tonic-gate extern	void	ire_cache_count(ire_t *, char *);
207*7c478bd9Sstevel@tonic-gate extern	ire_t	*ire_cache_lookup(ipaddr_t, zoneid_t);
208*7c478bd9Sstevel@tonic-gate extern	ire_t	*ire_cache_lookup_v6(const in6_addr_t *, zoneid_t);
209*7c478bd9Sstevel@tonic-gate extern	void	ire_cache_reclaim(ire_t *, char *);
210*7c478bd9Sstevel@tonic-gate 
211*7c478bd9Sstevel@tonic-gate extern	void	ire_check_bcast_present(ipif_t *, ipaddr_t, int, boolean_t *,
212*7c478bd9Sstevel@tonic-gate     boolean_t *);
213*7c478bd9Sstevel@tonic-gate extern	ire_t	*ire_create_mp(uchar_t *, uchar_t *, uchar_t *, uchar_t *,
214*7c478bd9Sstevel@tonic-gate     uchar_t *, uint_t, mblk_t *, queue_t *, queue_t *, ushort_t, mblk_t *,
215*7c478bd9Sstevel@tonic-gate     ipif_t *, ill_t *, ipaddr_t, uint32_t, uint32_t, uint32_t, const iulp_t *);
216*7c478bd9Sstevel@tonic-gate 
217*7c478bd9Sstevel@tonic-gate extern	ire_t	*ire_create(uchar_t *, uchar_t *, uchar_t *, uchar_t *,
218*7c478bd9Sstevel@tonic-gate     uchar_t *, uint_t *, mblk_t *, queue_t *, queue_t *, ushort_t, mblk_t *,
219*7c478bd9Sstevel@tonic-gate     ipif_t *, ill_t *, ipaddr_t, uint32_t, uint32_t, uint32_t, const iulp_t *);
220*7c478bd9Sstevel@tonic-gate 
221*7c478bd9Sstevel@tonic-gate extern	ire_t	**ire_check_and_create_bcast(ipif_t *, ipaddr_t,
222*7c478bd9Sstevel@tonic-gate     ire_t **, int);
223*7c478bd9Sstevel@tonic-gate extern	ire_t	**ire_create_bcast(ipif_t *, ipaddr_t, ire_t **);
224*7c478bd9Sstevel@tonic-gate extern	ire_t	*ire_init(ire_t *, uchar_t *, uchar_t *, uchar_t *,
225*7c478bd9Sstevel@tonic-gate     uchar_t *, uchar_t *, uint_t *, mblk_t *, queue_t *, queue_t *, ushort_t,
226*7c478bd9Sstevel@tonic-gate     mblk_t *, ipif_t *, ill_t *, ipaddr_t, uint32_t, uint32_t, uint32_t,
227*7c478bd9Sstevel@tonic-gate     const iulp_t *);
228*7c478bd9Sstevel@tonic-gate 
229*7c478bd9Sstevel@tonic-gate extern	void	ire_init_common(ire_t *, uint_t *, mblk_t *, queue_t *,
230*7c478bd9Sstevel@tonic-gate     queue_t *, ushort_t, mblk_t *, ipif_t *, ill_t *, uint32_t,
231*7c478bd9Sstevel@tonic-gate     uint32_t, uint32_t, uchar_t, const iulp_t *);
232*7c478bd9Sstevel@tonic-gate 
233*7c478bd9Sstevel@tonic-gate extern	ire_t	*ire_create_v6(const in6_addr_t *, const in6_addr_t *,
234*7c478bd9Sstevel@tonic-gate     const in6_addr_t *, const in6_addr_t *, uint_t *, mblk_t *, queue_t *,
235*7c478bd9Sstevel@tonic-gate     queue_t *, ushort_t, mblk_t *, ipif_t *,
236*7c478bd9Sstevel@tonic-gate     const in6_addr_t *, uint32_t, uint32_t, uint_t, const iulp_t *);
237*7c478bd9Sstevel@tonic-gate 
238*7c478bd9Sstevel@tonic-gate extern	ire_t	*ire_create_mp_v6(const in6_addr_t *, const in6_addr_t *,
239*7c478bd9Sstevel@tonic-gate     const in6_addr_t *, const in6_addr_t *, mblk_t *, queue_t *,
240*7c478bd9Sstevel@tonic-gate     queue_t *, ushort_t, mblk_t *, ipif_t *,
241*7c478bd9Sstevel@tonic-gate     const in6_addr_t *, uint32_t, uint32_t, uint_t, const iulp_t *);
242*7c478bd9Sstevel@tonic-gate 
243*7c478bd9Sstevel@tonic-gate extern	ire_t	*ire_init_v6(ire_t *, const in6_addr_t *, const in6_addr_t *,
244*7c478bd9Sstevel@tonic-gate     const in6_addr_t *, const in6_addr_t *, uint_t *, mblk_t *, queue_t *,
245*7c478bd9Sstevel@tonic-gate     queue_t *, ushort_t, mblk_t *, ipif_t *,
246*7c478bd9Sstevel@tonic-gate     const in6_addr_t *, uint32_t, uint32_t, uint_t, const iulp_t *);
247*7c478bd9Sstevel@tonic-gate 
248*7c478bd9Sstevel@tonic-gate extern	ire_t	*ire_ctable_lookup(ipaddr_t, ipaddr_t, int, ipif_t *,
249*7c478bd9Sstevel@tonic-gate     zoneid_t, int);
250*7c478bd9Sstevel@tonic-gate 
251*7c478bd9Sstevel@tonic-gate extern	ire_t	*ire_ctable_lookup_v6(const in6_addr_t *, const in6_addr_t *,
252*7c478bd9Sstevel@tonic-gate     int, ipif_t *, zoneid_t, int);
253*7c478bd9Sstevel@tonic-gate 
254*7c478bd9Sstevel@tonic-gate extern	void	ire_delete(ire_t *);
255*7c478bd9Sstevel@tonic-gate extern	void	ire_delete_cache_gw(ire_t *, char *);
256*7c478bd9Sstevel@tonic-gate extern	void	ire_delete_cache_gw_v6(ire_t *, char *);
257*7c478bd9Sstevel@tonic-gate extern	void	ire_delete_cache_v6(ire_t *, char *);
258*7c478bd9Sstevel@tonic-gate extern	void	ire_delete_srcif(ire_t *);
259*7c478bd9Sstevel@tonic-gate extern	void	ire_delete_v6(ire_t *);
260*7c478bd9Sstevel@tonic-gate 
261*7c478bd9Sstevel@tonic-gate extern	void	ire_expire(ire_t *, char *);
262*7c478bd9Sstevel@tonic-gate extern	void	ire_fastpath_flush(ire_t *, void *);
263*7c478bd9Sstevel@tonic-gate extern	boolean_t ire_fastpath_update(ire_t *, void *);
264*7c478bd9Sstevel@tonic-gate 
265*7c478bd9Sstevel@tonic-gate extern	void	ire_flush_cache_v4(ire_t *, int);
266*7c478bd9Sstevel@tonic-gate extern	void	ire_flush_cache_v6(ire_t *, int);
267*7c478bd9Sstevel@tonic-gate 
268*7c478bd9Sstevel@tonic-gate extern	ire_t	*ire_ftable_lookup(ipaddr_t, ipaddr_t, ipaddr_t, int, ipif_t *,
269*7c478bd9Sstevel@tonic-gate     ire_t **, zoneid_t, uint32_t, int);
270*7c478bd9Sstevel@tonic-gate 
271*7c478bd9Sstevel@tonic-gate extern	ire_t	*ire_ftable_lookup_v6(const in6_addr_t *, const in6_addr_t *,
272*7c478bd9Sstevel@tonic-gate     const in6_addr_t *, int, ipif_t *, ire_t **, zoneid_t, uint32_t, int);
273*7c478bd9Sstevel@tonic-gate 
274*7c478bd9Sstevel@tonic-gate extern	ire_t	*ire_ihandle_lookup_onlink(ire_t *);
275*7c478bd9Sstevel@tonic-gate extern	ire_t	*ire_ihandle_lookup_offlink(ire_t *, ire_t *);
276*7c478bd9Sstevel@tonic-gate extern	ire_t	*ire_ihandle_lookup_offlink_v6(ire_t *, ire_t *);
277*7c478bd9Sstevel@tonic-gate 
278*7c478bd9Sstevel@tonic-gate extern	ire_t 	*ire_lookup_local(zoneid_t);
279*7c478bd9Sstevel@tonic-gate extern	ire_t 	*ire_lookup_local_v6(zoneid_t);
280*7c478bd9Sstevel@tonic-gate 
281*7c478bd9Sstevel@tonic-gate extern  ire_t	*ire_lookup_multi(ipaddr_t, zoneid_t);
282*7c478bd9Sstevel@tonic-gate extern  ire_t	*ire_lookup_multi_v6(const in6_addr_t *, zoneid_t);
283*7c478bd9Sstevel@tonic-gate 
284*7c478bd9Sstevel@tonic-gate extern ire_t	*ire_mrtun_lookup(ipaddr_t, ill_t *);
285*7c478bd9Sstevel@tonic-gate 
286*7c478bd9Sstevel@tonic-gate extern	void	ire_refrele(ire_t *);
287*7c478bd9Sstevel@tonic-gate extern	void	ire_refrele_notr(ire_t *);
288*7c478bd9Sstevel@tonic-gate extern	ire_t	*ire_route_lookup(ipaddr_t, ipaddr_t, ipaddr_t, int, ipif_t *,
289*7c478bd9Sstevel@tonic-gate     ire_t **, zoneid_t, int);
290*7c478bd9Sstevel@tonic-gate 
291*7c478bd9Sstevel@tonic-gate extern	ire_t	*ire_route_lookup_v6(const in6_addr_t *, const in6_addr_t *,
292*7c478bd9Sstevel@tonic-gate     const in6_addr_t *, int, ipif_t *, ire_t **, zoneid_t, int);
293*7c478bd9Sstevel@tonic-gate 
294*7c478bd9Sstevel@tonic-gate extern	ire_t	*ire_srcif_table_lookup(ipaddr_t, int, ipif_t *, ill_t *, int);
295*7c478bd9Sstevel@tonic-gate extern ill_t	*ire_to_ill(ire_t *);
296*7c478bd9Sstevel@tonic-gate 
297*7c478bd9Sstevel@tonic-gate extern	void	ire_walk(pfv_t, char *);
298*7c478bd9Sstevel@tonic-gate extern	void	ire_walk_ill(uint_t, uint_t, pfv_t, char *, ill_t *);
299*7c478bd9Sstevel@tonic-gate extern	void	ire_walk_ill_mrtun(uint_t, uint_t, pfv_t, void *, ill_t *);
300*7c478bd9Sstevel@tonic-gate extern	void	ire_walk_ill_v4(uint_t, uint_t, pfv_t, char *, ill_t *);
301*7c478bd9Sstevel@tonic-gate extern	void	ire_walk_ill_v6(uint_t, uint_t, pfv_t, char *, ill_t *);
302*7c478bd9Sstevel@tonic-gate extern	void	ire_walk_v4(pfv_t, char *, zoneid_t);
303*7c478bd9Sstevel@tonic-gate extern	void	ire_walk_srcif_table_v4(pfv_t, char *);
304*7c478bd9Sstevel@tonic-gate extern	void	ire_walk_v6(pfv_t, char *, zoneid_t);
305*7c478bd9Sstevel@tonic-gate 
306*7c478bd9Sstevel@tonic-gate extern boolean_t	ire_multirt_lookup(ire_t **, ire_t **, uint32_t);
307*7c478bd9Sstevel@tonic-gate extern boolean_t	ire_multirt_need_resolve(ipaddr_t);
308*7c478bd9Sstevel@tonic-gate extern boolean_t	ire_multirt_lookup_v6(ire_t **, ire_t **, uint32_t);
309*7c478bd9Sstevel@tonic-gate extern boolean_t	ire_multirt_need_resolve_v6(const in6_addr_t *);
310*7c478bd9Sstevel@tonic-gate 
311*7c478bd9Sstevel@tonic-gate extern ire_t	*ipif_lookup_multi_ire(ipif_t *, ipaddr_t);
312*7c478bd9Sstevel@tonic-gate extern ire_t	*ipif_lookup_multi_ire_v6(ipif_t *, const in6_addr_t *);
313*7c478bd9Sstevel@tonic-gate 
314*7c478bd9Sstevel@tonic-gate extern void	ire_fastpath_list_dispatch(ill_t *,
315*7c478bd9Sstevel@tonic-gate     boolean_t (*)(ire_t *, void *), void *);
316*7c478bd9Sstevel@tonic-gate extern void	ire_fastpath_list_delete(ill_t *, ire_t *);
317*7c478bd9Sstevel@tonic-gate 
318*7c478bd9Sstevel@tonic-gate extern mblk_t *ip_nexthop_route(const struct sockaddr *, char *);
319*7c478bd9Sstevel@tonic-gate extern mblk_t *ip_nexthop(const struct sockaddr *, const char *);
320*7c478bd9Sstevel@tonic-gate 
321*7c478bd9Sstevel@tonic-gate extern ire_t	*ire_get_next_bcast_ire(ire_t *, ire_t *);
322*7c478bd9Sstevel@tonic-gate extern ire_t	*ire_get_next_default_ire(ire_t *, ire_t *);
323*7c478bd9Sstevel@tonic-gate 
324*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */
325*7c478bd9Sstevel@tonic-gate 
326*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
327*7c478bd9Sstevel@tonic-gate }
328*7c478bd9Sstevel@tonic-gate #endif
329*7c478bd9Sstevel@tonic-gate 
330*7c478bd9Sstevel@tonic-gate #endif	/* _INET_IP_IRE_H */
331