xref: /illumos-gate/usr/src/uts/common/inet/ip_ire.h (revision 9e3469d3db608feb0e43d9955cbf406c22025463)
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 /*
22*9e3469d3SErik Nordmark  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate /* Copyright (c) 1990 Mentat Inc. */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef	_INET_IP_IRE_H
287c478bd9Sstevel@tonic-gate #define	_INET_IP_IRE_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
317c478bd9Sstevel@tonic-gate extern "C" {
327c478bd9Sstevel@tonic-gate #endif
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #define	IPV6_LL_PREFIXLEN	10	/* Number of bits in link-local pref */
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #define	IP_CACHE_TABLE_SIZE	256
377c478bd9Sstevel@tonic-gate #define	IP_MASK_TABLE_SIZE	(IP_ABITS + 1)		/* 33 ptrs */
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #define	IP6_FTABLE_HASH_SIZE	32	/* size of each hash table in ptrs */
407c478bd9Sstevel@tonic-gate #define	IP6_CACHE_TABLE_SIZE	256
417c478bd9Sstevel@tonic-gate #define	IP6_MASK_TABLE_SIZE	(IPV6_ABITS + 1)	/* 129 ptrs */
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate /*
447c478bd9Sstevel@tonic-gate  * We use the common modulo hash function.  In ip_ire_init(), we make
457c478bd9Sstevel@tonic-gate  * sure that the cache table size is always a power of 2.  That's why
467c478bd9Sstevel@tonic-gate  * we can use & instead of %.  Also note that we try hard to make sure
477c478bd9Sstevel@tonic-gate  * the lower bits of an address capture most info from the whole address.
487c478bd9Sstevel@tonic-gate  * The reason being that since our hash table is probably a lot smaller
497c478bd9Sstevel@tonic-gate  * than 2^32 buckets so the lower bits are the most important.
507c478bd9Sstevel@tonic-gate  */
517c478bd9Sstevel@tonic-gate #define	IRE_ADDR_HASH(addr, table_size) \
527c478bd9Sstevel@tonic-gate 	(((addr) ^ ((addr) >> 8) ^ ((addr) >> 16) ^ ((addr) >> 24)) &	\
537c478bd9Sstevel@tonic-gate 	((table_size) - 1))
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate /*
56f4b3ec61Sdh155122  * To make a byte-order neutral hash for IPv6, just take all the
57f4b3ec61Sdh155122  * bytes in the bottom 32 bits into account.
587c478bd9Sstevel@tonic-gate  */
597c478bd9Sstevel@tonic-gate #define	IRE_ADDR_HASH_V6(addr, table_size) 				\
60f4b3ec61Sdh155122 	IRE_ADDR_HASH((addr).s6_addr32[3], table_size)
61f4b3ec61Sdh155122 
62188e1664SErik Nordmark /*
63188e1664SErik Nordmark  * This assumes that the ftable size is a power of 2.
64188e1664SErik Nordmark  * We include some high-order bytes to avoid all IRE_LOCALs in the same
65188e1664SErik Nordmark  * bucket for performance reasons.
66188e1664SErik Nordmark  */
677c478bd9Sstevel@tonic-gate #define	IRE_ADDR_MASK_HASH_V6(addr, mask, table_size) 			\
68188e1664SErik Nordmark 	((((addr).s6_addr8[0] & (mask).s6_addr8[0]) ^ 			\
69188e1664SErik Nordmark 	((addr).s6_addr8[1] & (mask).s6_addr8[1]) ^ 			\
70188e1664SErik Nordmark 	((addr).s6_addr8[6] & (mask).s6_addr8[6]) ^ 			\
71188e1664SErik Nordmark 	((addr).s6_addr8[7] & (mask).s6_addr8[7]) ^ 			\
72188e1664SErik Nordmark 	((addr).s6_addr8[8] & (mask).s6_addr8[8]) ^ 			\
737c478bd9Sstevel@tonic-gate 	((addr).s6_addr8[9] & (mask).s6_addr8[9]) ^			\
747c478bd9Sstevel@tonic-gate 	((addr).s6_addr8[10] & (mask).s6_addr8[10]) ^ 			\
757c478bd9Sstevel@tonic-gate 	((addr).s6_addr8[13] & (mask).s6_addr8[13]) ^ 			\
767c478bd9Sstevel@tonic-gate 	((addr).s6_addr8[14] & (mask).s6_addr8[14]) ^ 			\
777c478bd9Sstevel@tonic-gate 	((addr).s6_addr8[15] & (mask).s6_addr8[15])) & ((table_size) - 1))
787c478bd9Sstevel@tonic-gate 
79bd670b35SErik Nordmark #define	IRE_HIDDEN_TYPE(ire_type) ((ire_type) &			\
80bd670b35SErik Nordmark 	(IRE_HOST | IRE_PREFIX | IRE_DEFAULT | IRE_IF_ALL | IRE_BROADCAST))
81bd670b35SErik Nordmark 
827c478bd9Sstevel@tonic-gate /*
8398e93c29Smeem  * match parameter definitions for IRE lookup routines.
847c478bd9Sstevel@tonic-gate  */
857c478bd9Sstevel@tonic-gate #define	MATCH_IRE_DSTONLY	0x0000	/* Match just the address */
867c478bd9Sstevel@tonic-gate #define	MATCH_IRE_TYPE		0x0001	/* Match IRE type */
87bd670b35SErik Nordmark #define	MATCH_IRE_MASK		0x0002	/* Match IRE mask */
88bd670b35SErik Nordmark #define	MATCH_IRE_SHORTERMASK	0x0004	/* A mask shorter than the argument */
89bd670b35SErik Nordmark #define	MATCH_IRE_GW		0x0008	/* Match IRE gateway */
90bd670b35SErik Nordmark #define	MATCH_IRE_ILL		0x0010	/* Match IRE on the ill */
91bd670b35SErik Nordmark #define	MATCH_IRE_ZONEONLY	0x0020	/* Match IREs in specified zone, ie */
927c478bd9Sstevel@tonic-gate 					/* don't match IRE_LOCALs from other */
937c478bd9Sstevel@tonic-gate 					/* zones or shared IREs */
94bd670b35SErik Nordmark #define	MATCH_IRE_SECATTR	0x0040	/* Match gateway security attributes */
95bd670b35SErik Nordmark #define	MATCH_IRE_TESTHIDDEN 	0x0080	/* Match ire_testhidden IREs */
96c793af95Ssangeeta 
97bd670b35SErik Nordmark #define	MAX_IRE_RECURSION	4	/* Max IREs in ire_route_recursive */
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate /*
1017c478bd9Sstevel@tonic-gate  * We use atomics so that we get an accurate accounting on the ires.
1027c478bd9Sstevel@tonic-gate  * Otherwise we can't determine leaks correctly.
1037c478bd9Sstevel@tonic-gate  */
1047c478bd9Sstevel@tonic-gate #define	BUMP_IRE_STATS(ire_stats, x) atomic_add_64(&(ire_stats).x, 1)
1057c478bd9Sstevel@tonic-gate 
1067c478bd9Sstevel@tonic-gate #ifdef _KERNEL
10745916cd2Sjpk struct ts_label_s;
10854da8755Ssowmini struct nce_s;
109bd670b35SErik Nordmark /*
110bd670b35SErik Nordmark  * structure for passing args between ire_ftable_lookup and ire_find_best_route
111bd670b35SErik Nordmark  */
112bd670b35SErik Nordmark typedef struct ire_ftable_args_s {
113bd670b35SErik Nordmark 	in6_addr_t		ift_addr_v6;
114bd670b35SErik Nordmark 	in6_addr_t		ift_mask_v6;
115bd670b35SErik Nordmark 	in6_addr_t		ift_gateway_v6;
116bd670b35SErik Nordmark #define	ift_addr		V4_PART_OF_V6(ift_addr_v6)
117bd670b35SErik Nordmark #define	ift_mask		V4_PART_OF_V6(ift_mask_v6)
118bd670b35SErik Nordmark #define	ift_gateway		V4_PART_OF_V6(ift_gateway_v6)
119bd670b35SErik Nordmark 	int			ift_type;
120bd670b35SErik Nordmark 	const ill_t		*ift_ill;
121bd670b35SErik Nordmark 	zoneid_t		ift_zoneid;
122bd670b35SErik Nordmark 	const ts_label_t	*ift_tsl;
123bd670b35SErik Nordmark 	int			ift_flags;
124bd670b35SErik Nordmark 	ire_t			*ift_best_ire;
125bd670b35SErik Nordmark } ire_ftable_args_t;
12645916cd2Sjpk 
1277c478bd9Sstevel@tonic-gate extern	ipaddr_t	ip_plen_to_mask(uint_t);
1287c478bd9Sstevel@tonic-gate extern	in6_addr_t	*ip_plen_to_mask_v6(uint_t, in6_addr_t *);
1297c478bd9Sstevel@tonic-gate 
1307c478bd9Sstevel@tonic-gate extern	int	ip_ire_advise(queue_t *, mblk_t *, cred_t *);
1317c478bd9Sstevel@tonic-gate extern	int	ip_ire_delete(queue_t *, mblk_t *, cred_t *);
132bd670b35SErik Nordmark extern	void	ip_ire_reclaim(void *);
1337c478bd9Sstevel@tonic-gate 
1347c478bd9Sstevel@tonic-gate extern	int	ip_mask_to_plen(ipaddr_t);
1357c478bd9Sstevel@tonic-gate extern	int	ip_mask_to_plen_v6(const in6_addr_t *);
1367c478bd9Sstevel@tonic-gate 
137bd670b35SErik Nordmark extern	ire_t	*ire_add(ire_t *);
138bd670b35SErik Nordmark extern	ire_t	*ire_add_v6(ire_t *);
139bd670b35SErik Nordmark extern	int	ire_atomic_start(irb_t *irb_ptr, ire_t *ire);
1407c478bd9Sstevel@tonic-gate extern	void	ire_atomic_end(irb_t *irb_ptr, ire_t *ire);
1417c478bd9Sstevel@tonic-gate 
142bd670b35SErik Nordmark extern	ire_t	*ire_create(uchar_t *, uchar_t *, uchar_t *,
143bd670b35SErik Nordmark     ushort_t, ill_t *, zoneid_t, uint_t, tsol_gc_t *, ip_stack_t *);
1447c478bd9Sstevel@tonic-gate 
145bd670b35SErik Nordmark extern	ire_t	**ire_create_bcast(ill_t *, ipaddr_t, zoneid_t, ire_t **);
146bd670b35SErik Nordmark extern	ire_t	*ire_create_if_clone(ire_t *, const in6_addr_t *, uint_t *);
147bd670b35SErik Nordmark extern	ire_t	*ire_lookup_bcast(ill_t *, ipaddr_t, zoneid_t);
148bd670b35SErik Nordmark extern	int	ire_init_v4(ire_t *, uchar_t *, uchar_t *, uchar_t *,
149bd670b35SErik Nordmark     ushort_t, ill_t *, zoneid_t, uint_t, tsol_gc_t *, ip_stack_t *);
150bd670b35SErik Nordmark extern	int	ire_init_v6(ire_t *, const in6_addr_t *, const in6_addr_t *,
151bd670b35SErik Nordmark     const in6_addr_t *, ushort_t, ill_t *, zoneid_t, uint_t, tsol_gc_t *,
1525c0b7edeSseb     ip_stack_t *);
1537c478bd9Sstevel@tonic-gate 
154bd670b35SErik Nordmark extern	int	ire_init_common(ire_t *, ushort_t, ill_t *, zoneid_t, uint_t,
155bd670b35SErik Nordmark     uchar_t, tsol_gc_t *, ip_stack_t *);
1567c478bd9Sstevel@tonic-gate 
1577c478bd9Sstevel@tonic-gate extern	ire_t	*ire_create_v6(const in6_addr_t *, const in6_addr_t *,
158bd670b35SErik Nordmark     const in6_addr_t *, ushort_t, ill_t *, zoneid_t, uint_t,
159bd670b35SErik Nordmark     tsol_gc_t *, ip_stack_t *);
1607c478bd9Sstevel@tonic-gate 
1617c478bd9Sstevel@tonic-gate extern	void	ire_delete(ire_t *);
1627c478bd9Sstevel@tonic-gate extern	void	ire_delete_v6(ire_t *);
1637c478bd9Sstevel@tonic-gate 
164bd670b35SErik Nordmark /*
165bd670b35SErik Nordmark  * ire_pref used to make sure we don't set up routing loops in the ire_dep
166bd670b35SErik Nordmark  * chain.
167bd670b35SErik Nordmark  */
168bd670b35SErik Nordmark extern	int	ire_pref(ire_t *);
169bd670b35SErik Nordmark extern	boolean_t ire_dep_build(ire_t *[], uint_t [], uint_t);
170bd670b35SErik Nordmark extern	void	ire_dep_delete_if_clone(ire_t *);
171bd670b35SErik Nordmark extern	void	ire_dep_incr_generation(ire_t *);
172bd670b35SErik Nordmark extern	void	ire_dep_remove(ire_t *);
173bd670b35SErik Nordmark extern	void	ire_dep_unbuild(ire_t *[], uint_t);
174bd670b35SErik Nordmark extern	uint_t	ire_dep_validate_generations(ire_t *);
175bd670b35SErik Nordmark extern	void	ire_dep_invalidate_generations(ire_t *);
176bd670b35SErik Nordmark extern	boolean_t ire_determine_nce_capable(ire_t *);
1777c478bd9Sstevel@tonic-gate 
1787c478bd9Sstevel@tonic-gate extern	void	ire_flush_cache_v4(ire_t *, int);
1797c478bd9Sstevel@tonic-gate extern	void	ire_flush_cache_v6(ire_t *, int);
1807c478bd9Sstevel@tonic-gate 
181bd670b35SErik Nordmark extern	ire_t	*ire_ftable_lookup_v4(ipaddr_t, ipaddr_t, ipaddr_t, int,
182bd670b35SErik Nordmark     const ill_t *, zoneid_t, const struct ts_label_s *, int, uint32_t,
183bd670b35SErik Nordmark     ip_stack_t *, uint_t *);
1847c478bd9Sstevel@tonic-gate extern	ire_t	*ire_ftable_lookup_v6(const in6_addr_t *, const in6_addr_t *,
185bd670b35SErik Nordmark     const in6_addr_t *, int, const ill_t *, zoneid_t,
186bd670b35SErik Nordmark     const struct ts_label_s *, int, uint32_t, ip_stack_t *, uint_t *);
1877c478bd9Sstevel@tonic-gate 
188bd670b35SErik Nordmark extern	ire_t	*ire_ftable_lookup_simple_v4(ipaddr_t, uint32_t, ip_stack_t *,
189bd670b35SErik Nordmark     uint_t *);
190bd670b35SErik Nordmark extern	ire_t	*ire_ftable_lookup_simple_v6(const in6_addr_t *, uint32_t,
191bd670b35SErik Nordmark     ip_stack_t *, uint_t *);
1927c478bd9Sstevel@tonic-gate 
193bd670b35SErik Nordmark extern boolean_t ire_gateway_ok_zone_v4(ipaddr_t, zoneid_t, ill_t *,
194bd670b35SErik Nordmark     const ts_label_t *, ip_stack_t *, boolean_t);
195bd670b35SErik Nordmark extern boolean_t ire_gateway_ok_zone_v6(const in6_addr_t *, zoneid_t, ill_t *,
196bd670b35SErik Nordmark     const ts_label_t *, ip_stack_t *, boolean_t);
1975597b60aSnordmark 
198bd670b35SErik Nordmark extern ire_t	*ire_alt_local(ire_t *, zoneid_t, const ts_label_t *,
199bd670b35SErik Nordmark     const ill_t *, uint_t *);
2007c478bd9Sstevel@tonic-gate 
201bd670b35SErik Nordmark extern  ill_t	*ire_lookup_multi_ill_v4(ipaddr_t, zoneid_t, ip_stack_t *,
202bd670b35SErik Nordmark     boolean_t *, ipaddr_t *);
203bd670b35SErik Nordmark extern  ill_t	*ire_lookup_multi_ill_v6(const in6_addr_t *, zoneid_t,
204bd670b35SErik Nordmark     ip_stack_t *, boolean_t *, in6_addr_t *);
2057c478bd9Sstevel@tonic-gate 
206bd670b35SErik Nordmark extern	ire_t	*ire_nexthop(ire_t *);
207bd670b35SErik Nordmark extern	ill_t	*ire_nexthop_ill(ire_t *);
208bd670b35SErik Nordmark extern	ill_t	*ire_nce_ill(ire_t *);
209bd670b35SErik Nordmark 
210bd670b35SErik Nordmark extern	ire_t	*ire_reject(ip_stack_t *, boolean_t);
211bd670b35SErik Nordmark extern	ire_t	*ire_blackhole(ip_stack_t *, boolean_t);
212bd670b35SErik Nordmark extern	ire_t	*ire_multicast(ill_t *);
213bd670b35SErik Nordmark 
214bd670b35SErik Nordmark /* The different ire_recvfn functions */
215bd670b35SErik Nordmark extern void	ire_recv_forward_v4(ire_t *, mblk_t *, void *,
216bd670b35SErik Nordmark     ip_recv_attr_t *);
217bd670b35SErik Nordmark extern void	ire_recv_noroute_v4(ire_t *, mblk_t *, void *,
218bd670b35SErik Nordmark     ip_recv_attr_t *);
219bd670b35SErik Nordmark extern void	ire_recv_broadcast_v4(ire_t *, mblk_t *, void *,
220bd670b35SErik Nordmark     ip_recv_attr_t *);
221bd670b35SErik Nordmark extern void	ire_recv_multicast_v4(ire_t *, mblk_t *, void *,
222bd670b35SErik Nordmark     ip_recv_attr_t *);
223bd670b35SErik Nordmark extern void	ire_recv_multirt_v4(ire_t *, mblk_t *, void *,
224bd670b35SErik Nordmark     ip_recv_attr_t *);
225bd670b35SErik Nordmark extern void	ire_recv_loopback_v4(ire_t *, mblk_t *, void *,
226bd670b35SErik Nordmark     ip_recv_attr_t *);
227bd670b35SErik Nordmark extern void	ire_recv_local_v4(ire_t *, mblk_t *, void *,
228bd670b35SErik Nordmark     ip_recv_attr_t *);
229bd670b35SErik Nordmark extern void	ire_recv_noaccept_v4(ire_t *, mblk_t *, void *,
230bd670b35SErik Nordmark     ip_recv_attr_t *);
231bd670b35SErik Nordmark 
232bd670b35SErik Nordmark extern void	ire_recv_forward_v6(ire_t *, mblk_t *, void *,
233bd670b35SErik Nordmark     ip_recv_attr_t *);
234bd670b35SErik Nordmark extern void	ire_recv_noroute_v6(ire_t *, mblk_t *, void *,
235bd670b35SErik Nordmark     ip_recv_attr_t *);
236bd670b35SErik Nordmark extern void	ire_recv_multicast_v6(ire_t *, mblk_t *, void *,
237bd670b35SErik Nordmark     ip_recv_attr_t *);
238bd670b35SErik Nordmark extern void	ire_recv_multirt_v6(ire_t *, mblk_t *, void *,
239bd670b35SErik Nordmark     ip_recv_attr_t *);
240bd670b35SErik Nordmark extern void	ire_recv_loopback_v6(ire_t *, mblk_t *, void *,
241bd670b35SErik Nordmark     ip_recv_attr_t *);
242bd670b35SErik Nordmark extern void	ire_recv_local_v6(ire_t *, mblk_t *, void *, ip_recv_attr_t *);
243bd670b35SErik Nordmark extern void	ire_recv_noaccept_v6(ire_t *, mblk_t *, void *,
244bd670b35SErik Nordmark     ip_recv_attr_t *);
245bd670b35SErik Nordmark 
246bd670b35SErik Nordmark extern	void	irb_refhold(irb_t *);
247bd670b35SErik Nordmark extern	void	irb_refhold_locked(irb_t *);
248bd670b35SErik Nordmark extern	void	irb_refrele(irb_t *);
249bd670b35SErik Nordmark extern  void	irb_increment_generation(irb_t *);
250bd670b35SErik Nordmark 
251bd670b35SErik Nordmark extern	void	ire_refhold(ire_t *);
252bd670b35SErik Nordmark extern	void	ire_refhold_notr(ire_t *);
253bd670b35SErik Nordmark extern	void	ire_refhold_locked(ire_t *);
2547c478bd9Sstevel@tonic-gate extern	void	ire_refrele(ire_t *);
2557c478bd9Sstevel@tonic-gate extern	void	ire_refrele_notr(ire_t *);
256bd670b35SErik Nordmark extern	void	ire_make_condemned(ire_t *);
257bd670b35SErik Nordmark extern	boolean_t ire_no_good(ire_t *);
258bd670b35SErik Nordmark extern	nce_t	*ire_handle_condemned_nce(nce_t *, ire_t *, ipha_t *, ip6_t *,
259bd670b35SErik Nordmark     boolean_t);
2607c478bd9Sstevel@tonic-gate 
261bd670b35SErik Nordmark extern ire_t   	*ire_round_robin(irb_t *, ire_ftable_args_t *, uint_t,
262bd670b35SErik Nordmark     ire_t *, ip_stack_t *);
2637c478bd9Sstevel@tonic-gate 
264bd670b35SErik Nordmark extern ire_t	*ire_route_recursive_v4(ipaddr_t, uint_t, const ill_t *,
265*9e3469d3SErik Nordmark     zoneid_t, const ts_label_t *, uint_t, uint_t, uint32_t, ip_stack_t *,
266bd670b35SErik Nordmark     ipaddr_t *, tsol_ire_gw_secattr_t **, uint_t *);
267bd670b35SErik Nordmark extern ire_t	*ire_route_recursive_v6(const in6_addr_t *, uint_t,
268*9e3469d3SErik Nordmark     const ill_t *, zoneid_t, const ts_label_t *, uint_t, uint_t, uint32_t,
269bd670b35SErik Nordmark     ip_stack_t *, in6_addr_t *, tsol_ire_gw_secattr_t **, uint_t *);
270*9e3469d3SErik Nordmark extern ire_t	*ire_route_recursive_dstonly_v4(ipaddr_t, uint_t,
271bd670b35SErik Nordmark     uint32_t, ip_stack_t *);
272*9e3469d3SErik Nordmark extern ire_t	*ire_route_recursive_dstonly_v6(const in6_addr_t *, uint_t,
273bd670b35SErik Nordmark     uint32_t, ip_stack_t *);
274bd670b35SErik Nordmark extern ire_t	*ire_route_recursive_impl_v4(ire_t *ire, ipaddr_t, uint_t,
275*9e3469d3SErik Nordmark     const ill_t *, zoneid_t, const ts_label_t *, uint_t, uint_t, uint32_t,
276bd670b35SErik Nordmark     ip_stack_t *, ipaddr_t *, tsol_ire_gw_secattr_t **, uint_t *);
277bd670b35SErik Nordmark extern ire_t	*ire_route_recursive_impl_v6(ire_t *ire, const in6_addr_t *,
278*9e3469d3SErik Nordmark     uint_t, const ill_t *, zoneid_t, const ts_label_t *, uint_t, uint_t,
279bd670b35SErik Nordmark     uint32_t, ip_stack_t *, in6_addr_t *, tsol_ire_gw_secattr_t **, uint_t *);
280bd670b35SErik Nordmark 
281bd670b35SErik Nordmark /* The different ire_sendfn functions */
282bd670b35SErik Nordmark extern int	ire_send_local_v4(ire_t *, mblk_t *, void *,
283bd670b35SErik Nordmark     ip_xmit_attr_t *, uint32_t *);
284bd670b35SErik Nordmark extern int	ire_send_multirt_v4(ire_t *, mblk_t *, void *,
285bd670b35SErik Nordmark     ip_xmit_attr_t *, uint32_t *);
286bd670b35SErik Nordmark extern int	ire_send_noroute_v4(ire_t *, mblk_t *, void *,
287bd670b35SErik Nordmark     ip_xmit_attr_t *, uint32_t *);
288bd670b35SErik Nordmark extern int	ire_send_multicast_v4(ire_t *, mblk_t *, void *,
289bd670b35SErik Nordmark     ip_xmit_attr_t *, uint32_t *);
290bd670b35SErik Nordmark extern int	ire_send_broadcast_v4(ire_t *, mblk_t *, void *,
291bd670b35SErik Nordmark     ip_xmit_attr_t *, uint32_t *);
292bd670b35SErik Nordmark extern int	ire_send_wire_v4(ire_t *, mblk_t *, void *,
293bd670b35SErik Nordmark     ip_xmit_attr_t *, uint32_t *);
294bd670b35SErik Nordmark extern int	ire_send_local_v6(ire_t *, mblk_t *, void *,
295bd670b35SErik Nordmark     ip_xmit_attr_t *, uint32_t *);
296bd670b35SErik Nordmark extern int	ire_send_multirt_v6(ire_t *, mblk_t *, void *,
297bd670b35SErik Nordmark     ip_xmit_attr_t *, uint32_t *);
298bd670b35SErik Nordmark extern int	ire_send_noroute_v6(ire_t *, mblk_t *, void *,
299bd670b35SErik Nordmark     ip_xmit_attr_t *, uint32_t *);
300bd670b35SErik Nordmark extern int	ire_send_multicast_v6(ire_t *, mblk_t *, void *,
301bd670b35SErik Nordmark     ip_xmit_attr_t *, uint32_t *);
302bd670b35SErik Nordmark extern int	ire_send_wire_v6(ire_t *, mblk_t *, void *,
303bd670b35SErik Nordmark     ip_xmit_attr_t *, uint32_t *);
304bd670b35SErik Nordmark 
305bd670b35SErik Nordmark extern nce_t	*ire_to_nce_pkt(ire_t *, mblk_t *);
306bd670b35SErik Nordmark extern nce_t	*ire_to_nce(ire_t *, ipaddr_t, const in6_addr_t *);
307bd670b35SErik Nordmark 
308bd670b35SErik Nordmark /* Different ire_postfragfn functions */
309bd670b35SErik Nordmark extern int	ip_xmit(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_loopcheck(mblk_t *, struct nce_s *,
312bd670b35SErik Nordmark     iaflags_t, uint_t, uint32_t, zoneid_t, zoneid_t, uintptr_t *);
313bd670b35SErik Nordmark extern int	ip_postfrag_multirt_v4(mblk_t *, struct nce_s *,
314bd670b35SErik Nordmark     iaflags_t, uint_t, uint32_t, zoneid_t, zoneid_t, uintptr_t *);
315bd670b35SErik Nordmark extern int	ip_postfrag_multirt_v6(mblk_t *, struct nce_s *,
316bd670b35SErik Nordmark     iaflags_t, uint_t, uint32_t, zoneid_t, zoneid_t, uintptr_t *);
317bd670b35SErik Nordmark 
318bd670b35SErik Nordmark extern void	ip_postfrag_loopback(mblk_t *, struct nce_s *,
319bd670b35SErik Nordmark     iaflags_t, uint_t, zoneid_t);
320bd670b35SErik Nordmark extern int	ire_revalidate_nce(ire_t *);
321bd670b35SErik Nordmark 
322bd670b35SErik Nordmark extern ire_t	*ip_select_route_pkt(mblk_t *, ip_xmit_attr_t *,
323bd670b35SErik Nordmark     uint_t *, int *, boolean_t *);
324bd670b35SErik Nordmark extern ire_t	*ip_select_route(const in6_addr_t *, ip_xmit_attr_t *,
325bd670b35SErik Nordmark     uint_t *, in6_addr_t *, int *, boolean_t *);
326bd670b35SErik Nordmark extern ire_t	*ip_select_route_v4(ipaddr_t, ip_xmit_attr_t *,
327bd670b35SErik Nordmark     uint_t *, ipaddr_t *, int *, boolean_t *);
328bd670b35SErik Nordmark extern ire_t	*ip_select_route_v6(const in6_addr_t *, ip_xmit_attr_t *,
329bd670b35SErik Nordmark     uint_t *, in6_addr_t *, int *, boolean_t *);
3307c478bd9Sstevel@tonic-gate 
331f4b3ec61Sdh155122 extern	void	ire_walk(pfv_t, void *, ip_stack_t *);
33245916cd2Sjpk extern	void	ire_walk_ill(uint_t, uint_t, pfv_t, void *, ill_t *);
333f4b3ec61Sdh155122 extern	void	ire_walk_v4(pfv_t, void *, zoneid_t, ip_stack_t *);
334c793af95Ssangeeta extern  void	ire_walk_ill_tables(uint_t match_flags, uint_t ire_type,
335c793af95Ssangeeta     pfv_t func, void *arg, size_t ftbl_sz, size_t htbl_sz,
336bd670b35SErik Nordmark     irb_t **ipftbl, ill_t *ill,
337f4b3ec61Sdh155122     zoneid_t zoneid, ip_stack_t *);
338f4b3ec61Sdh155122 extern	void	ire_walk_v6(pfv_t, void *, zoneid_t, ip_stack_t *);
3397c478bd9Sstevel@tonic-gate 
340c793af95Ssangeeta extern boolean_t	ire_match_args(ire_t *, ipaddr_t, ipaddr_t, ipaddr_t,
341bd670b35SErik Nordmark     int, const ill_t *, zoneid_t, const struct ts_label_s *, int);
342bd670b35SErik Nordmark extern boolean_t	ire_match_args_v6(ire_t *, const in6_addr_t *,
343bd670b35SErik Nordmark     const in6_addr_t *, const in6_addr_t *, int, const ill_t *, zoneid_t,
344bd670b35SErik Nordmark     const ts_label_t *, int);
345bd670b35SErik Nordmark 
346bd670b35SErik Nordmark extern  struct nce_s	*arp_nce_init(ill_t *, in_addr_t, int);
347c793af95Ssangeeta extern  boolean_t	ire_walk_ill_match(uint_t, uint_t, ire_t *, ill_t *,
348f4b3ec61Sdh155122     zoneid_t, ip_stack_t *);
349bd670b35SErik Nordmark extern  void ire_increment_generation(ire_t *);
350bd670b35SErik Nordmark extern  void ire_increment_multicast_generation(ip_stack_t *, boolean_t);
351c793af95Ssangeeta 
3527c478bd9Sstevel@tonic-gate #endif /* _KERNEL */
3537c478bd9Sstevel@tonic-gate 
3547c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3557c478bd9Sstevel@tonic-gate }
3567c478bd9Sstevel@tonic-gate #endif
3577c478bd9Sstevel@tonic-gate 
3587c478bd9Sstevel@tonic-gate #endif	/* _INET_IP_IRE_H */
359