xref: /titanic_51/usr/src/uts/common/inet/ip_stack.h (revision f5db8fb084e8d3d9f551ce34defa3c80d56edebc)
1f4b3ec61Sdh155122 /*
2f4b3ec61Sdh155122  * CDDL HEADER START
3f4b3ec61Sdh155122  *
4f4b3ec61Sdh155122  * The contents of this file are subject to the terms of the
5f4b3ec61Sdh155122  * Common Development and Distribution License (the "License").
6f4b3ec61Sdh155122  * You may not use this file except in compliance with the License.
7f4b3ec61Sdh155122  *
8f4b3ec61Sdh155122  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9f4b3ec61Sdh155122  * or http://www.opensolaris.org/os/licensing.
10f4b3ec61Sdh155122  * See the License for the specific language governing permissions
11f4b3ec61Sdh155122  * and limitations under the License.
12f4b3ec61Sdh155122  *
13f4b3ec61Sdh155122  * When distributing Covered Code, include this CDDL HEADER in each
14f4b3ec61Sdh155122  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15f4b3ec61Sdh155122  * If applicable, add the following below this CDDL HEADER, with the
16f4b3ec61Sdh155122  * fields enclosed by brackets "[]" replaced with your own identifying
17f4b3ec61Sdh155122  * information: Portions Copyright [yyyy] [name of copyright owner]
18f4b3ec61Sdh155122  *
19f4b3ec61Sdh155122  * CDDL HEADER END
20f4b3ec61Sdh155122  */
21f4b3ec61Sdh155122 
22f4b3ec61Sdh155122 /*
236e91bba0SGirish Moodalbail  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
24f4b3ec61Sdh155122  * Use is subject to license terms.
25f4b3ec61Sdh155122  */
26f4b3ec61Sdh155122 
27f4b3ec61Sdh155122 #ifndef	_INET_IP_STACK_H
28f4b3ec61Sdh155122 #define	_INET_IP_STACK_H
29f4b3ec61Sdh155122 
30f4b3ec61Sdh155122 #ifdef	__cplusplus
31f4b3ec61Sdh155122 extern "C" {
32f4b3ec61Sdh155122 #endif
33f4b3ec61Sdh155122 
34f4b3ec61Sdh155122 #include <sys/netstack.h>
35f4b3ec61Sdh155122 #include <netinet/igmp_var.h>
36e11c3f44Smeem #include <sys/modhash.h>
37f4b3ec61Sdh155122 
38f4b3ec61Sdh155122 #ifdef _KERNEL
39da14cebeSEric Cheng #include <sys/list.h>
40f4b3ec61Sdh155122 
41bd670b35SErik Nordmark 
42f4b3ec61Sdh155122 /*
43f4b3ec61Sdh155122  * IP statistics.
44f4b3ec61Sdh155122  */
45f4b3ec61Sdh155122 #define	IP_STAT(ipst, x)	((ipst)->ips_ip_statistics.x.value.ui64++)
46f4b3ec61Sdh155122 #define	IP_STAT_UPDATE(ipst, x, n) \
47f4b3ec61Sdh155122 		((ipst)->ips_ip_statistics.x.value.ui64 += (n))
48f4b3ec61Sdh155122 
49f4b3ec61Sdh155122 typedef struct ip_stat {
50f4b3ec61Sdh155122 	kstat_named_t	ip_udp_fannorm;
51f4b3ec61Sdh155122 	kstat_named_t	ip_udp_fanmb;
52bd670b35SErik Nordmark 	kstat_named_t	ip_recv_pullup;
53f4b3ec61Sdh155122 	kstat_named_t	ip_db_ref;
54bd670b35SErik Nordmark 	kstat_named_t	ip_notaligned;
55bd670b35SErik Nordmark 	kstat_named_t	ip_multimblk;
56f4b3ec61Sdh155122 	kstat_named_t	ip_opt;
57f4b3ec61Sdh155122 	kstat_named_t	ipsec_proto_ahesp;
58f4b3ec61Sdh155122 	kstat_named_t	ip_conn_flputbq;
59f4b3ec61Sdh155122 	kstat_named_t	ip_conn_walk_drain;
60f4b3ec61Sdh155122 	kstat_named_t   ip_out_sw_cksum;
61bd670b35SErik Nordmark 	kstat_named_t	ip_out_sw_cksum_bytes;
62f4b3ec61Sdh155122 	kstat_named_t   ip_in_sw_cksum;
63bd670b35SErik Nordmark 	kstat_named_t   ip_ire_reclaim_calls;
64bd670b35SErik Nordmark 	kstat_named_t   ip_ire_reclaim_deleted;
65bd670b35SErik Nordmark 	kstat_named_t   ip_nce_reclaim_calls;
66bd670b35SErik Nordmark 	kstat_named_t   ip_nce_reclaim_deleted;
67bd670b35SErik Nordmark 	kstat_named_t   ip_dce_reclaim_calls;
68bd670b35SErik Nordmark 	kstat_named_t   ip_dce_reclaim_deleted;
69f4b3ec61Sdh155122 	kstat_named_t	ip_tcp_in_full_hw_cksum_err;
70f4b3ec61Sdh155122 	kstat_named_t	ip_tcp_in_part_hw_cksum_err;
71f4b3ec61Sdh155122 	kstat_named_t	ip_tcp_in_sw_cksum_err;
72f4b3ec61Sdh155122 	kstat_named_t	ip_udp_in_full_hw_cksum_err;
73f4b3ec61Sdh155122 	kstat_named_t	ip_udp_in_part_hw_cksum_err;
74f4b3ec61Sdh155122 	kstat_named_t	ip_udp_in_sw_cksum_err;
75bd670b35SErik Nordmark 	kstat_named_t	conn_in_recvdstaddr;
76bd670b35SErik Nordmark 	kstat_named_t	conn_in_recvopts;
77bd670b35SErik Nordmark 	kstat_named_t	conn_in_recvif;
78bd670b35SErik Nordmark 	kstat_named_t	conn_in_recvslla;
79bd670b35SErik Nordmark 	kstat_named_t	conn_in_recvucred;
80bd670b35SErik Nordmark 	kstat_named_t	conn_in_recvttl;
81bd670b35SErik Nordmark 	kstat_named_t	conn_in_recvhopopts;
82bd670b35SErik Nordmark 	kstat_named_t	conn_in_recvhoplimit;
83bd670b35SErik Nordmark 	kstat_named_t	conn_in_recvdstopts;
84bd670b35SErik Nordmark 	kstat_named_t	conn_in_recvrthdrdstopts;
85bd670b35SErik Nordmark 	kstat_named_t	conn_in_recvrthdr;
86bd670b35SErik Nordmark 	kstat_named_t	conn_in_recvpktinfo;
87bd670b35SErik Nordmark 	kstat_named_t	conn_in_recvtclass;
88bd670b35SErik Nordmark 	kstat_named_t	conn_in_timestamp;
89f4b3ec61Sdh155122 } ip_stat_t;
90f4b3ec61Sdh155122 
91f4b3ec61Sdh155122 
92f4b3ec61Sdh155122 /*
93f4b3ec61Sdh155122  * IP6 statistics.
94f4b3ec61Sdh155122  */
95f4b3ec61Sdh155122 #define	IP6_STAT(ipst, x)	((ipst)->ips_ip6_statistics.x.value.ui64++)
96f4b3ec61Sdh155122 #define	IP6_STAT_UPDATE(ipst, x, n)	\
97f4b3ec61Sdh155122 	((ipst)->ips_ip6_statistics.x.value.ui64 += (n))
98f4b3ec61Sdh155122 
99f4b3ec61Sdh155122 typedef struct ip6_stat {
100f4b3ec61Sdh155122 	kstat_named_t	ip6_udp_fannorm;
101f4b3ec61Sdh155122 	kstat_named_t	ip6_udp_fanmb;
102bd670b35SErik Nordmark 	kstat_named_t	ip6_recv_pullup;
103bd670b35SErik Nordmark 	kstat_named_t	ip6_db_ref;
104bd670b35SErik Nordmark 	kstat_named_t	ip6_notaligned;
105bd670b35SErik Nordmark 	kstat_named_t	ip6_multimblk;
106bd670b35SErik Nordmark 	kstat_named_t	ipsec_proto_ahesp;
107f4b3ec61Sdh155122 	kstat_named_t   ip6_out_sw_cksum;
108bd670b35SErik Nordmark 	kstat_named_t	ip6_out_sw_cksum_bytes;
109f4b3ec61Sdh155122 	kstat_named_t   ip6_in_sw_cksum;
110f4b3ec61Sdh155122 	kstat_named_t	ip6_tcp_in_full_hw_cksum_err;
111f4b3ec61Sdh155122 	kstat_named_t	ip6_tcp_in_part_hw_cksum_err;
112f4b3ec61Sdh155122 	kstat_named_t	ip6_tcp_in_sw_cksum_err;
113f4b3ec61Sdh155122 	kstat_named_t	ip6_udp_in_full_hw_cksum_err;
114f4b3ec61Sdh155122 	kstat_named_t	ip6_udp_in_part_hw_cksum_err;
115f4b3ec61Sdh155122 	kstat_named_t	ip6_udp_in_sw_cksum_err;
116f4b3ec61Sdh155122 } ip6_stat_t;
117f4b3ec61Sdh155122 
118f4b3ec61Sdh155122 typedef struct ire_stats {
119f4b3ec61Sdh155122 	uint64_t ire_stats_alloced;	/* # of ires alloced */
120f4b3ec61Sdh155122 	uint64_t ire_stats_freed;	/* # of ires freed */
121f4b3ec61Sdh155122 	uint64_t ire_stats_inserted;	/* # of ires inserted in the bucket */
122f4b3ec61Sdh155122 	uint64_t ire_stats_deleted;	/* # of ires deleted from the bucket */
123f4b3ec61Sdh155122 } ire_stats_t;
124f4b3ec61Sdh155122 
125ae6aa22aSVenugopal Iyer #define	TX_FANOUT_SIZE	128
126ae6aa22aSVenugopal Iyer #define	IDLHASHINDEX(X)	\
127ae6aa22aSVenugopal Iyer 	((((uintptr_t)(X) >> 2) + ((uintptr_t)(X) >> 9)) & (TX_FANOUT_SIZE - 1))
128f4b3ec61Sdh155122 
129d5b6ed4bSVasumathi Sundaram - Sun Microsystems /* Data structure to represent addresses */
130d5b6ed4bSVasumathi Sundaram - Sun Microsystems typedef struct srcid_map {
131d5b6ed4bSVasumathi Sundaram - Sun Microsystems 	struct srcid_map	*sm_next;
132d5b6ed4bSVasumathi Sundaram - Sun Microsystems 	in6_addr_t		sm_addr;	/* Local address */
133d5b6ed4bSVasumathi Sundaram - Sun Microsystems 	uint_t			sm_srcid;	/* source id */
134d5b6ed4bSVasumathi Sundaram - Sun Microsystems 	uint_t			sm_refcnt;	/* > 1 ipif with same addr? */
135d5b6ed4bSVasumathi Sundaram - Sun Microsystems 	zoneid_t		sm_zoneid;	/* zone id */
136d5b6ed4bSVasumathi Sundaram - Sun Microsystems } srcid_map_t;
137d5b6ed4bSVasumathi Sundaram - Sun Microsystems 
138f4b3ec61Sdh155122 /*
139f4b3ec61Sdh155122  * IP stack instances
140f4b3ec61Sdh155122  */
141f4b3ec61Sdh155122 struct ip_stack {
142f4b3ec61Sdh155122 	netstack_t	*ips_netstack;	/* Common netstack */
143f4b3ec61Sdh155122 
144bd670b35SErik Nordmark 	uint_t			ips_src_generation;	/* Both IPv4 and IPv6 */
145bd670b35SErik Nordmark 
1466e91bba0SGirish Moodalbail 	struct mod_prop_info_s	*ips_propinfo_tbl; 	/* ip tunables table */
147f4b3ec61Sdh155122 
148f4b3ec61Sdh155122 	mib2_ipIfStatsEntry_t	ips_ip_mib;	/* SNMP fixed size info */
149f4b3ec61Sdh155122 	mib2_icmp_t	ips_icmp_mib;
150f4b3ec61Sdh155122 	/*
151f4b3ec61Sdh155122 	 * IPv6 mibs when the interface (ill) is not known.
152f4b3ec61Sdh155122 	 * When the ill is known the per-interface mib in the ill is used.
153f4b3ec61Sdh155122 	 */
154f4b3ec61Sdh155122 	mib2_ipIfStatsEntry_t	ips_ip6_mib;
155f4b3ec61Sdh155122 	mib2_ipv6IfIcmpEntry_t	ips_icmp6_mib;
156f4b3ec61Sdh155122 
157f4b3ec61Sdh155122 	struct igmpstat		ips_igmpstat;
158f4b3ec61Sdh155122 
159f4b3ec61Sdh155122 	kstat_t		*ips_ip_mibkp;	/* kstat exporting ip_mib data */
160f4b3ec61Sdh155122 	kstat_t		*ips_icmp_mibkp; /* kstat exporting icmp_mib data */
161f4b3ec61Sdh155122 	kstat_t		*ips_ip_kstat;
162f4b3ec61Sdh155122 	ip_stat_t	ips_ip_statistics;
163f4b3ec61Sdh155122 	kstat_t		*ips_ip6_kstat;
164f4b3ec61Sdh155122 	ip6_stat_t	ips_ip6_statistics;
165f4b3ec61Sdh155122 
166f4b3ec61Sdh155122 /* ip.c */
167f4b3ec61Sdh155122 	kmutex_t	ips_igmp_timer_lock;
168f4b3ec61Sdh155122 	kmutex_t	ips_mld_timer_lock;
169f4b3ec61Sdh155122 	kmutex_t	ips_ip_mi_lock;
170f4b3ec61Sdh155122 	kmutex_t	ips_ip_addr_avail_lock;
171f4b3ec61Sdh155122 	krwlock_t	ips_ill_g_lock;
172f4b3ec61Sdh155122 
173f4b3ec61Sdh155122 	krwlock_t	ips_ill_g_usesrc_lock;
174f4b3ec61Sdh155122 
175da14cebeSEric Cheng 	/* Taskq dispatcher for capability operations */
176da14cebeSEric Cheng 	kmutex_t	ips_capab_taskq_lock;
177da14cebeSEric Cheng 	kcondvar_t	ips_capab_taskq_cv;
1784cc34124SThirumalai Srinivasan 	mblk_t		*ips_capab_taskq_head;
1794cc34124SThirumalai Srinivasan 	mblk_t		*ips_capab_taskq_tail;
180da14cebeSEric Cheng 	kthread_t	*ips_capab_taskq_thread;
181da14cebeSEric Cheng 	boolean_t	ips_capab_taskq_quit;
182da14cebeSEric Cheng 
183f4b3ec61Sdh155122 /* ipclassifier.c - keep in ip_stack_t */
184f4b3ec61Sdh155122 	/* ipclassifier hash tables */
185f4b3ec61Sdh155122 	struct connf_s	*ips_rts_clients;
186f4b3ec61Sdh155122 	struct connf_s	*ips_ipcl_conn_fanout;
187f4b3ec61Sdh155122 	struct connf_s	*ips_ipcl_bind_fanout;
188bd670b35SErik Nordmark 	struct connf_s	*ips_ipcl_proto_fanout_v4;
189f4b3ec61Sdh155122 	struct connf_s	*ips_ipcl_proto_fanout_v6;
190f4b3ec61Sdh155122 	struct connf_s	*ips_ipcl_udp_fanout;
191bd670b35SErik Nordmark 	struct connf_s	*ips_ipcl_raw_fanout;		/* RAW SCTP sockets */
1922b24ab6bSSebastien Roy 	struct connf_s	*ips_ipcl_iptun_fanout;
193f4b3ec61Sdh155122 	uint_t		ips_ipcl_conn_fanout_size;
194f4b3ec61Sdh155122 	uint_t		ips_ipcl_bind_fanout_size;
195f4b3ec61Sdh155122 	uint_t		ips_ipcl_udp_fanout_size;
196f4b3ec61Sdh155122 	uint_t		ips_ipcl_raw_fanout_size;
1972b24ab6bSSebastien Roy 	uint_t		ips_ipcl_iptun_fanout_size;
198f4b3ec61Sdh155122 	struct connf_s	*ips_ipcl_globalhash_fanout;
199f4b3ec61Sdh155122 	int		ips_conn_g_index;
200f4b3ec61Sdh155122 
201f4b3ec61Sdh155122 /* ip.c */
202328c7d1fSmeem 	/* Following protected by igmp_timer_lock */
203f4b3ec61Sdh155122 	int 		ips_igmp_time_to_next;	/* Time since last timeout */
2048dc47d9fSudpa 	int 		ips_igmp_timer_scheduled_last;
205f4b3ec61Sdh155122 	int		ips_igmp_deferred_next;
206f4b3ec61Sdh155122 	timeout_id_t	ips_igmp_timeout_id;
207f4b3ec61Sdh155122 	boolean_t	ips_igmp_timer_setter_active;
208*f5db8fb0SRobert Mustacchi 	boolean_t	ips_igmp_timer_quiesce;
209f4b3ec61Sdh155122 
210f4b3ec61Sdh155122 	/* Following protected by mld_timer_lock */
211f4b3ec61Sdh155122 	int 		ips_mld_time_to_next;	/* Time since last timeout */
2128dc47d9fSudpa 	int 		ips_mld_timer_scheduled_last;
213f4b3ec61Sdh155122 	int		ips_mld_deferred_next;
214f4b3ec61Sdh155122 	timeout_id_t	ips_mld_timeout_id;
215f4b3ec61Sdh155122 	boolean_t	ips_mld_timer_setter_active;
216*f5db8fb0SRobert Mustacchi 	boolean_t	ips_mld_timer_quiesce;
217f4b3ec61Sdh155122 
218f4b3ec61Sdh155122 	/* Protected by igmp_slowtimeout_lock */
219f4b3ec61Sdh155122 	timeout_id_t	ips_igmp_slowtimeout_id;
220f4b3ec61Sdh155122 	kmutex_t	ips_igmp_slowtimeout_lock;
221*f5db8fb0SRobert Mustacchi 	boolean_t	ips_igmp_slowtimeout_quiesce;
222f4b3ec61Sdh155122 
223f4b3ec61Sdh155122 	/* Protected by mld_slowtimeout_lock */
224f4b3ec61Sdh155122 	timeout_id_t	ips_mld_slowtimeout_id;
225f4b3ec61Sdh155122 	kmutex_t	ips_mld_slowtimeout_lock;
226*f5db8fb0SRobert Mustacchi 	boolean_t	ips_mld_slowtimeout_quiesce;
227f4b3ec61Sdh155122 
228f4b3ec61Sdh155122 	/* IPv4 forwarding table */
229f4b3ec61Sdh155122 	struct radix_node_head *ips_ip_ftable;
230f4b3ec61Sdh155122 
231f4b3ec61Sdh155122 #define	IPV6_ABITS		128
232f4b3ec61Sdh155122 #define	IP6_MASK_TABLE_SIZE	(IPV6_ABITS + 1)	/* 129 ptrs */
233f4b3ec61Sdh155122 	struct irb	*ips_ip_forwarding_table_v6[IP6_MASK_TABLE_SIZE];
234f4b3ec61Sdh155122 
235f4b3ec61Sdh155122 	/*
236f4b3ec61Sdh155122 	 * ire_ft_init_lock is used while initializing ip_forwarding_table
237f4b3ec61Sdh155122 	 * dynamically in ire_add.
238f4b3ec61Sdh155122 	 */
239f4b3ec61Sdh155122 	kmutex_t	ips_ire_ft_init_lock;
240f4b3ec61Sdh155122 
241bd670b35SErik Nordmark 	/*
242bd670b35SErik Nordmark 	 * This is the IPv6 counterpart of RADIX_NODE_HEAD_LOCK. It is used
243bd670b35SErik Nordmark 	 * to prevent adds and deletes while we are doing a ftable_lookup
244bd670b35SErik Nordmark 	 * and extracting the ire_generation.
245bd670b35SErik Nordmark 	 */
246bd670b35SErik Nordmark 	krwlock_t	ips_ip6_ire_head_lock;
247bd670b35SErik Nordmark 
248f4b3ec61Sdh155122 	uint32_t	ips_ip6_ftable_hash_size;
249f4b3ec61Sdh155122 
250f4b3ec61Sdh155122 	ire_stats_t 	ips_ire_stats_v4;	/* IPv4 ire statistics */
251f4b3ec61Sdh155122 	ire_stats_t 	ips_ire_stats_v6;	/* IPv6 ire statistics */
252f4b3ec61Sdh155122 
253bd670b35SErik Nordmark 	/* Count how many condemned objects for kmem_cache callbacks */
254bd670b35SErik Nordmark 	uint32_t	ips_num_ire_condemned;
255bd670b35SErik Nordmark 	uint32_t	ips_num_nce_condemned;
256bd670b35SErik Nordmark 	uint32_t	ips_num_dce_condemned;
257bd670b35SErik Nordmark 
258bd670b35SErik Nordmark 	struct ire_s	*ips_ire_reject_v4;	/* For unreachable dests */
259bd670b35SErik Nordmark 	struct ire_s	*ips_ire_reject_v6;	/* For unreachable dests */
260bd670b35SErik Nordmark 	struct ire_s	*ips_ire_blackhole_v4;	/* For temporary failures */
261bd670b35SErik Nordmark 	struct ire_s	*ips_ire_blackhole_v6;	/* For temporary failures */
262bd670b35SErik Nordmark 
263bd670b35SErik Nordmark 	/* ips_ire_dep_lock protects ire_dep_* relationship between IREs */
264bd670b35SErik Nordmark 	krwlock_t	ips_ire_dep_lock;
265bd670b35SErik Nordmark 
266bd670b35SErik Nordmark 	/* Destination Cache Entries */
267bd670b35SErik Nordmark 	struct dce_s	*ips_dce_default;
268bd670b35SErik Nordmark 	uint_t		ips_dce_hashsize;
269bd670b35SErik Nordmark 	struct dcb_s	*ips_dce_hash_v4;
270bd670b35SErik Nordmark 	struct dcb_s	*ips_dce_hash_v6;
2717c6d7024SJerry Jelinek 	uint_t		ips_dce_reclaim_needed;
272bd670b35SErik Nordmark 
273f4b3ec61Sdh155122 	/* pending binds */
274f4b3ec61Sdh155122 	mblk_t		*ips_ip6_asp_pending_ops;
275f4b3ec61Sdh155122 	mblk_t		*ips_ip6_asp_pending_ops_tail;
276f4b3ec61Sdh155122 
277f4b3ec61Sdh155122 	/* Synchronize updates with table usage */
278f4b3ec61Sdh155122 	mblk_t		*ips_ip6_asp_pending_update; /* pending table updates */
279f4b3ec61Sdh155122 
280f4b3ec61Sdh155122 	boolean_t	ips_ip6_asp_uip;	/* table update in progress */
281f4b3ec61Sdh155122 	kmutex_t	ips_ip6_asp_lock;	/* protect all the above */
282f4b3ec61Sdh155122 	uint32_t	ips_ip6_asp_refcnt;	/* outstanding references */
283f4b3ec61Sdh155122 
284f4b3ec61Sdh155122 	struct ip6_asp	*ips_ip6_asp_table;
285f4b3ec61Sdh155122 	/* The number of policy entries in the table */
286f4b3ec61Sdh155122 	uint_t		ips_ip6_asp_table_count;
287f4b3ec61Sdh155122 
288fc80c0dfSnordmark 	struct conn_s	*ips_ip_g_mrouter;
289f4b3ec61Sdh155122 
290f4b3ec61Sdh155122 	/* Time since last icmp_pkt_err */
291f4b3ec61Sdh155122 	clock_t		ips_icmp_pkt_err_last;
292f4b3ec61Sdh155122 	/* Number of packets sent in burst */
293f4b3ec61Sdh155122 	uint_t		ips_icmp_pkt_err_sent;
294f4b3ec61Sdh155122 
295f4b3ec61Sdh155122 	/* Protected by ip_mi_lock */
296bd670b35SErik Nordmark 	void		*ips_ip_g_head;	/* IP Instance Data List Head */
297bd670b35SErik Nordmark 	void		*ips_arp_g_head; /* ARP Instance Data List Head */
298f4b3ec61Sdh155122 
299f4b3ec61Sdh155122 	/* Multirouting stuff */
300f4b3ec61Sdh155122 	/* Interval (in ms) between consecutive 'bad MTU' warnings */
301f4b3ec61Sdh155122 	hrtime_t	ips_ip_multirt_log_interval;
302f4b3ec61Sdh155122 	/* Time since last warning issued. */
303f4b3ec61Sdh155122 	hrtime_t	ips_multirt_bad_mtu_last_time;
304f4b3ec61Sdh155122 
3056e91bba0SGirish Moodalbail 	/*
3066e91bba0SGirish Moodalbail 	 * CGTP hooks. Enabling and disabling of hooks is controlled by an
3076e91bba0SGirish Moodalbail 	 * IP tunable 'ips_ip_cgtp_filter'.
3086e91bba0SGirish Moodalbail 	 */
3096e91bba0SGirish Moodalbail 	struct cgtp_filter_ops *ips_ip_cgtp_filter_ops;
310655a42e2Snordmark 
311f4b3ec61Sdh155122 	struct ipsq_s	*ips_ipsq_g_head;
312f4b3ec61Sdh155122 	uint_t		ips_ill_index;	/* Used to assign interface indicies */
313f4b3ec61Sdh155122 	/* When set search for unused index */
314f4b3ec61Sdh155122 	boolean_t	ips_ill_index_wrap;
315f4b3ec61Sdh155122 
316f4b3ec61Sdh155122 	uint_t		ips_loopback_packets;
317f4b3ec61Sdh155122 
318f4b3ec61Sdh155122 	/* NDP/NCE structures for IPv4 and IPv6 */
319f4b3ec61Sdh155122 	struct ndp_g_s	*ips_ndp4;
320f4b3ec61Sdh155122 	struct ndp_g_s	*ips_ndp6;
321f4b3ec61Sdh155122 
322f4b3ec61Sdh155122 	/* ip_mroute stuff */
323f4b3ec61Sdh155122 	kmutex_t	ips_ip_g_mrouter_mutex;
324f4b3ec61Sdh155122 
325f4b3ec61Sdh155122 	struct mrtstat	*ips_mrtstat;	/* Stats for netstat */
3266e91bba0SGirish Moodalbail 	int		ips_saved_ip_forwarding;
327f4b3ec61Sdh155122 
328f4b3ec61Sdh155122 	/* numvifs is only a hint about the max interface being used. */
329f4b3ec61Sdh155122 	ushort_t	ips_numvifs;
330f4b3ec61Sdh155122 	kmutex_t	ips_numvifs_mutex;
331f4b3ec61Sdh155122 
332f4b3ec61Sdh155122 	struct vif	*ips_vifs;
333f4b3ec61Sdh155122 	struct mfcb	*ips_mfcs;	/* kernel routing table	*/
334f4b3ec61Sdh155122 	struct tbf	*ips_tbfs;
335f4b3ec61Sdh155122 	/*
336f4b3ec61Sdh155122 	 * One-back cache used to locate a tunnel's vif,
337f4b3ec61Sdh155122 	 * given a datagram's src ip address.
338f4b3ec61Sdh155122 	 */
339f4b3ec61Sdh155122 	ipaddr_t	ips_last_encap_src;
340f4b3ec61Sdh155122 	struct vif	*ips_last_encap_vif;
341f4b3ec61Sdh155122 	kmutex_t	ips_last_encap_lock;	/* Protects the above */
342f4b3ec61Sdh155122 
343f4b3ec61Sdh155122 	/*
344f4b3ec61Sdh155122 	 * reg_vif_num is protected by numvifs_mutex
345f4b3ec61Sdh155122 	 */
346f4b3ec61Sdh155122 	/* Whether or not special PIM assert processing is enabled. */
347f4b3ec61Sdh155122 	ushort_t	ips_reg_vif_num; 	/* Index to Register vif */
348f4b3ec61Sdh155122 	int		ips_pim_assert;
349f4b3ec61Sdh155122 
350f4b3ec61Sdh155122 	union ill_g_head_u *ips_ill_g_heads;   /* ILL List Head */
351f4b3ec61Sdh155122 
352f4b3ec61Sdh155122 	kstat_t		*ips_loopback_ksp;
353f4b3ec61Sdh155122 
354ae6aa22aSVenugopal Iyer 	/* Array of conn drain lists */
355ae6aa22aSVenugopal Iyer 	struct idl_tx_list_s	*ips_idl_tx_list;
356f4b3ec61Sdh155122 	uint_t		ips_conn_drain_list_cnt; /* Count of conn_drain_list */
357f4b3ec61Sdh155122 
358f4b3ec61Sdh155122 	/*
359f4b3ec61Sdh155122 	 * ID used to assign next free one.
360f4b3ec61Sdh155122 	 * Increases by one. Once it wraps we search for an unused ID.
361f4b3ec61Sdh155122 	 */
362f4b3ec61Sdh155122 	uint_t		ips_ip_src_id;
363f4b3ec61Sdh155122 	boolean_t	ips_srcid_wrapped;
364f4b3ec61Sdh155122 
365f4b3ec61Sdh155122 	struct srcid_map *ips_srcid_head;
366f4b3ec61Sdh155122 	krwlock_t	ips_srcid_lock;
367f4b3ec61Sdh155122 
368bd670b35SErik Nordmark 	uint64_t	ips_ipif_g_seqid;	/* Used only for sctp_addr.c */
369f4b3ec61Sdh155122 	union phyint_list_u *ips_phyint_g_list;	/* start of phyint list */
370f4b3ec61Sdh155122 
371bd670b35SErik Nordmark /* ip_netinfo.c */
372f4b3ec61Sdh155122 	hook_family_t	ips_ipv4root;
373f4b3ec61Sdh155122 	hook_family_t	ips_ipv6root;
374bd670b35SErik Nordmark 	hook_family_t	ips_arproot;
375f4b3ec61Sdh155122 
3760a0e9771SDarren Reed 	net_handle_t		ips_ipv4_net_data;
3770a0e9771SDarren Reed 	net_handle_t		ips_ipv6_net_data;
378bd670b35SErik Nordmark 	net_handle_t		ips_arp_net_data;
3790a0e9771SDarren Reed 
380f4b3ec61Sdh155122 	/*
381f4b3ec61Sdh155122 	 * Hooks for firewalling
382f4b3ec61Sdh155122 	 */
383f4b3ec61Sdh155122 	hook_event_t		ips_ip4_physical_in_event;
384f4b3ec61Sdh155122 	hook_event_t		ips_ip4_physical_out_event;
385f4b3ec61Sdh155122 	hook_event_t		ips_ip4_forwarding_event;
386f4b3ec61Sdh155122 	hook_event_t		ips_ip4_loopback_in_event;
387f4b3ec61Sdh155122 	hook_event_t		ips_ip4_loopback_out_event;
388bd670b35SErik Nordmark 
389f4b3ec61Sdh155122 	hook_event_t		ips_ip6_physical_in_event;
390f4b3ec61Sdh155122 	hook_event_t		ips_ip6_physical_out_event;
391f4b3ec61Sdh155122 	hook_event_t		ips_ip6_forwarding_event;
392f4b3ec61Sdh155122 	hook_event_t		ips_ip6_loopback_in_event;
393f4b3ec61Sdh155122 	hook_event_t		ips_ip6_loopback_out_event;
394f4b3ec61Sdh155122 
395bd670b35SErik Nordmark 	hook_event_t		ips_arp_physical_in_event;
396bd670b35SErik Nordmark 	hook_event_t		ips_arp_physical_out_event;
397bd670b35SErik Nordmark 	hook_event_t		ips_arp_nic_events;
398bd670b35SErik Nordmark 
399f4b3ec61Sdh155122 	hook_event_token_t	ips_ipv4firewall_physical_in;
400f4b3ec61Sdh155122 	hook_event_token_t	ips_ipv4firewall_physical_out;
401f4b3ec61Sdh155122 	hook_event_token_t	ips_ipv4firewall_forwarding;
402f4b3ec61Sdh155122 	hook_event_token_t	ips_ipv4firewall_loopback_in;
403f4b3ec61Sdh155122 	hook_event_token_t	ips_ipv4firewall_loopback_out;
404bd670b35SErik Nordmark 
405f4b3ec61Sdh155122 	hook_event_token_t	ips_ipv6firewall_physical_in;
406f4b3ec61Sdh155122 	hook_event_token_t	ips_ipv6firewall_physical_out;
407f4b3ec61Sdh155122 	hook_event_token_t	ips_ipv6firewall_forwarding;
408f4b3ec61Sdh155122 	hook_event_token_t	ips_ipv6firewall_loopback_in;
409f4b3ec61Sdh155122 	hook_event_token_t	ips_ipv6firewall_loopback_out;
4100a0e9771SDarren Reed 
4110a0e9771SDarren Reed 	hook_event_t		ips_ip4_nic_events;
4120a0e9771SDarren Reed 	hook_event_t		ips_ip6_nic_events;
4130a0e9771SDarren Reed 	hook_event_token_t	ips_ipv4nicevents;
414f4b3ec61Sdh155122 	hook_event_token_t	ips_ipv6nicevents;
415f4b3ec61Sdh155122 
416bd670b35SErik Nordmark 	hook_event_token_t	ips_arp_physical_in;
417bd670b35SErik Nordmark 	hook_event_token_t	ips_arp_physical_out;
418bd670b35SErik Nordmark 	hook_event_token_t	ips_arpnicevents;
419bd670b35SErik Nordmark 
4200a0e9771SDarren Reed 	net_handle_t		ips_ip4_observe_pr;
4210a0e9771SDarren Reed 	net_handle_t		ips_ip6_observe_pr;
4220a0e9771SDarren Reed 	hook_event_t		ips_ip4_observe;
4230a0e9771SDarren Reed 	hook_event_t		ips_ip6_observe;
4240a0e9771SDarren Reed 	hook_event_token_t	ips_ipv4observing;
4250a0e9771SDarren Reed 	hook_event_token_t	ips_ipv6observing;
4260f1702c5SYu Xiangning 
4270f1702c5SYu Xiangning 	struct __ldi_ident	*ips_ldi_ident;
428e11c3f44Smeem 
429e11c3f44Smeem /* ipmp.c */
430e11c3f44Smeem 	krwlock_t		ips_ipmp_lock;
431e11c3f44Smeem 	mod_hash_t		*ips_ipmp_grp_hash;
432e11c3f44Smeem 
433f4b3ec61Sdh155122 };
434f4b3ec61Sdh155122 typedef struct ip_stack ip_stack_t;
435f4b3ec61Sdh155122 
436f4b3ec61Sdh155122 /* Finding an ip_stack_t */
437f4b3ec61Sdh155122 #define	CONNQ_TO_IPST(_q)	(Q_TO_CONN(_q)->conn_netstack->netstack_ip)
438f4b3ec61Sdh155122 #define	ILLQ_TO_IPST(_q)	(((ill_t *)(_q)->q_ptr)->ill_ipst)
439e11c3f44Smeem #define	PHYINT_TO_IPST(phyi)	((phyi)->phyint_ipsq->ipsq_ipst)
440f4b3ec61Sdh155122 
441f4b3ec61Sdh155122 #else /* _KERNEL */
442f4b3ec61Sdh155122 typedef int ip_stack_t;
443f4b3ec61Sdh155122 #endif /* _KERNEL */
444f4b3ec61Sdh155122 
445f4b3ec61Sdh155122 #ifdef	__cplusplus
446f4b3ec61Sdh155122 }
447f4b3ec61Sdh155122 #endif
448f4b3ec61Sdh155122 
449f4b3ec61Sdh155122 #endif	/* _INET_IP_STACK_H */
450