xref: /illumos-gate/usr/src/uts/common/inet/ip_ire.h (revision 1a5e258f)
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
545916cd2Sjpk  * Common Development and Distribution License (the "License").
645916cd2Sjpk  * 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 /*
22fff7ec1dSSowmini Varadhan  * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
237c478bd9Sstevel@tonic-gate  */
247c478bd9Sstevel@tonic-gate /* Copyright (c) 1990 Mentat Inc. */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_INET_IP_IRE_H
277c478bd9Sstevel@tonic-gate #define	_INET_IP_IRE_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
307c478bd9Sstevel@tonic-gate extern "C" {
317c478bd9Sstevel@tonic-gate #endif
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #define	IPV6_LL_PREFIXLEN	10	/* Number of bits in link-local pref */
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #define	IP_CACHE_TABLE_SIZE	256
367c478bd9Sstevel@tonic-gate #define	IP_MASK_TABLE_SIZE	(IP_ABITS + 1)		/* 33 ptrs */
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #define	IP6_FTABLE_HASH_SIZE	32	/* size of each hash table in ptrs */
397c478bd9Sstevel@tonic-gate #define	IP6_CACHE_TABLE_SIZE	256
407c478bd9Sstevel@tonic-gate #define	IP6_MASK_TABLE_SIZE	(IPV6_ABITS + 1)	/* 129 ptrs */
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate /*
437c478bd9Sstevel@tonic-gate  * We use the common modulo hash function.  In ip_ire_init(), we make
447c478bd9Sstevel@tonic-gate  * sure that the cache table size is always a power of 2.  That's why
457c478bd9Sstevel@tonic-gate  * we can use & instead of %.  Also note that we try hard to make sure
467c478bd9Sstevel@tonic-gate  * the lower bits of an address capture most info from the whole address.
477c478bd9Sstevel@tonic-gate  * The reason being that since our hash table is probably a lot smaller
487c478bd9Sstevel@tonic-gate  * than 2^32 buckets so the lower bits are the most important.
497c478bd9Sstevel@tonic-gate  */
507c478bd9Sstevel@tonic-gate #define	IRE_ADDR_HASH(addr, table_size) \
517c478bd9Sstevel@tonic-gate 	(((addr) ^ ((addr) >> 8) ^ ((addr) >> 16) ^ ((addr) >> 24)) &	\
527c478bd9Sstevel@tonic-gate 	((table_size) - 1))
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate /*
55f4b3ec61Sdh  * To make a byte-order neutral hash for IPv6, just take all the
56f4b3ec61Sdh  * bytes in the bottom 32 bits into account.
577c478bd9Sstevel@tonic-gate  */
587c478bd9Sstevel@tonic-gate #define	IRE_ADDR_HASH_V6(addr, table_size) 				\
59f4b3ec61Sdh 	IRE_ADDR_HASH((addr).s6_addr32[3], table_size)
60f4b3ec61Sdh 
61188e1664SErik Nordmark /*
62188e1664SErik Nordmark  * This assumes that the ftable size is a power of 2.
63188e1664SErik Nordmark  * We include some high-order bytes to avoid all IRE_LOCALs in the same
64188e1664SErik Nordmark  * bucket for performance reasons.
65188e1664SErik Nordmark  */
667c478bd9Sstevel@tonic-gate #define	IRE_ADDR_MASK_HASH_V6(addr, mask, table_size) 			\
67188e1664SErik Nordmark 	((((addr).s6_addr8[0] & (mask).s6_addr8[0]) ^ 			\
68188e1664SErik Nordmark 	((addr).s6_addr8[1] & (mask).s6_addr8[1]) ^ 			\
69188e1664SErik Nordmark 	((addr).s6_addr8[6] & (mask).s6_addr8[6]) ^ 			\
70188e1664SErik Nordmark 	((addr).s6_addr8[7] & (mask).s6_addr8[7]) ^ 			\
71188e1664SErik Nordmark 	((addr).s6_addr8[8] & (mask).s6_addr8[8]) ^ 			\
727c478bd9Sstevel@tonic-gate 	((addr).s6_addr8[9] & (mask).s6_addr8[9]) ^			\
737c478bd9Sstevel@tonic-gate 	((addr).s6_addr8[10] & (mask).s6_addr8[10]) ^ 			\
747c478bd9Sstevel@tonic-gate 	((addr).s6_addr8[13] & (mask).s6_addr8[13]) ^ 			\
757c478bd9Sstevel@tonic-gate 	((addr).s6_addr8[14] & (mask).s6_addr8[14]) ^ 			\
767c478bd9Sstevel@tonic-gate 	((addr).s6_addr8[15] & (mask).s6_addr8[15])) & ((table_size) - 1))
777c478bd9Sstevel@tonic-gate 
78bd670b35SErik Nordmark #define	IRE_HIDDEN_TYPE(ire_type) ((ire_type) &			\
79bd670b35SErik Nordmark 	(IRE_HOST | IRE_PREFIX | IRE_DEFAULT | IRE_IF_ALL | IRE_BROADCAST))
80bd670b35SErik Nordmark 
817c478bd9Sstevel@tonic-gate /*
8298e93c29Smeem  * match parameter definitions for IRE lookup routines.
837c478bd9Sstevel@tonic-gate  */
847c478bd9Sstevel@tonic-gate #define	MATCH_IRE_DSTONLY	0x0000	/* Match just the address */
857c478bd9Sstevel@tonic-gate #define	MATCH_IRE_TYPE		0x0001	/* Match IRE type */
86bd670b35SErik Nordmark #define	MATCH_IRE_MASK		0x0002	/* Match IRE mask */
87bd670b35SErik Nordmark #define	MATCH_IRE_SHORTERMASK	0x0004	/* A mask shorter than the argument */
88bd670b35SErik Nordmark #define	MATCH_IRE_GW		0x0008	/* Match IRE gateway */
89bd670b35SErik Nordmark #define	MATCH_IRE_ILL		0x0010	/* Match IRE on the ill */
90bd670b35SErik Nordmark #define	MATCH_IRE_ZONEONLY	0x0020	/* Match IREs in specified zone, ie */
917c478bd9Sstevel@tonic-gate 					/* don't match IRE_LOCALs from other */
927c478bd9Sstevel@tonic-gate 					/* zones or shared IREs */
93bd670b35SErik Nordmark #define	MATCH_IRE_SECATTR	0x0040	/* Match gateway security attributes */
94bd670b35SErik Nordmark #define	MATCH_IRE_TESTHIDDEN 	0x0080	/* Match ire_testhidden IREs */
9544b099c4SSowmini Varadhan #define	MATCH_IRE_SRC_ILL	0x0100	/* ire_ill uses a src address on ill */
9601685f97SSowmini Varadhan #define	MATCH_IRE_DIRECT	0x0200	/* Don't match indirect routes */
97c793af95Ssangeeta 
98bd670b35SErik Nordmark #define	MAX_IRE_RECURSION	4	/* Max IREs in ire_route_recursive */
990ad1ccddSsowmini 
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate /*
1027c478bd9Sstevel@tonic-gate  * We use atomics so that we get an accurate accounting on the ires.
1037c478bd9Sstevel@tonic-gate  * Otherwise we can't determine leaks correctly.
1047c478bd9Sstevel@tonic-gate  */
105*1a5e258fSJosef 'Jeff' Sipek #define	BUMP_IRE_STATS(ire_stats, x) atomic_inc_64(&(ire_stats).x)
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate #ifdef _KERNEL
10845916cd2Sjpk struct ts_label_s;
10954da8755Ssowmini struct nce_s;
110bd670b35SErik Nordmark /*
111bd670b35SErik Nordmark  * structure for passing args between ire_ftable_lookup and ire_find_best_route
112bd670b35SErik Nordmark  */
113bd670b35SErik Nordmark typedef struct ire_ftable_args_s {
114bd670b35SErik Nordmark 	in6_addr_t		ift_addr_v6;
115bd670b35SErik Nordmark 	in6_addr_t		ift_mask_v6;
116bd670b35SErik Nordmark 	in6_addr_t		ift_gateway_v6;
117bd670b35SErik Nordmark #define	ift_addr		V4_PART_OF_V6(ift_addr_v6)
118bd670b35SErik Nordmark #define	ift_mask		V4_PART_OF_V6(ift_mask_v6)
119bd670b35SErik Nordmark #define	ift_gateway		V4_PART_OF_V6(ift_gateway_v6)
120bd670b35SErik Nordmark 	int			ift_type;
121bd670b35SErik Nordmark 	const ill_t		*ift_ill;
122bd670b35SErik Nordmark 	zoneid_t		ift_zoneid;
123bd670b35SErik Nordmark 	const ts_label_t	*ift_tsl;
124bd670b35SErik Nordmark 	int			ift_flags;
125bd670b35SErik Nordmark 	ire_t			*ift_best_ire;
126bd670b35SErik Nordmark } ire_ftable_args_t;
12745916cd2Sjpk 
1287c478bd9Sstevel@tonic-gate extern	ipaddr_t	ip_plen_to_mask(uint_t);
1297c478bd9Sstevel@tonic-gate extern	in6_addr_t	*ip_plen_to_mask_v6(uint_t, in6_addr_t *);
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate extern	int	ip_ire_advise(queue_t *, mblk_t *, cred_t *);
1327c478bd9Sstevel@tonic-gate extern	int	ip_ire_delete(queue_t *, mblk_t *, cred_t *);
133bd670b35SErik Nordmark extern	void	ip_ire_reclaim(void *);
1347c478bd9Sstevel@tonic-gate 
1357c478bd9Sstevel@tonic-gate extern	int	ip_mask_to_plen(ipaddr_t);
1367c478bd9Sstevel@tonic-gate extern	int	ip_mask_to_plen_v6(const in6_addr_t *);
1377c478bd9Sstevel@tonic-gate 
138bd670b35SErik Nordmark extern	ire_t	*ire_add(ire_t *);
139bd670b35SErik Nordmark extern	ire_t	*ire_add_v6(ire_t *);
140bd670b35SErik Nordmark extern	int	ire_atomic_start(irb_t *irb_ptr, ire_t *ire);
1417c478bd9Sstevel@tonic-gate extern	void	ire_atomic_end(irb_t *irb_ptr, ire_t *ire);
1427c478bd9Sstevel@tonic-gate 
143bd670b35SErik Nordmark extern	ire_t	*ire_create(uchar_t *, uchar_t *, uchar_t *,
144bd670b35SErik Nordmark     ushort_t, ill_t *, zoneid_t, uint_t, tsol_gc_t *, ip_stack_t *);
14545916cd2Sjpk 
146bd670b35SErik Nordmark extern	ire_t	**ire_create_bcast(ill_t *, ipaddr_t, zoneid_t, ire_t **);
147bd670b35SErik Nordmark extern	ire_t	*ire_create_if_clone(ire_t *, const in6_addr_t *, uint_t *);
148bd670b35SErik Nordmark extern	ire_t	*ire_lookup_bcast(ill_t *, ipaddr_t, zoneid_t);
149bd670b35SErik Nordmark extern	int	ire_init_v4(ire_t *, uchar_t *, uchar_t *, uchar_t *,
150bd670b35SErik Nordmark     ushort_t, ill_t *, zoneid_t, uint_t, tsol_gc_t *, ip_stack_t *);
151bd670b35SErik Nordmark extern	int	ire_init_v6(ire_t *, const in6_addr_t *, const in6_addr_t *,
152bd670b35SErik Nordmark     const in6_addr_t *, ushort_t, ill_t *, zoneid_t, uint_t, tsol_gc_t *,
153f4b3ec61Sdh     ip_stack_t *);
1547c478bd9Sstevel@tonic-gate 
155bd670b35SErik Nordmark extern	int	ire_init_common(ire_t *, ushort_t, ill_t *, zoneid_t, uint_t,
156bd670b35SErik Nordmark     uchar_t, tsol_gc_t *, ip_stack_t *);
1577c478bd9Sstevel@tonic-gate 
158bd670b35SErik Nordmark extern	ire_t	*ire_create_v6(const in6_addr_t *, const in6_addr_t *,
159bd670b35SErik Nordmark     const in6_addr_t *, ushort_t, ill_t *, zoneid_t, uint_t,
160bd670b35SErik Nordmark     tsol_gc_t *, ip_stack_t *);
1617c478bd9Sstevel@tonic-gate 
1627c478bd9Sstevel@tonic-gate extern	void	ire_delete(ire_t *);
1637c478bd9Sstevel@tonic-gate extern	void	ire_delete_v6(ire_t *);
1647c478bd9Sstevel@tonic-gate 
165bd670b35SErik Nordmark extern	boolean_t ire_dep_build(ire_t *[], uint_t [], uint_t);
166bd670b35SErik Nordmark extern	void	ire_dep_delete_if_clone(ire_t *);
167bd670b35SErik Nordmark extern	void	ire_dep_incr_generation(ire_t *);
168bd670b35SErik Nordmark extern	void	ire_dep_remove(ire_t *);
169bd670b35SErik Nordmark extern	void	ire_dep_unbuild(ire_t *[], uint_t);
170bd670b35SErik Nordmark extern	uint_t	ire_dep_validate_generations(ire_t *);
171bd670b35SErik Nordmark extern	void	ire_dep_invalidate_generations(ire_t *);
172bd670b35SErik Nordmark extern	boolean_t ire_determine_nce_capable(ire_t *);
1737c478bd9Sstevel@tonic-gate 
1747c478bd9Sstevel@tonic-gate extern	void	ire_flush_cache_v4(ire_t *, int);
1757c478bd9Sstevel@tonic-gate extern	void	ire_flush_cache_v6(ire_t *, int);
1767c478bd9Sstevel@tonic-gate 
177bd670b35SErik Nordmark extern	ire_t	*ire_ftable_lookup_v4(ipaddr_t, ipaddr_t, ipaddr_t, int,
178bd670b35SErik Nordmark     const ill_t *, zoneid_t, const struct ts_label_s *, int, uint32_t,
179bd670b35SErik Nordmark     ip_stack_t *, uint_t *);
1807c478bd9Sstevel@tonic-gate extern	ire_t	*ire_ftable_lookup_v6(const in6_addr_t *, const in6_addr_t *,
181bd670b35SErik Nordmark     const in6_addr_t *, int, const ill_t *, zoneid_t,
182bd670b35SErik Nordmark     const struct ts_label_s *, int, uint32_t, ip_stack_t *, uint_t *);
183bd670b35SErik Nordmark 
184bd670b35SErik Nordmark extern	ire_t	*ire_ftable_lookup_simple_v4(ipaddr_t, uint32_t, ip_stack_t *,
185bd670b35SErik Nordmark     uint_t *);
186bd670b35SErik Nordmark extern	ire_t	*ire_ftable_lookup_simple_v6(const in6_addr_t *, uint32_t,
187bd670b35SErik Nordmark     ip_stack_t *, uint_t *);
188bd670b35SErik Nordmark 
189bd670b35SErik Nordmark extern boolean_t ire_gateway_ok_zone_v4(ipaddr_t, zoneid_t, ill_t *,
190bd670b35SErik Nordmark     const ts_label_t *, ip_stack_t *, boolean_t);
191bd670b35SErik Nordmark extern boolean_t ire_gateway_ok_zone_v6(const in6_addr_t *, zoneid_t, ill_t *,
192bd670b35SErik Nordmark     const ts_label_t *, ip_stack_t *, boolean_t);
193bd670b35SErik Nordmark 
194bd670b35SErik Nordmark extern ire_t	*ire_alt_local(ire_t *, zoneid_t, const ts_label_t *,
195bd670b35SErik Nordmark     const ill_t *, uint_t *);
196bd670b35SErik Nordmark 
197bd670b35SErik Nordmark extern  ill_t	*ire_lookup_multi_ill_v4(ipaddr_t, zoneid_t, ip_stack_t *,
198bd670b35SErik Nordmark     boolean_t *, ipaddr_t *);
199bd670b35SErik Nordmark extern  ill_t	*ire_lookup_multi_ill_v6(const in6_addr_t *, zoneid_t,
200bd670b35SErik Nordmark     ip_stack_t *, boolean_t *, in6_addr_t *);
201bd670b35SErik Nordmark 
202bd670b35SErik Nordmark extern	ire_t	*ire_nexthop(ire_t *);
203bd670b35SErik Nordmark extern	ill_t	*ire_nexthop_ill(ire_t *);
204bd670b35SErik Nordmark extern	ill_t	*ire_nce_ill(ire_t *);
205bd670b35SErik Nordmark 
206bd670b35SErik Nordmark extern	ire_t	*ire_reject(ip_stack_t *, boolean_t);
207bd670b35SErik Nordmark extern	ire_t	*ire_blackhole(ip_stack_t *, boolean_t);
208bd670b35SErik Nordmark extern	ire_t	*ire_multicast(ill_t *);
209bd670b35SErik Nordmark 
210bd670b35SErik Nordmark /* The different ire_recvfn functions */
211bd670b35SErik Nordmark extern void	ire_recv_forward_v4(ire_t *, mblk_t *, void *,
212bd670b35SErik Nordmark     ip_recv_attr_t *);
213bd670b35SErik Nordmark extern void	ire_recv_noroute_v4(ire_t *, mblk_t *, void *,
214bd670b35SErik Nordmark     ip_recv_attr_t *);
215bd670b35SErik Nordmark extern void	ire_recv_broadcast_v4(ire_t *, mblk_t *, void *,
216bd670b35SErik Nordmark     ip_recv_attr_t *);
217bd670b35SErik Nordmark extern void	ire_recv_multicast_v4(ire_t *, mblk_t *, void *,
218bd670b35SErik Nordmark     ip_recv_attr_t *);
219bd670b35SErik Nordmark extern void	ire_recv_multirt_v4(ire_t *, mblk_t *, void *,
220bd670b35SErik Nordmark     ip_recv_attr_t *);
221bd670b35SErik Nordmark extern void	ire_recv_loopback_v4(ire_t *, mblk_t *, void *,
222bd670b35SErik Nordmark     ip_recv_attr_t *);
223bd670b35SErik Nordmark extern void	ire_recv_local_v4(ire_t *, mblk_t *, void *,
224bd670b35SErik Nordmark     ip_recv_attr_t *);
225bd670b35SErik Nordmark extern void	ire_recv_noaccept_v4(ire_t *, mblk_t *, void *,
226bd670b35SErik Nordmark     ip_recv_attr_t *);
227bd670b35SErik Nordmark 
228bd670b35SErik Nordmark extern void	ire_recv_forward_v6(ire_t *, mblk_t *, void *,
229bd670b35SErik Nordmark     ip_recv_attr_t *);
230bd670b35SErik Nordmark extern void	ire_recv_noroute_v6(ire_t *, mblk_t *, void *,
231bd670b35SErik Nordmark     ip_recv_attr_t *);
232bd670b35SErik Nordmark extern void	ire_recv_multicast_v6(ire_t *, mblk_t *, void *,
233bd670b35SErik Nordmark     ip_recv_attr_t *);
234bd670b35SErik Nordmark extern void	ire_recv_multirt_v6(ire_t *, mblk_t *, void *,
235bd670b35SErik Nordmark     ip_recv_attr_t *);
236bd670b35SErik Nordmark extern void	ire_recv_loopback_v6(ire_t *, mblk_t *, void *,
237bd670b35SErik Nordmark     ip_recv_attr_t *);
238bd670b35SErik Nordmark extern void	ire_recv_local_v6(ire_t *, mblk_t *, void *, ip_recv_attr_t *);
239bd670b35SErik Nordmark extern void	ire_recv_noaccept_v6(ire_t *, mblk_t *, void *,
240bd670b35SErik Nordmark     ip_recv_attr_t *);
241bd670b35SErik Nordmark 
242bd670b35SErik Nordmark extern	void	irb_refhold(irb_t *);
243bd670b35SErik Nordmark extern	void	irb_refhold_locked(irb_t *);
244bd670b35SErik Nordmark extern	void	irb_refrele(irb_t *);
245bd670b35SErik Nordmark extern  void	irb_increment_generation(irb_t *);
246bd670b35SErik Nordmark 
247bd670b35SErik Nordmark extern	void	ire_refhold(ire_t *);
248bd670b35SErik Nordmark extern	void	ire_refhold_notr(ire_t *);
249bd670b35SErik Nordmark extern	void	ire_refhold_locked(ire_t *);
2507c478bd9Sstevel@tonic-gate extern	void	ire_refrele(ire_t *);
2517c478bd9Sstevel@tonic-gate extern	void	ire_refrele_notr(ire_t *);
252bd670b35SErik Nordmark extern	void	ire_make_condemned(ire_t *);
253bd670b35SErik Nordmark extern	boolean_t ire_no_good(ire_t *);
254bd670b35SErik Nordmark extern	nce_t	*ire_handle_condemned_nce(nce_t *, ire_t *, ipha_t *, ip6_t *,
255bd670b35SErik Nordmark     boolean_t);
256bd670b35SErik Nordmark 
257bd670b35SErik Nordmark extern ire_t   	*ire_round_robin(irb_t *, ire_ftable_args_t *, uint_t,
258bd670b35SErik Nordmark     ire_t *, ip_stack_t *);
259bd670b35SErik Nordmark 
260bd670b35SErik Nordmark extern ire_t	*ire_route_recursive_v4(ipaddr_t, uint_t, const ill_t *,
2619e3469d3SErik Nordmark     zoneid_t, const ts_label_t *, uint_t, uint_t, uint32_t, ip_stack_t *,
262bd670b35SErik Nordmark     ipaddr_t *, tsol_ire_gw_secattr_t **, uint_t *);
263bd670b35SErik Nordmark extern ire_t	*ire_route_recursive_v6(const in6_addr_t *, uint_t,
2649e3469d3SErik Nordmark     const ill_t *, zoneid_t, const ts_label_t *, uint_t, uint_t, uint32_t,
265bd670b35SErik Nordmark     ip_stack_t *, in6_addr_t *, tsol_ire_gw_secattr_t **, uint_t *);
2669e3469d3SErik Nordmark extern ire_t	*ire_route_recursive_dstonly_v4(ipaddr_t, uint_t,
267bd670b35SErik Nordmark     uint32_t, ip_stack_t *);
2689e3469d3SErik Nordmark extern ire_t	*ire_route_recursive_dstonly_v6(const in6_addr_t *, uint_t,
269bd670b35SErik Nordmark     uint32_t, ip_stack_t *);
270bd670b35SErik Nordmark extern ire_t	*ire_route_recursive_impl_v4(ire_t *ire, ipaddr_t, uint_t,
2719e3469d3SErik Nordmark     const ill_t *, zoneid_t, const ts_label_t *, uint_t, uint_t, uint32_t,
272bd670b35SErik Nordmark     ip_stack_t *, ipaddr_t *, tsol_ire_gw_secattr_t **, uint_t *);
273bd670b35SErik Nordmark extern ire_t	*ire_route_recursive_impl_v6(ire_t *ire, const in6_addr_t *,
2749e3469d3SErik Nordmark     uint_t, const ill_t *, zoneid_t, const ts_label_t *, uint_t, uint_t,
275bd670b35SErik Nordmark     uint32_t, ip_stack_t *, in6_addr_t *, tsol_ire_gw_secattr_t **, uint_t *);
276bd670b35SErik Nordmark 
277bd670b35SErik Nordmark /* The different ire_sendfn functions */
278bd670b35SErik Nordmark extern int	ire_send_local_v4(ire_t *, mblk_t *, void *,
279bd670b35SErik Nordmark     ip_xmit_attr_t *, uint32_t *);
280bd670b35SErik Nordmark extern int	ire_send_multirt_v4(ire_t *, mblk_t *, void *,
281bd670b35SErik Nordmark     ip_xmit_attr_t *, uint32_t *);
282bd670b35SErik Nordmark extern int	ire_send_noroute_v4(ire_t *, mblk_t *, void *,
283bd670b35SErik Nordmark     ip_xmit_attr_t *, uint32_t *);
284bd670b35SErik Nordmark extern int	ire_send_multicast_v4(ire_t *, mblk_t *, void *,
285bd670b35SErik Nordmark     ip_xmit_attr_t *, uint32_t *);
286bd670b35SErik Nordmark extern int	ire_send_broadcast_v4(ire_t *, mblk_t *, void *,
287bd670b35SErik Nordmark     ip_xmit_attr_t *, uint32_t *);
288bd670b35SErik Nordmark extern int	ire_send_wire_v4(ire_t *, mblk_t *, void *,
289bd670b35SErik Nordmark     ip_xmit_attr_t *, uint32_t *);
290bd670b35SErik Nordmark extern int	ire_send_local_v6(ire_t *, mblk_t *, void *,
291bd670b35SErik Nordmark     ip_xmit_attr_t *, uint32_t *);
292bd670b35SErik Nordmark extern int	ire_send_multirt_v6(ire_t *, mblk_t *, void *,
293bd670b35SErik Nordmark     ip_xmit_attr_t *, uint32_t *);
294bd670b35SErik Nordmark extern int	ire_send_noroute_v6(ire_t *, mblk_t *, void *,
295bd670b35SErik Nordmark     ip_xmit_attr_t *, uint32_t *);
296bd670b35SErik Nordmark extern int	ire_send_multicast_v6(ire_t *, mblk_t *, void *,
297bd670b35SErik Nordmark     ip_xmit_attr_t *, uint32_t *);
298bd670b35SErik Nordmark extern int	ire_send_wire_v6(ire_t *, mblk_t *, void *,
299bd670b35SErik Nordmark     ip_xmit_attr_t *, uint32_t *);
300bd670b35SErik Nordmark 
301bd670b35SErik Nordmark extern nce_t	*ire_to_nce_pkt(ire_t *, mblk_t *);
302bd670b35SErik Nordmark extern nce_t	*ire_to_nce(ire_t *, ipaddr_t, const in6_addr_t *);
303bd670b35SErik Nordmark 
304bd670b35SErik Nordmark /* Different ire_postfragfn functions */
305bd670b35SErik Nordmark extern int	ip_xmit(mblk_t *, struct nce_s *,
306bd670b35SErik Nordmark     iaflags_t, uint_t, uint32_t, zoneid_t, zoneid_t, uintptr_t *);
307bd670b35SErik Nordmark extern int	ip_postfrag_loopcheck(mblk_t *, struct nce_s *,
308bd670b35SErik Nordmark     iaflags_t, uint_t, uint32_t, zoneid_t, zoneid_t, uintptr_t *);
309bd670b35SErik Nordmark extern int	ip_postfrag_multirt_v4(mblk_t *, struct nce_s *,
310bd670b35SErik Nordmark     iaflags_t, uint_t, uint32_t, zoneid_t, zoneid_t, uintptr_t *);
311bd670b35SErik Nordmark extern int	ip_postfrag_multirt_v6(mblk_t *, struct nce_s *,
312bd670b35SErik Nordmark     iaflags_t, uint_t, uint32_t, zoneid_t, zoneid_t, uintptr_t *);
313bd670b35SErik Nordmark 
314bd670b35SErik Nordmark extern void	ip_postfrag_loopback(mblk_t *, struct nce_s *,
315bd670b35SErik Nordmark     iaflags_t, uint_t, zoneid_t);
316bd670b35SErik Nordmark extern int	ire_revalidate_nce(ire_t *);
317bd670b35SErik Nordmark 
318bd670b35SErik Nordmark extern ire_t	*ip_select_route_pkt(mblk_t *, ip_xmit_attr_t *,
319bd670b35SErik Nordmark     uint_t *, int *, boolean_t *);
32044b099c4SSowmini Varadhan extern ire_t	*ip_select_route(const in6_addr_t *, const in6_addr_t,
32144b099c4SSowmini Varadhan     ip_xmit_attr_t *, uint_t *, in6_addr_t *, int *, boolean_t *);
32244b099c4SSowmini Varadhan extern ire_t	*ip_select_route_v4(ipaddr_t, ipaddr_t, ip_xmit_attr_t *,
323bd670b35SErik Nordmark     uint_t *, ipaddr_t *, int *, boolean_t *);
32444b099c4SSowmini Varadhan extern ire_t	*ip_select_route_v6(const in6_addr_t *, const in6_addr_t,
32544b099c4SSowmini Varadhan     ip_xmit_attr_t *, uint_t *, in6_addr_t *, int *, boolean_t *);
3267c478bd9Sstevel@tonic-gate 
327f4b3ec61Sdh extern	void	ire_walk(pfv_t, void *, ip_stack_t *);
32845916cd2Sjpk extern	void	ire_walk_ill(uint_t, uint_t, pfv_t, void *, ill_t *);
329f4b3ec61Sdh extern	void	ire_walk_v4(pfv_t, void *, zoneid_t, ip_stack_t *);
330c793af95Ssangeeta extern  void	ire_walk_ill_tables(uint_t match_flags, uint_t ire_type,
331c793af95Ssangeeta     pfv_t func, void *arg, size_t ftbl_sz, size_t htbl_sz,
332bd670b35SErik Nordmark     irb_t **ipftbl, ill_t *ill,
333f4b3ec61Sdh     zoneid_t zoneid, ip_stack_t *);
334f4b3ec61Sdh extern	void	ire_walk_v6(pfv_t, void *, zoneid_t, ip_stack_t *);
33545916cd2Sjpk 
336c793af95Ssangeeta extern boolean_t	ire_match_args(ire_t *, ipaddr_t, ipaddr_t, ipaddr_t,
337bd670b35SErik Nordmark     int, const ill_t *, zoneid_t, const struct ts_label_s *, int);
338bd670b35SErik Nordmark extern boolean_t	ire_match_args_v6(ire_t *, const in6_addr_t *,
339bd670b35SErik Nordmark     const in6_addr_t *, const in6_addr_t *, int, const ill_t *, zoneid_t,
340bd670b35SErik Nordmark     const ts_label_t *, int);
341bd670b35SErik Nordmark 
342bd670b35SErik Nordmark extern  struct nce_s	*arp_nce_init(ill_t *, in_addr_t, int);
343c793af95Ssangeeta extern  boolean_t	ire_walk_ill_match(uint_t, uint_t, ire_t *, ill_t *,
344f4b3ec61Sdh     zoneid_t, ip_stack_t *);
345bd670b35SErik Nordmark extern  void ire_increment_generation(ire_t *);
346bd670b35SErik Nordmark extern  void ire_increment_multicast_generation(ip_stack_t *, boolean_t);
34744b099c4SSowmini Varadhan extern	void ire_rebind(ire_t *);
348fff7ec1dSSowmini Varadhan extern	boolean_t ire_clone_verify(ire_t *);
349c793af95Ssangeeta 
3507c478bd9Sstevel@tonic-gate #endif /* _KERNEL */
3517c478bd9Sstevel@tonic-gate 
3527c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3537c478bd9Sstevel@tonic-gate }
3547c478bd9Sstevel@tonic-gate #endif
3557c478bd9Sstevel@tonic-gate 
3567c478bd9Sstevel@tonic-gate #endif	/* _INET_IP_IRE_H */
357