xref: /illumos-gate/usr/src/uts/common/inet/ip_ire.h (revision 5597b60aeb68a38553f85c035a2b400ba7a22a50)
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 /*
2245916cd2Sjpk  * Copyright 2006 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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
337c478bd9Sstevel@tonic-gate extern "C" {
347c478bd9Sstevel@tonic-gate #endif
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #define	IPV6_LL_PREFIXLEN	10	/* Number of bits in link-local pref */
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #define	IP_CACHE_TABLE_SIZE	256
397c478bd9Sstevel@tonic-gate #define	IP_MRTUN_TABLE_SIZE	256	/* Mobile IP reverse tunnel table */
407c478bd9Sstevel@tonic-gate 					/* size. Only used by mipagent */
417c478bd9Sstevel@tonic-gate #define	IP_SRCIF_TABLE_SIZE	256	/* Per interface routing table size */
427c478bd9Sstevel@tonic-gate #define	IP_MASK_TABLE_SIZE	(IP_ABITS + 1)		/* 33 ptrs */
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate #define	IP6_FTABLE_HASH_SIZE	32	/* size of each hash table in ptrs */
457c478bd9Sstevel@tonic-gate #define	IP6_CACHE_TABLE_SIZE	256
467c478bd9Sstevel@tonic-gate #define	IP6_MASK_TABLE_SIZE	(IPV6_ABITS + 1)	/* 129 ptrs */
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate /*
497c478bd9Sstevel@tonic-gate  * We use the common modulo hash function.  In ip_ire_init(), we make
507c478bd9Sstevel@tonic-gate  * sure that the cache table size is always a power of 2.  That's why
517c478bd9Sstevel@tonic-gate  * we can use & instead of %.  Also note that we try hard to make sure
527c478bd9Sstevel@tonic-gate  * the lower bits of an address capture most info from the whole address.
537c478bd9Sstevel@tonic-gate  * The reason being that since our hash table is probably a lot smaller
547c478bd9Sstevel@tonic-gate  * than 2^32 buckets so the lower bits are the most important.
557c478bd9Sstevel@tonic-gate  */
567c478bd9Sstevel@tonic-gate #define	IRE_ADDR_HASH(addr, table_size) \
577c478bd9Sstevel@tonic-gate 	(((addr) ^ ((addr) >> 8) ^ ((addr) >> 16) ^ ((addr) >> 24)) &	\
587c478bd9Sstevel@tonic-gate 	((table_size) - 1))
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate /*
617c478bd9Sstevel@tonic-gate  * Exclusive-or those bytes that are likely to contain the MAC
627c478bd9Sstevel@tonic-gate  * address.  Assumes EUI-64 format for good hashing.
637c478bd9Sstevel@tonic-gate  */
647c478bd9Sstevel@tonic-gate #define	IRE_ADDR_HASH_V6(addr, table_size) 				\
657c478bd9Sstevel@tonic-gate 	(((addr).s6_addr32[3] ^						\
667c478bd9Sstevel@tonic-gate 	(((addr).s6_addr32[3] ^ (addr).s6_addr32[2]) >> 12)) &		\
677c478bd9Sstevel@tonic-gate 	((table_size) - 1))
687c478bd9Sstevel@tonic-gate /* This assumes that the ftable size is a power of 2. */
697c478bd9Sstevel@tonic-gate #define	IRE_ADDR_MASK_HASH_V6(addr, mask, table_size) 			\
707c478bd9Sstevel@tonic-gate 	((((addr).s6_addr8[8] & (mask).s6_addr8[8]) ^ 			\
717c478bd9Sstevel@tonic-gate 	((addr).s6_addr8[9] & (mask).s6_addr8[9]) ^			\
727c478bd9Sstevel@tonic-gate 	((addr).s6_addr8[10] & (mask).s6_addr8[10]) ^ 			\
737c478bd9Sstevel@tonic-gate 	((addr).s6_addr8[13] & (mask).s6_addr8[13]) ^ 			\
747c478bd9Sstevel@tonic-gate 	((addr).s6_addr8[14] & (mask).s6_addr8[14]) ^ 			\
757c478bd9Sstevel@tonic-gate 	((addr).s6_addr8[15] & (mask).s6_addr8[15])) & ((table_size) - 1))
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate /*
787c478bd9Sstevel@tonic-gate  * match parameter definitions for
797c478bd9Sstevel@tonic-gate  * IRE lookup routines.
807c478bd9Sstevel@tonic-gate  */
817c478bd9Sstevel@tonic-gate #define	MATCH_IRE_DSTONLY	0x0000	/* Match just the address */
827c478bd9Sstevel@tonic-gate #define	MATCH_IRE_TYPE		0x0001	/* Match IRE type */
837c478bd9Sstevel@tonic-gate #define	MATCH_IRE_SRC		0x0002	/* Match IRE source address */
847c478bd9Sstevel@tonic-gate #define	MATCH_IRE_MASK		0x0004	/* Match IRE mask */
857c478bd9Sstevel@tonic-gate #define	MATCH_IRE_WQ		0x0008	/* Match IRE Write Q */
867c478bd9Sstevel@tonic-gate #define	MATCH_IRE_GW		0x0010	/* Match IRE gateway */
877c478bd9Sstevel@tonic-gate #define	MATCH_IRE_IPIF		0x0020	/* Match IRE ipif */
887c478bd9Sstevel@tonic-gate #define	MATCH_IRE_RECURSIVE	0x0040	/* Do recursive lookup if necessary */
897c478bd9Sstevel@tonic-gate #define	MATCH_IRE_DEFAULT	0x0080	/* Return default route if no route */
907c478bd9Sstevel@tonic-gate 					/* found. */
917c478bd9Sstevel@tonic-gate #define	MATCH_IRE_RJ_BHOLE	0x0100	/* During lookup if we hit an ire */
927c478bd9Sstevel@tonic-gate 					/* with RTF_REJECT or RTF_BLACKHOLE, */
937c478bd9Sstevel@tonic-gate 					/* return the ire. No recursive */
947c478bd9Sstevel@tonic-gate 					/* lookup should be done. */
957c478bd9Sstevel@tonic-gate #define	MATCH_IRE_IHANDLE	0x0200	/* Match IRE on ihandle */
967c478bd9Sstevel@tonic-gate #define	MATCH_IRE_MARK_HIDDEN	0x0400	/* Match IRE ire_marks with */
977c478bd9Sstevel@tonic-gate 					/* IRE_MARK_HIDDEN. */
987c478bd9Sstevel@tonic-gate /*
997c478bd9Sstevel@tonic-gate  * MATCH_IRE_ILL is used whenever we want to specifically match an IRE
1007c478bd9Sstevel@tonic-gate  * whose ire_ipif->ipif_ill or (ill_t *)ire_stq->q_ptr matches a given
1017c478bd9Sstevel@tonic-gate  * ill. When MATCH_IRE_ILL is used to locate an IRE_CACHE, it implies
1027c478bd9Sstevel@tonic-gate  * that the packet will not be load balanced. This is normally used
1037c478bd9Sstevel@tonic-gate  * by in.mpathd to send out failure detection probes.
1047c478bd9Sstevel@tonic-gate  *
1057c478bd9Sstevel@tonic-gate  * MATCH_IRE_ILL_GROUP is used whenever we are not specific about which
1067c478bd9Sstevel@tonic-gate  * interface (ill) the packet should be sent out. This implies that the
1077c478bd9Sstevel@tonic-gate  * packets will be subjected to load balancing and it might go out on
1087c478bd9Sstevel@tonic-gate  * any interface in the group. When there is only interface in the group,
1097c478bd9Sstevel@tonic-gate  * MATCH_IRE_ILL_GROUP becomes MATCH_IRE_ILL. Most of the code uses
1107c478bd9Sstevel@tonic-gate  * MATCH_IRE_ILL_GROUP and MATCH_IRE_ILL is used in very few cases where
1117c478bd9Sstevel@tonic-gate  * we want to disable load balancing.
1127c478bd9Sstevel@tonic-gate  *
1137c478bd9Sstevel@tonic-gate  * MATCH_IRE_PARENT is used whenever we unconditionally want to get the
1147c478bd9Sstevel@tonic-gate  * parent IRE (sire) while recursively searching IREs for an offsubnet
1157c478bd9Sstevel@tonic-gate  * destination. With this flag, even if no IRE_CACHETABLE or IRE_INTERFACE
1167c478bd9Sstevel@tonic-gate  * is found to help resolving IRE_OFFSUBNET in lookup routines, the
1177c478bd9Sstevel@tonic-gate  * IRE_OFFSUBNET sire, if any, is returned to the caller.
1187c478bd9Sstevel@tonic-gate  */
1197c478bd9Sstevel@tonic-gate #define	MATCH_IRE_ILL_GROUP	0x0800	/* Match IRE on ill or the ill_group. */
1207c478bd9Sstevel@tonic-gate #define	MATCH_IRE_ILL		0x1000	/* Match IRE on the ill only */
1217c478bd9Sstevel@tonic-gate 
1227c478bd9Sstevel@tonic-gate #define	MATCH_IRE_PARENT	0x2000	/* Match parent ire, if any, */
1237c478bd9Sstevel@tonic-gate 					/* even if ire is not matched. */
1247c478bd9Sstevel@tonic-gate #define	MATCH_IRE_ZONEONLY	0x4000	/* Match IREs in specified zone, ie */
1257c478bd9Sstevel@tonic-gate 					/* don't match IRE_LOCALs from other */
1267c478bd9Sstevel@tonic-gate 					/* zones or shared IREs */
12743d18f1cSpriyanka #define	MATCH_IRE_MARK_PRIVATE_ADDR	0x8000	/* Match IRE ire_marks with */
12843d18f1cSpriyanka 						/* IRE_MARK_PRIVATE_ADDR. */
12945916cd2Sjpk #define	MATCH_IRE_SECATTR	0x10000	/* Match gateway security attributes */
130c793af95Ssangeeta #define	MATCH_IRE_COMPLETE	0x20000	/* ire_ftable_lookup() can return */
131c793af95Ssangeeta 					/* IRE_CACHE entry only if it is  */
132c793af95Ssangeeta 					/* ND_REACHABLE			  */
133c793af95Ssangeeta 
134c793af95Ssangeeta /*
135c793af95Ssangeeta  * Any ire to nce association is long term, and
136c793af95Ssangeeta  * the refhold and refrele may be done by different
137c793af95Ssangeeta  * threads. So all cases of making or breaking ire to
138c793af95Ssangeeta  * nce association should all effectively use the NOTR variants.
139c793af95Ssangeeta  * To understand the *effectively* part read on.
140c793af95Ssangeeta  *
141c793af95Ssangeeta  * ndp_lookup() and ndp_add() implicitly does NCE_REFHOLD. So wherever we
142c793af95Ssangeeta  * make ire to nce association after calling these functions,
143c793af95Ssangeeta  * we effectively want to end up with NCE_REFHOLD_NOTR,
144c793af95Ssangeeta  * We call this macro to achieve this effect. This macro changes
145c793af95Ssangeeta  * a NCE_REFHOLD to a NCE_REFHOLD_NOTR. The macro's NCE_REFRELE
146c793af95Ssangeeta  * cancels off ndp_lookup[ndp_add]'s implicit NCE_REFHOLD, and what
147c793af95Ssangeeta  * you are left with is a NCE_REFHOLD_NOTR
148c793af95Ssangeeta  */
149c793af95Ssangeeta #define	NCE_REFHOLD_TO_REFHOLD_NOTR(nce) {	\
150c793af95Ssangeeta 	NCE_REFHOLD_NOTR(nce);			\
151c793af95Ssangeeta 	NCE_REFRELE(nce);			\
152c793af95Ssangeeta }
1537c478bd9Sstevel@tonic-gate 
1547c478bd9Sstevel@tonic-gate /* Structure for ire_cache_count() */
1557c478bd9Sstevel@tonic-gate typedef struct {
1567c478bd9Sstevel@tonic-gate 	int	icc_total;	/* Total number of IRE_CACHE */
1577c478bd9Sstevel@tonic-gate 	int	icc_unused;	/* # off/no PMTU unused since last reclaim */
1587c478bd9Sstevel@tonic-gate 	int	icc_offlink;	/* # offlink without PMTU information */
1597c478bd9Sstevel@tonic-gate 	int	icc_pmtu;	/* # offlink with PMTU information */
1607c478bd9Sstevel@tonic-gate 	int	icc_onlink;	/* # onlink */
1617c478bd9Sstevel@tonic-gate } ire_cache_count_t;
1627c478bd9Sstevel@tonic-gate 
1637c478bd9Sstevel@tonic-gate /*
1647c478bd9Sstevel@tonic-gate  * Structure for ire_cache_reclaim(). Each field is a fraction i.e. 1 meaning
1657c478bd9Sstevel@tonic-gate  * reclaim all, N meaning reclaim 1/Nth of all entries, 0 meaning reclaim none.
1667c478bd9Sstevel@tonic-gate  */
1677c478bd9Sstevel@tonic-gate typedef struct {
1687c478bd9Sstevel@tonic-gate 	int	icr_unused;	/* Fraction for unused since last reclaim */
1697c478bd9Sstevel@tonic-gate 	int	icr_offlink;	/* Fraction for offlink without PMTU info */
1707c478bd9Sstevel@tonic-gate 	int	icr_pmtu;	/* Fraction for offlink with PMTU info */
1717c478bd9Sstevel@tonic-gate 	int	icr_onlink;	/* Fraction for onlink */
1727c478bd9Sstevel@tonic-gate } ire_cache_reclaim_t;
1737c478bd9Sstevel@tonic-gate 
1747c478bd9Sstevel@tonic-gate typedef struct {
1757c478bd9Sstevel@tonic-gate 	uint64_t ire_stats_alloced;	/* # of ires alloced */
1767c478bd9Sstevel@tonic-gate 	uint64_t ire_stats_freed;	/* # of ires freed */
1777c478bd9Sstevel@tonic-gate 	uint64_t ire_stats_inserted;	/* # of ires inserted in the bucket */
1787c478bd9Sstevel@tonic-gate 	uint64_t ire_stats_deleted;	/* # of ires deleted from the bucket */
1797c478bd9Sstevel@tonic-gate } ire_stats_t;
1807c478bd9Sstevel@tonic-gate 
1817c478bd9Sstevel@tonic-gate extern ire_stats_t ire_stats_v4;
182c793af95Ssangeeta extern uint32_t ip_cache_table_size;
183c793af95Ssangeeta extern uint32_t ip6_cache_table_size;
184c793af95Ssangeeta extern irb_t *ip_cache_table;
185c793af95Ssangeeta extern uint32_t ip6_ftable_hash_size;
1867c478bd9Sstevel@tonic-gate 
1877c478bd9Sstevel@tonic-gate /*
1887c478bd9Sstevel@tonic-gate  * We use atomics so that we get an accurate accounting on the ires.
1897c478bd9Sstevel@tonic-gate  * Otherwise we can't determine leaks correctly.
1907c478bd9Sstevel@tonic-gate  */
1917c478bd9Sstevel@tonic-gate #define	BUMP_IRE_STATS(ire_stats, x) atomic_add_64(&(ire_stats).x, 1)
1927c478bd9Sstevel@tonic-gate 
1937c478bd9Sstevel@tonic-gate extern irb_t *ip_forwarding_table_v6[];
1947c478bd9Sstevel@tonic-gate extern irb_t *ip_cache_table_v6;
1957c478bd9Sstevel@tonic-gate extern irb_t *ip_mrtun_table;
1967c478bd9Sstevel@tonic-gate extern irb_t *ip_srcif_table;
1977c478bd9Sstevel@tonic-gate extern kmutex_t ire_ft_init_lock;
1987c478bd9Sstevel@tonic-gate extern kmutex_t	ire_mrtun_lock;
1997c478bd9Sstevel@tonic-gate extern kmutex_t ire_srcif_table_lock;
2007c478bd9Sstevel@tonic-gate extern ire_stats_t ire_stats_v6;
2017c478bd9Sstevel@tonic-gate extern uint_t	ire_mrtun_count;
2027c478bd9Sstevel@tonic-gate extern uint_t ire_srcif_table_count;
2037c478bd9Sstevel@tonic-gate 
2047c478bd9Sstevel@tonic-gate #ifdef _KERNEL
20545916cd2Sjpk struct ts_label_s;
20645916cd2Sjpk 
2077c478bd9Sstevel@tonic-gate extern	ipaddr_t	ip_plen_to_mask(uint_t);
2087c478bd9Sstevel@tonic-gate extern	in6_addr_t	*ip_plen_to_mask_v6(uint_t, in6_addr_t *);
2097c478bd9Sstevel@tonic-gate 
2107c478bd9Sstevel@tonic-gate extern	int	ip_ire_advise(queue_t *, mblk_t *, cred_t *);
2117c478bd9Sstevel@tonic-gate extern	int	ip_ire_delete(queue_t *, mblk_t *, cred_t *);
2127c478bd9Sstevel@tonic-gate extern	boolean_t ip_ire_clookup_and_delete(ipaddr_t, ipif_t *);
2137c478bd9Sstevel@tonic-gate extern	void	ip_ire_clookup_and_delete_v6(const in6_addr_t *);
2147c478bd9Sstevel@tonic-gate 
2157c478bd9Sstevel@tonic-gate extern	int	ip_ire_report(queue_t *, mblk_t *, caddr_t, cred_t *);
2167c478bd9Sstevel@tonic-gate extern	int	ip_ire_report_mrtun(queue_t *, mblk_t *, caddr_t, cred_t *);
2177c478bd9Sstevel@tonic-gate extern	int	ip_ire_report_srcif(queue_t *, mblk_t *, caddr_t, cred_t *);
2187c478bd9Sstevel@tonic-gate extern	int	ip_ire_report_v6(queue_t *, mblk_t *, caddr_t, cred_t *);
219c793af95Ssangeeta extern	void	ire_report_ftable(ire_t *, char *);
2207c478bd9Sstevel@tonic-gate 
2217c478bd9Sstevel@tonic-gate extern	void	ip_ire_req(queue_t *, mblk_t *);
2227c478bd9Sstevel@tonic-gate 
2237c478bd9Sstevel@tonic-gate extern	int	ip_mask_to_plen(ipaddr_t);
2247c478bd9Sstevel@tonic-gate extern	int	ip_mask_to_plen_v6(const in6_addr_t *);
2257c478bd9Sstevel@tonic-gate 
22645916cd2Sjpk extern	ire_t	*ipif_to_ire(const ipif_t *);
22745916cd2Sjpk extern	ire_t	*ipif_to_ire_v6(const ipif_t *);
2287c478bd9Sstevel@tonic-gate 
229c793af95Ssangeeta extern	int	ire_add(ire_t **, queue_t *, mblk_t *, ipsq_func_t, boolean_t);
2307c478bd9Sstevel@tonic-gate extern	int	ire_add_mrtun(ire_t **, queue_t *, mblk_t *, ipsq_func_t);
2317c478bd9Sstevel@tonic-gate extern	void	ire_add_then_send(queue_t *, ire_t *, mblk_t *);
2327c478bd9Sstevel@tonic-gate extern	int	ire_add_v6(ire_t **, queue_t *, mblk_t *, ipsq_func_t);
2337c478bd9Sstevel@tonic-gate extern	int	ire_atomic_start(irb_t *irb_ptr, ire_t *ire, queue_t *q,
2347c478bd9Sstevel@tonic-gate     mblk_t *mp, ipsq_func_t func);
2357c478bd9Sstevel@tonic-gate extern	void	ire_atomic_end(irb_t *irb_ptr, ire_t *ire);
2367c478bd9Sstevel@tonic-gate 
2377c478bd9Sstevel@tonic-gate extern	void	ire_cache_count(ire_t *, char *);
23845916cd2Sjpk extern	ire_t	*ire_cache_lookup(ipaddr_t, zoneid_t,
23945916cd2Sjpk     const struct ts_label_s *);
24045916cd2Sjpk extern	ire_t	*ire_cache_lookup_v6(const in6_addr_t *, zoneid_t,
24145916cd2Sjpk     const struct ts_label_s *);
2427c478bd9Sstevel@tonic-gate extern	void	ire_cache_reclaim(ire_t *, char *);
2437c478bd9Sstevel@tonic-gate 
2447c478bd9Sstevel@tonic-gate extern	void	ire_check_bcast_present(ipif_t *, ipaddr_t, int, boolean_t *,
2457c478bd9Sstevel@tonic-gate     boolean_t *);
24645916cd2Sjpk 
2477c478bd9Sstevel@tonic-gate extern	ire_t	*ire_create_mp(uchar_t *, uchar_t *, uchar_t *, uchar_t *,
2487c478bd9Sstevel@tonic-gate     uchar_t *, uint_t, mblk_t *, queue_t *, queue_t *, ushort_t, mblk_t *,
24945916cd2Sjpk     ipif_t *, ill_t *, ipaddr_t, uint32_t, uint32_t, uint32_t, const iulp_t *,
25045916cd2Sjpk     tsol_gc_t *, tsol_gcgrp_t *);
2517c478bd9Sstevel@tonic-gate 
2527c478bd9Sstevel@tonic-gate extern	ire_t	*ire_create(uchar_t *, uchar_t *, uchar_t *, uchar_t *,
2537c478bd9Sstevel@tonic-gate     uchar_t *, uint_t *, mblk_t *, queue_t *, queue_t *, ushort_t, mblk_t *,
25445916cd2Sjpk     ipif_t *, ill_t *, ipaddr_t, uint32_t, uint32_t, uint32_t, const iulp_t *,
25545916cd2Sjpk     tsol_gc_t *, tsol_gcgrp_t *);
2567c478bd9Sstevel@tonic-gate 
2577c478bd9Sstevel@tonic-gate extern	ire_t	**ire_check_and_create_bcast(ipif_t *, ipaddr_t,
2587c478bd9Sstevel@tonic-gate     ire_t **, int);
2597c478bd9Sstevel@tonic-gate extern	ire_t	**ire_create_bcast(ipif_t *, ipaddr_t, ire_t **);
2607c478bd9Sstevel@tonic-gate extern	ire_t	*ire_init(ire_t *, uchar_t *, uchar_t *, uchar_t *,
2617c478bd9Sstevel@tonic-gate     uchar_t *, uchar_t *, uint_t *, mblk_t *, queue_t *, queue_t *, ushort_t,
2627c478bd9Sstevel@tonic-gate     mblk_t *, ipif_t *, ill_t *, ipaddr_t, uint32_t, uint32_t, uint32_t,
26345916cd2Sjpk     const iulp_t *, tsol_gc_t *, tsol_gcgrp_t *);
2647c478bd9Sstevel@tonic-gate 
26545916cd2Sjpk extern	boolean_t ire_init_common(ire_t *, uint_t *, mblk_t *, queue_t *,
2667c478bd9Sstevel@tonic-gate     queue_t *, ushort_t, mblk_t *, ipif_t *, ill_t *, uint32_t,
26745916cd2Sjpk     uint32_t, uint32_t, uchar_t, const iulp_t *, tsol_gc_t *, tsol_gcgrp_t *);
2687c478bd9Sstevel@tonic-gate 
2697c478bd9Sstevel@tonic-gate extern	ire_t	*ire_create_v6(const in6_addr_t *, const in6_addr_t *,
2707c478bd9Sstevel@tonic-gate     const in6_addr_t *, const in6_addr_t *, uint_t *, mblk_t *, queue_t *,
2717c478bd9Sstevel@tonic-gate     queue_t *, ushort_t, mblk_t *, ipif_t *,
27245916cd2Sjpk     const in6_addr_t *, uint32_t, uint32_t, uint_t, const iulp_t *,
27345916cd2Sjpk     tsol_gc_t *, tsol_gcgrp_t *);
2747c478bd9Sstevel@tonic-gate 
2757c478bd9Sstevel@tonic-gate extern	ire_t	*ire_create_mp_v6(const in6_addr_t *, const in6_addr_t *,
2767c478bd9Sstevel@tonic-gate     const in6_addr_t *, const in6_addr_t *, mblk_t *, queue_t *,
2777c478bd9Sstevel@tonic-gate     queue_t *, ushort_t, mblk_t *, ipif_t *,
27845916cd2Sjpk     const in6_addr_t *, uint32_t, uint32_t, uint_t, const iulp_t *,
27945916cd2Sjpk     tsol_gc_t *, tsol_gcgrp_t *);
2807c478bd9Sstevel@tonic-gate 
2817c478bd9Sstevel@tonic-gate extern	ire_t	*ire_init_v6(ire_t *, const in6_addr_t *, const in6_addr_t *,
2827c478bd9Sstevel@tonic-gate     const in6_addr_t *, const in6_addr_t *, uint_t *, mblk_t *, queue_t *,
2837c478bd9Sstevel@tonic-gate     queue_t *, ushort_t, mblk_t *, ipif_t *,
28445916cd2Sjpk     const in6_addr_t *, uint32_t, uint32_t, uint_t, const iulp_t *,
28545916cd2Sjpk     tsol_gc_t *, tsol_gcgrp_t *);
2867c478bd9Sstevel@tonic-gate 
28745916cd2Sjpk extern	void	ire_clookup_delete_cache_gw(ipaddr_t, zoneid_t);
28845916cd2Sjpk extern	void	ire_clookup_delete_cache_gw_v6(const in6_addr_t *, zoneid_t);
28945916cd2Sjpk 
29045916cd2Sjpk extern	ire_t	*ire_ctable_lookup(ipaddr_t, ipaddr_t, int, const ipif_t *,
29145916cd2Sjpk     zoneid_t, const struct ts_label_s *, int);
2927c478bd9Sstevel@tonic-gate 
2937c478bd9Sstevel@tonic-gate extern	ire_t	*ire_ctable_lookup_v6(const in6_addr_t *, const in6_addr_t *,
29445916cd2Sjpk     int, const ipif_t *, zoneid_t, const struct ts_label_s *, int);
2957c478bd9Sstevel@tonic-gate 
2967c478bd9Sstevel@tonic-gate extern	void	ire_delete(ire_t *);
2977c478bd9Sstevel@tonic-gate extern	void	ire_delete_cache_gw(ire_t *, char *);
2987c478bd9Sstevel@tonic-gate extern	void	ire_delete_cache_gw_v6(ire_t *, char *);
2997c478bd9Sstevel@tonic-gate extern	void	ire_delete_cache_v6(ire_t *, char *);
3007c478bd9Sstevel@tonic-gate extern	void	ire_delete_srcif(ire_t *);
3017c478bd9Sstevel@tonic-gate extern	void	ire_delete_v6(ire_t *);
3027c478bd9Sstevel@tonic-gate 
3037c478bd9Sstevel@tonic-gate extern	void	ire_expire(ire_t *, char *);
3047c478bd9Sstevel@tonic-gate extern	void	ire_fastpath_flush(ire_t *, void *);
3057c478bd9Sstevel@tonic-gate extern	boolean_t ire_fastpath_update(ire_t *, void *);
3067c478bd9Sstevel@tonic-gate 
3077c478bd9Sstevel@tonic-gate extern	void	ire_flush_cache_v4(ire_t *, int);
3087c478bd9Sstevel@tonic-gate extern	void	ire_flush_cache_v6(ire_t *, int);
3097c478bd9Sstevel@tonic-gate 
3107c478bd9Sstevel@tonic-gate extern	ire_t	*ire_ftable_lookup_v6(const in6_addr_t *, const in6_addr_t *,
31145916cd2Sjpk     const in6_addr_t *, int, const ipif_t *, ire_t **, zoneid_t,
31245916cd2Sjpk     uint32_t, const struct ts_label_s *, int);
3137c478bd9Sstevel@tonic-gate 
3147c478bd9Sstevel@tonic-gate extern	ire_t	*ire_ihandle_lookup_onlink(ire_t *);
3157c478bd9Sstevel@tonic-gate extern	ire_t	*ire_ihandle_lookup_offlink(ire_t *, ire_t *);
3167c478bd9Sstevel@tonic-gate extern	ire_t	*ire_ihandle_lookup_offlink_v6(ire_t *, ire_t *);
3177c478bd9Sstevel@tonic-gate 
318*5597b60aSnordmark extern	boolean_t	ire_local_same_ill_group(ire_t *, ire_t *);
319*5597b60aSnordmark extern	boolean_t	ire_local_ok_across_zones(ire_t *, zoneid_t, void *,
320*5597b60aSnordmark 			    const struct ts_label_s *tsl);
321*5597b60aSnordmark 
3227c478bd9Sstevel@tonic-gate extern	ire_t 	*ire_lookup_local(zoneid_t);
3237c478bd9Sstevel@tonic-gate extern	ire_t 	*ire_lookup_local_v6(zoneid_t);
3247c478bd9Sstevel@tonic-gate 
3257c478bd9Sstevel@tonic-gate extern  ire_t	*ire_lookup_multi(ipaddr_t, zoneid_t);
3267c478bd9Sstevel@tonic-gate extern  ire_t	*ire_lookup_multi_v6(const in6_addr_t *, zoneid_t);
3277c478bd9Sstevel@tonic-gate 
3287c478bd9Sstevel@tonic-gate extern ire_t	*ire_mrtun_lookup(ipaddr_t, ill_t *);
3297c478bd9Sstevel@tonic-gate 
3307c478bd9Sstevel@tonic-gate extern	void	ire_refrele(ire_t *);
3317c478bd9Sstevel@tonic-gate extern	void	ire_refrele_notr(ire_t *);
33245916cd2Sjpk extern	ire_t	*ire_route_lookup(ipaddr_t, ipaddr_t, ipaddr_t, int,
33345916cd2Sjpk     const ipif_t *, ire_t **, zoneid_t, const struct ts_label_s *, int);
3347c478bd9Sstevel@tonic-gate 
3357c478bd9Sstevel@tonic-gate extern	ire_t	*ire_route_lookup_v6(const in6_addr_t *, const in6_addr_t *,
33645916cd2Sjpk     const in6_addr_t *, int, const ipif_t *, ire_t **, zoneid_t,
33745916cd2Sjpk     const struct ts_label_s *, int);
3387c478bd9Sstevel@tonic-gate 
3397c478bd9Sstevel@tonic-gate extern	ire_t	*ire_srcif_table_lookup(ipaddr_t, int, ipif_t *, ill_t *, int);
34045916cd2Sjpk extern ill_t	*ire_to_ill(const ire_t *);
3417c478bd9Sstevel@tonic-gate 
34245916cd2Sjpk extern	void	ire_walk(pfv_t, void *);
34345916cd2Sjpk extern	void	ire_walk_ill(uint_t, uint_t, pfv_t, void *, ill_t *);
3447c478bd9Sstevel@tonic-gate extern	void	ire_walk_ill_mrtun(uint_t, uint_t, pfv_t, void *, ill_t *);
34545916cd2Sjpk extern	void	ire_walk_ill_v4(uint_t, uint_t, pfv_t, void *, ill_t *);
34645916cd2Sjpk extern	void	ire_walk_ill_v6(uint_t, uint_t, pfv_t, void *, ill_t *);
34745916cd2Sjpk extern	void	ire_walk_v4(pfv_t, void *, zoneid_t);
348c793af95Ssangeeta extern  void	ire_walk_ill_tables(uint_t match_flags, uint_t ire_type,
349c793af95Ssangeeta     pfv_t func, void *arg, size_t ftbl_sz, size_t htbl_sz,
350c793af95Ssangeeta     irb_t **ipftbl, size_t ctbl_sz, irb_t *ipctbl, ill_t *ill,
351c793af95Ssangeeta     zoneid_t zoneid);
35245916cd2Sjpk extern	void	ire_walk_srcif_table_v4(pfv_t, void *);
35345916cd2Sjpk extern	void	ire_walk_v6(pfv_t, void *, zoneid_t);
3547c478bd9Sstevel@tonic-gate 
35545916cd2Sjpk extern boolean_t	ire_multirt_lookup(ire_t **, ire_t **, uint32_t,
35645916cd2Sjpk     const struct ts_label_s *);
35745916cd2Sjpk extern boolean_t	ire_multirt_need_resolve(ipaddr_t,
35845916cd2Sjpk     const struct ts_label_s *);
35945916cd2Sjpk extern boolean_t	ire_multirt_lookup_v6(ire_t **, ire_t **, uint32_t,
36045916cd2Sjpk     const struct ts_label_s *);
36145916cd2Sjpk extern boolean_t	ire_multirt_need_resolve_v6(const in6_addr_t *,
36245916cd2Sjpk     const struct ts_label_s *);
3637c478bd9Sstevel@tonic-gate 
3647c478bd9Sstevel@tonic-gate extern ire_t	*ipif_lookup_multi_ire(ipif_t *, ipaddr_t);
3657c478bd9Sstevel@tonic-gate extern ire_t	*ipif_lookup_multi_ire_v6(ipif_t *, const in6_addr_t *);
3667c478bd9Sstevel@tonic-gate 
3677c478bd9Sstevel@tonic-gate extern void	ire_fastpath_list_dispatch(ill_t *,
3687c478bd9Sstevel@tonic-gate     boolean_t (*)(ire_t *, void *), void *);
3697c478bd9Sstevel@tonic-gate extern void	ire_fastpath_list_delete(ill_t *, ire_t *);
3707c478bd9Sstevel@tonic-gate 
3717c478bd9Sstevel@tonic-gate extern mblk_t *ip_nexthop_route(const struct sockaddr *, char *);
3727c478bd9Sstevel@tonic-gate extern mblk_t *ip_nexthop(const struct sockaddr *, const char *);
3737c478bd9Sstevel@tonic-gate 
3747c478bd9Sstevel@tonic-gate extern ire_t	*ire_get_next_bcast_ire(ire_t *, ire_t *);
3757c478bd9Sstevel@tonic-gate extern ire_t	*ire_get_next_default_ire(ire_t *, ire_t *);
3767c478bd9Sstevel@tonic-gate 
377c793af95Ssangeeta extern  void	ire_arpresolve(ire_t *,  ill_t *);
378c793af95Ssangeeta extern  void	ire_freemblk(ire_t *);
379c793af95Ssangeeta extern  void	ire_fastpath(ire_t *);
380c793af95Ssangeeta extern boolean_t	ire_match_args(ire_t *, ipaddr_t, ipaddr_t, ipaddr_t,
381c793af95Ssangeeta     int, const ipif_t *, zoneid_t, uint32_t, const struct ts_label_s *, int);
382c793af95Ssangeeta extern  int	ire_nce_init(ire_t *, mblk_t *, mblk_t *);
383c793af95Ssangeeta extern  boolean_t	ire_walk_ill_match(uint_t, uint_t, ire_t *, ill_t *,
384c793af95Ssangeeta     zoneid_t);
385c793af95Ssangeeta 
3867c478bd9Sstevel@tonic-gate #endif /* _KERNEL */
3877c478bd9Sstevel@tonic-gate 
3887c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3897c478bd9Sstevel@tonic-gate }
3907c478bd9Sstevel@tonic-gate #endif
3917c478bd9Sstevel@tonic-gate 
3927c478bd9Sstevel@tonic-gate #endif	/* _INET_IP_IRE_H */
393