xref: /titanic_52/usr/src/uts/common/inet/ip_if.h (revision f5fc5c043551e3eab595da7d8b5a53479207738f)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 /* Copyright (c) 1990 Mentat Inc. */
26 
27 #ifndef	_INET_IP_IF_H
28 #define	_INET_IP_IF_H
29 
30 #include <net/route.h>
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #define	PREFIX_INFINITY	0xffffffffUL
37 #define	IP_MAX_HW_LEN	40
38 
39 #define	IP_LOOPBACK_MTU	(8*1024)
40 
41 /* DLPI SAPs are in host byte order for all systems */
42 #define	IP_DL_SAP	0x0800
43 #define	IP6_DL_SAP	0x86dd
44 
45 #ifdef	_KERNEL
46 /*
47  * Interface flags actually represent the state/properties of 3 different
48  * abstractions of interfaces in IP. Interface flags are set using
49  * SIOCS[L]IFFLAGS ioctl. The three abstractions are :
50  *
51  * 1) Physical interface (phyint) : There is one phyint allocated common
52  *    to both IPv4 and IPv6 physical interface instance.
53  *
54  * 2) Physical interface instance (ill) : This encompasses all the state
55  *    that is common across all IP addresses assigned to a physical
56  *    interface but different between the IPv4 and IPv6 instance.
57  *
58  * 3) Logical interface (ipif) : This has state about a single IP address.
59  *
60  * Values for the various states are derived from the same name space
61  * as applications querying the state using SIOCGIFFLAGS/SIOCGLIFFLAGS
62  * see only one state returned in lifr_flags which is a union of all
63  * the above states/properties. Thus deriving the values from the common
64  * name space makes implementation easier. All these values are stored in
65  * uint64_t and any other structure/code using these flags should use
66  * uint64_ts.
67  *
68  * As we maintain the interface flags in 3 different flags namely
69  * phyint_flags, ill_flags, ipif_flags we define the following flag values
70  * to be used within the kernel to reduce potential errors. The ones
71  * starting with PHYI_ are supposed to be used with phyint_flags, the ones
72  * starting with ILLF_ are supposed to be used with ill_flags and the ones
73  * starting with IPIF_ are supposed to be used with ipif_flags. If you see
74  * any code with a mismatch i.e phyint_flags & IPIF_UP - it is wrong. Only
75  * PHYI_XXX can be used with phyint_flags.
76  *
77  * NOTE : For EVERY FLAG in if.h, there should be a corresponding value
78  * defined HERE and this is the one that should be USED within IP. We
79  * use IFF_ flags within IP only when we examine lifr_flags.
80  */
81 #define	IFF_PHYINT_FLAGS	(IFF_LOOPBACK|IFF_RUNNING|IFF_PROMISC| \
82     IFF_ALLMULTI|IFF_INTELLIGENT|IFF_MULTI_BCAST|IFF_FAILED|IFF_STANDBY| \
83     IFF_INACTIVE|IFF_OFFLINE|IFF_VIRTUAL)
84 
85 #define	IFF_PHYINTINST_FLAGS	(IFF_DEBUG|IFF_NOTRAILERS|IFF_NOARP| \
86     IFF_MULTICAST|IFF_ROUTER|IFF_NONUD|IFF_NORTEXCH|IFF_IPV4|IFF_IPV6| \
87     IFF_XRESOLV|IFF_COS_ENABLED)
88 
89 #define	IFF_LOGINT_FLAGS	(IFF_UP|IFF_BROADCAST|IFF_POINTOPOINT| \
90     IFF_UNNUMBERED|IFF_DHCPRUNNING|IFF_PRIVATE|IFF_NOXMIT|IFF_NOLOCAL| \
91     IFF_DEPRECATED|IFF_ADDRCONF|IFF_ANYCAST|IFF_NOFAILOVER| \
92     IFF_PREFERRED|IFF_TEMPORARY|IFF_FIXEDMTU|IFF_DUPLICATE)
93 
94 #define	IPIF_REPL_CHECK(to_ipif, failback_cmd)				\
95 	(((to_ipif)->ipif_replace_zero) || ((failback_cmd) &&		\
96 	!(to_ipif)->ipif_isv6 && !((to_ipif)->ipif_flags & IPIF_UP) &&	\
97 	(to_ipif)->ipif_lcl_addr == INADDR_ANY))
98 
99 #define	PHYI_LOOPBACK		IFF_LOOPBACK	/* is a loopback net */
100 #define	PHYI_RUNNING		IFF_RUNNING	/* resources allocated */
101 #define	PHYI_PROMISC		IFF_PROMISC	/* receive all packets */
102 #define	PHYI_ALLMULTI		IFF_ALLMULTI	/* receive all multi packets */
103 #define	PHYI_INTELLIGENT	IFF_INTELLIGENT	/* protocol code on board */
104 #define	PHYI_MULTI_BCAST	IFF_MULTI_BCAST	/* multicast using broadcast */
105 #define	PHYI_FAILED		IFF_FAILED	/* NIC has failed */
106 #define	PHYI_STANDBY		IFF_STANDBY	/* Standby NIC  */
107 #define	PHYI_INACTIVE		IFF_INACTIVE	/* Standby active or not ? */
108 #define	PHYI_OFFLINE		IFF_OFFLINE	/* NIC has been offlined */
109 #define	PHYI_VIRTUAL		IFF_VIRTUAL	/* Will not send or recv pkts */
110 
111 #define	ILLF_DEBUG		IFF_DEBUG	/* turn on debugging */
112 #define	ILLF_NOTRAILERS		IFF_NOTRAILERS	/* avoid use of trailers */
113 #define	ILLF_NOARP		IFF_NOARP	/* no ARP for this interface */
114 #define	ILLF_MULTICAST		IFF_MULTICAST	/* supports multicast */
115 #define	ILLF_ROUTER		IFF_ROUTER	/* router on this interface */
116 #define	ILLF_NONUD		IFF_NONUD	/* No NUD on this interface */
117 #define	ILLF_NORTEXCH		IFF_NORTEXCH	/* No routing info exchange */
118 #define	ILLF_IPV4		IFF_IPV4	/* IPv4 interface */
119 #define	ILLF_IPV6		IFF_IPV6	/* IPv6 interface */
120 #define	ILLF_XRESOLV		IFF_XRESOLV	/* IPv6 external resolver */
121 #define	ILLF_COS_ENABLED	IFF_COS_ENABLED	/* Is CoS marking supported */
122 
123 #define	IPIF_UP			IFF_UP		/* interface is up */
124 #define	IPIF_BROADCAST		IFF_BROADCAST	/* broadcast address valid */
125 #define	IPIF_POINTOPOINT	IFF_POINTOPOINT	/* point-to-point link */
126 #define	IPIF_UNNUMBERED		IFF_UNNUMBERED	/* non-unique address */
127 #define	IPIF_DHCPRUNNING	IFF_DHCPRUNNING	/* DHCP controlled interface */
128 #define	IPIF_PRIVATE		IFF_PRIVATE	/* do not advertise */
129 #define	IPIF_NOXMIT		IFF_NOXMIT	/* Do not transmit packets */
130 #define	IPIF_NOLOCAL		IFF_NOLOCAL	/* Just on-link subnet */
131 #define	IPIF_DEPRECATED		IFF_DEPRECATED	/* address deprecated */
132 #define	IPIF_ADDRCONF		IFF_ADDRCONF	/* stateless addrconf */
133 #define	IPIF_ANYCAST		IFF_ANYCAST	/* Anycast address */
134 #define	IPIF_NOFAILOVER		IFF_NOFAILOVER	/* No failover on NIC failure */
135 #define	IPIF_PREFERRED		IFF_PREFERRED	/* Prefer as source address */
136 #define	IPIF_TEMPORARY		IFF_TEMPORARY	/* RFC3041 */
137 #define	IPIF_FIXEDMTU		IFF_FIXEDMTU	/* set with SIOCSLIFMTU */
138 #define	IPIF_DUPLICATE		IFF_DUPLICATE	/* address is in use */
139 
140 /* Source selection values for ipif_select_source_v6 */
141 #define	RESTRICT_TO_NONE	0x0	/* No restriction in source selection */
142 #define	RESTRICT_TO_GROUP	0x1	/* Restrict to IPMP group */
143 #define	RESTRICT_TO_ILL		0x2	/* Restrict to ILL */
144 
145 #ifdef DEBUG
146 #define	ILL_MAC_PERIM_HELD(ill)	ill_mac_perim_held(ill)
147 #else
148 #define	ILL_MAC_PERIM_HELD(ill)
149 #endif
150 
151 /* for ipif_resolver_up */
152 enum ip_resolver_action {
153 	Res_act_initial,		/* initial address establishment */
154 	Res_act_move,			/* address move (IPMP, new DL addr) */
155 	Res_act_defend			/* address defense */
156 };
157 
158 extern	ill_t	*illgrp_scheduler(ill_t *);
159 extern	mblk_t	*ill_arp_alloc(ill_t *, uchar_t *, caddr_t);
160 extern	mblk_t	*ipif_area_alloc(ipif_t *);
161 extern	mblk_t	*ipif_ared_alloc(ipif_t *);
162 extern	mblk_t	*ill_ared_alloc(ill_t *, ipaddr_t);
163 extern	void	ill_dlpi_done(ill_t *, t_uscalar_t);
164 extern	boolean_t ill_dlpi_pending(ill_t *, t_uscalar_t);
165 extern	void	ill_dlpi_send(ill_t *, mblk_t *);
166 extern	void	ill_dlpi_send_deferred(ill_t *);
167 extern	void	ill_capability_done(ill_t *);
168 
169 extern	mblk_t	*ill_dlur_gen(uchar_t *, uint_t, t_uscalar_t, t_scalar_t);
170 extern  ill_t	*ill_group_lookup_on_ifindex(uint_t, boolean_t, ip_stack_t *);
171 extern	ill_t	*ill_group_lookup_on_name(char *, boolean_t, ip_stack_t *);
172 /* NOTE: Keep unmodified ill_lookup_on_ifindex for ipp for now */
173 extern  ill_t	*ill_lookup_on_ifindex_global_instance(uint_t, boolean_t,
174     queue_t *, mblk_t *, ipsq_func_t, int *);
175 extern  ill_t	*ill_lookup_on_ifindex(uint_t, boolean_t, queue_t *, mblk_t *,
176     ipsq_func_t, int *, ip_stack_t *);
177 extern	ill_t	*ill_lookup_on_name(char *, boolean_t,
178     boolean_t, queue_t *, mblk_t *, ipsq_func_t, int *, boolean_t *,
179     ip_stack_t *);
180 extern uint_t	ill_get_next_ifindex(uint_t, boolean_t, ip_stack_t *);
181 extern uint_t	ill_get_ifindex_by_name(char *, ip_stack_t *);
182 extern	void	ill_ipif_cache_delete(ire_t *, char *);
183 extern	void	ill_delete(ill_t *);
184 extern	void	ill_delete_tail(ill_t *);
185 extern	int	ill_dl_phys(ill_t *, ipif_t *, mblk_t *, queue_t *);
186 extern	int	ill_dls_info(struct sockaddr_dl *, const ipif_t *);
187 extern	void	ill_fastpath_ack(ill_t *, mblk_t *);
188 extern	void	ill_fastpath_nack(ill_t *);
189 extern	int	ill_fastpath_probe(ill_t *, mblk_t *);
190 extern	void	ill_fastpath_flush(ill_t *);
191 extern	int	ill_forward_set(ill_t *, boolean_t);
192 extern	void	ill_frag_prune(ill_t *, uint_t);
193 extern	void	ill_frag_free_pkts(ill_t *, ipfb_t *, ipf_t *, int);
194 extern	time_t	ill_frag_timeout(ill_t *, time_t);
195 extern	int	ill_init(queue_t *, ill_t *);
196 extern	int	ill_nominate_mcast_rcv(ill_group_t *);
197 extern	boolean_t	ill_setdefaulttoken(ill_t *);
198 extern	void	ill_restart_dad(ill_t *, boolean_t);
199 extern	int	ill_set_phys_addr(ill_t *, mblk_t *);
200 extern	void	ill_set_ndmp(ill_t *, mblk_t *, uint_t, uint_t);
201 
202 extern mblk_t	*ill_pending_mp_get(ill_t *, conn_t **, uint_t);
203 extern boolean_t ill_pending_mp_add(ill_t *, conn_t *, mblk_t *);
204 extern	boolean_t ill_is_freeable(ill_t *ill);
205 extern	void	ill_unlock_ills(ill_t **, int);
206 extern	void	ill_lock_ills(ill_t **, int);
207 extern	void	ill_refhold(ill_t *);
208 extern	void	ill_refhold_locked(ill_t *);
209 extern	int	ill_check_and_refhold(ill_t *);
210 extern	void	ill_refrele(ill_t *);
211 extern	boolean_t ill_waiter_inc(ill_t *);
212 extern	void	ill_waiter_dcr(ill_t *);
213 extern	void	ill_trace_ref(ill_t *);
214 extern	void	ill_untrace_ref(ill_t *);
215 extern	boolean_t ill_down_start(queue_t *, mblk_t *);
216 extern	ill_t	*ill_lookup_group_v6(const in6_addr_t *, zoneid_t,
217     ip_stack_t *);
218 
219 extern	void	ill_capability_ack(ill_t *, mblk_t *);
220 extern	void	ill_capability_probe(ill_t *);
221 extern	void	ill_capability_reset(ill_t *, boolean_t);
222 extern	void	ill_taskq_dispatch(ip_stack_t *);
223 
224 extern	void	ill_mtu_change(ire_t *, char *);
225 extern void	ill_group_cleanup(ill_t *);
226 extern int	ill_up_ipifs(ill_t *, queue_t *, mblk_t *);
227 extern	boolean_t ill_is_probeonly(ill_t *);
228 extern	boolean_t ill_hook_event_create(ill_t *, lif_if_t, nic_event_t,
229     nic_event_data_t, size_t);
230 
231 extern	void	ip_loopback_cleanup(ip_stack_t *);
232 extern	void	ipif_get_name(const ipif_t *, char *, int);
233 extern	ipif_t	*ipif_getby_indexes(uint_t, uint_t, boolean_t, ip_stack_t *);
234 extern	void	ipif_init(ip_stack_t *);
235 extern	ipif_t	*ipif_lookup_addr(ipaddr_t, ill_t *, zoneid_t, queue_t *,
236     mblk_t *, ipsq_func_t, int *, ip_stack_t *);
237 extern	boolean_t ip_addr_exists(ipaddr_t, zoneid_t, ip_stack_t *);
238 extern	ipif_t	*ipif_lookup_addr_v6(const in6_addr_t *, ill_t *, zoneid_t,
239     queue_t *, mblk_t *, ipsq_func_t, int *, ip_stack_t *);
240 extern  boolean_t ip_addr_exists_v6(const in6_addr_t *, zoneid_t,
241     ip_stack_t *);
242 extern	zoneid_t ipif_lookup_addr_zoneid(ipaddr_t, ill_t *, ip_stack_t *);
243 extern	zoneid_t ipif_lookup_addr_zoneid_v6(const in6_addr_t *, ill_t *,
244     ip_stack_t *);
245 extern	ipif_t	*ipif_lookup_group(ipaddr_t, zoneid_t, ip_stack_t *);
246 extern	ipif_t	*ipif_lookup_group_v6(const in6_addr_t *, zoneid_t,
247     ip_stack_t *);
248 extern  ipif_t	*ipif_lookup_interface(ipaddr_t, ipaddr_t,
249     queue_t *, mblk_t *, ipsq_func_t, int *, ip_stack_t *);
250 extern	ipif_t	*ipif_lookup_multicast(ip_stack_t *, zoneid_t, boolean_t);
251 extern	ipif_t	*ipif_lookup_remote(ill_t *, ipaddr_t, zoneid_t);
252 extern	ipif_t	*ipif_lookup_onlink_addr(ipaddr_t, zoneid_t, ip_stack_t *);
253 extern	ipif_t	*ipif_lookup_seqid(ill_t *, uint_t);
254 extern	boolean_t	ipif_lookup_zoneid(ill_t *, zoneid_t, int,
255     ipif_t **);
256 extern	boolean_t	ipif_lookup_zoneid_group(ill_t *, zoneid_t, int,
257     ipif_t **);
258 extern	ipif_t	*ipif_select_source(ill_t *, ipaddr_t, zoneid_t);
259 extern	boolean_t	ipif_usesrc_avail(ill_t *, zoneid_t);
260 extern	void	ipif_refhold(ipif_t *);
261 extern	void	ipif_refhold_locked(ipif_t *);
262 extern	void		ipif_refrele(ipif_t *);
263 extern	void	ipif_all_down_tail(ipsq_t *, queue_t *, mblk_t *, void *);
264 extern	int	ipif_resolver_up(ipif_t *, enum ip_resolver_action);
265 extern	int	ipif_arp_setup_multicast(ipif_t *, mblk_t **);
266 extern	int	ipif_down(ipif_t *, queue_t *, mblk_t *);
267 extern	void	ipif_down_tail(ipif_t *);
268 extern	void	ipif_multicast_up(ipif_t *);
269 extern	void	ipif_ndp_down(ipif_t *);
270 extern	int	ipif_ndp_up(ipif_t *);
271 extern	int	ipif_ndp_setup_multicast(ipif_t *, struct nce_s **);
272 extern	int	ipif_up_done(ipif_t *);
273 extern	int	ipif_up_done_v6(ipif_t *);
274 extern	void	ipif_up_notify(ipif_t *);
275 extern	void	ipif_update_other_ipifs_v6(ipif_t *, ill_group_t *);
276 extern	void	ipif_recreate_interface_routes_v6(ipif_t *, ipif_t *);
277 extern	void	ill_update_source_selection(ill_t *);
278 extern	ipif_t	*ipif_select_source_v6(ill_t *, const in6_addr_t *, uint_t,
279     uint32_t, zoneid_t);
280 extern	boolean_t	ipif_cant_setlinklocal(ipif_t *);
281 extern	int	ipif_setlinklocal(ipif_t *);
282 extern	void	ipif_set_tun_llink(ill_t *, struct iftun_req *);
283 extern	ipif_t	*ipif_lookup_on_ifindex(uint_t, boolean_t, zoneid_t, queue_t *,
284     mblk_t *, ipsq_func_t, int *, ip_stack_t *);
285 extern	ipif_t	*ipif_get_next_ipif(ipif_t *curr, ill_t *ill);
286 extern	void	ipif_ill_refrele_tail(ill_t *ill);
287 extern	void	ipif_arp_down(ipif_t *ipif);
288 extern	void	ipif_mask_reply(ipif_t *);
289 
290 extern	int	illgrp_insert(ill_group_t **, ill_t *, char *, ill_group_t *,
291     boolean_t);
292 
293 extern	void	ipsq_current_start(ipsq_t *, ipif_t *, int);
294 extern	void	ipsq_current_finish(ipsq_t *);
295 extern	void	ipsq_enq(ipsq_t *, queue_t *, mblk_t *, ipsq_func_t, int,
296     ill_t *);
297 extern	boolean_t ipsq_enter(ill_t *, boolean_t, int);
298 extern	ipsq_t	*ipsq_try_enter(ipif_t *, ill_t *, queue_t *, mblk_t *,
299     ipsq_func_t, int, boolean_t);
300 extern	void	ipsq_exit(ipsq_t *);
301 extern	boolean_t ill_mac_perim_held(ill_t *);
302 extern mblk_t	*ipsq_pending_mp_get(ipsq_t *, conn_t **);
303 extern boolean_t ipsq_pending_mp_add(conn_t *, ipif_t *, queue_t *,
304     mblk_t *, int);
305 extern	void	qwriter_ip(ill_t *, queue_t *, mblk_t *, ipsq_func_t, int,
306     boolean_t);
307 
308 typedef	int	ip_extract_func_t(queue_t *, mblk_t *, const ip_ioctl_cmd_t *,
309     cmd_info_t *, ipsq_func_t);
310 
311 extern	ip_extract_func_t ip_extract_arpreq, ip_extract_lifreq;
312 extern	ip_extract_func_t ip_extract_tunreq;
313 
314 extern	int	ip_addr_availability_check(ipif_t *);
315 extern	int	ip_ill_report(queue_t *, mblk_t *, caddr_t, cred_t *);
316 extern	int	ip_ipif_report(queue_t *, mblk_t *, caddr_t, cred_t *);
317 extern	void	ip_ll_subnet_defaults(ill_t *, mblk_t *);
318 
319 extern	int	ip_rt_add(ipaddr_t, ipaddr_t, ipaddr_t, ipaddr_t, int,
320     ipif_t *, ire_t **, boolean_t, queue_t *, mblk_t *, ipsq_func_t,
321     struct rtsa_s *, ip_stack_t *);
322 extern	int	ip_rt_add_v6(const in6_addr_t *, const in6_addr_t *,
323     const in6_addr_t *, const in6_addr_t *, int, ipif_t *, ire_t **,
324     queue_t *, mblk_t *, ipsq_func_t, struct rtsa_s *, ip_stack_t *ipst);
325 extern	int	ip_rt_delete(ipaddr_t, ipaddr_t, ipaddr_t, uint_t, int,
326     ipif_t *, boolean_t, queue_t *, mblk_t *, ipsq_func_t, ip_stack_t *);
327 extern	int	ip_rt_delete_v6(const in6_addr_t *, const in6_addr_t *,
328     const in6_addr_t *, uint_t, int, ipif_t *, queue_t *, mblk_t *,
329     ipsq_func_t, ip_stack_t *);
330 extern int ip_siocdelndp_v6(ipif_t *, sin_t *, queue_t *, mblk_t *,
331     ip_ioctl_cmd_t *, void *);
332 extern int ip_siocqueryndp_v6(ipif_t *, sin_t *, queue_t *, mblk_t *,
333     ip_ioctl_cmd_t *, void *);
334 extern int ip_siocsetndp_v6(ipif_t *, sin_t *, queue_t *, mblk_t *,
335     ip_ioctl_cmd_t *, void *);
336 
337 extern int ip_siocaddrt(ipif_t *, sin_t *, queue_t *, mblk_t *,
338     ip_ioctl_cmd_t *, void *);
339 extern int ip_siocdelrt(ipif_t *, sin_t *, queue_t *, mblk_t *,
340     ip_ioctl_cmd_t *, void *);
341 
342 extern int ip_sioctl_addr(ipif_t *, sin_t *, queue_t *, mblk_t *,
343     ip_ioctl_cmd_t *, void *);
344 extern int ip_sioctl_addr_restart(ipif_t *, sin_t *, queue_t *, mblk_t *,
345     ip_ioctl_cmd_t *, void *);
346 extern int ip_sioctl_get_addr(ipif_t *, sin_t *, queue_t *, mblk_t *,
347     ip_ioctl_cmd_t *, void *);
348 
349 extern int ip_sioctl_dstaddr(ipif_t *, sin_t *, queue_t *, mblk_t *,
350     ip_ioctl_cmd_t *, void *);
351 extern int ip_sioctl_dstaddr_restart(ipif_t *, sin_t *, queue_t *, mblk_t *,
352     ip_ioctl_cmd_t *, void *);
353 extern int ip_sioctl_get_dstaddr(ipif_t *, sin_t *, queue_t *, mblk_t *,
354     ip_ioctl_cmd_t *, void *);
355 
356 extern int ip_sioctl_flags(ipif_t *, sin_t *, queue_t *, mblk_t *,
357     ip_ioctl_cmd_t *, void *);
358 extern int ip_sioctl_flags_restart(ipif_t *, sin_t *, queue_t *, mblk_t *,
359     ip_ioctl_cmd_t *, void *);
360 extern int ip_sioctl_get_flags(ipif_t *, sin_t *, queue_t *, mblk_t *,
361     ip_ioctl_cmd_t *, void *);
362 
363 extern int ip_sioctl_mtu(ipif_t *, sin_t *, queue_t *, mblk_t *,
364     ip_ioctl_cmd_t *, void *);
365 extern int ip_sioctl_get_mtu(ipif_t *, sin_t *, queue_t *, mblk_t *,
366     ip_ioctl_cmd_t *, void *);
367 
368 extern int ip_sioctl_get_ifconf(ipif_t *, sin_t *, queue_t *, mblk_t *,
369     ip_ioctl_cmd_t *, void *);
370 extern int ip_sioctl_get_lifconf(ipif_t *, sin_t *, queue_t *, mblk_t *,
371     ip_ioctl_cmd_t *, void *);
372 extern int ip_sioctl_get_ifnum(ipif_t *, sin_t *, queue_t *, mblk_t *,
373     ip_ioctl_cmd_t *, void *);
374 extern int ip_sioctl_get_lifnum(ipif_t *, sin_t *, queue_t *, mblk_t *,
375     ip_ioctl_cmd_t *, void *);
376 
377 extern int ip_sioctl_token(ipif_t *, sin_t *, queue_t *, mblk_t *,
378     ip_ioctl_cmd_t *, void *);
379 extern int ip_sioctl_get_token(ipif_t *, sin_t *, queue_t *, mblk_t *,
380     ip_ioctl_cmd_t *, void *);
381 
382 extern int if_unitsel(ipif_t *, sin_t *, queue_t *, mblk_t *,
383     ip_ioctl_cmd_t *, void *);
384 extern int if_unitsel_restart(ipif_t *, sin_t *, queue_t *, mblk_t *,
385     ip_ioctl_cmd_t *, void *);
386 
387 extern int ip_sioctl_sifname(ipif_t *, sin_t *, queue_t *, mblk_t *,
388     ip_ioctl_cmd_t *, void *);
389 
390 extern int ip_sioctl_slifname(ipif_t *, sin_t *, queue_t *, mblk_t *,
391     ip_ioctl_cmd_t *, void *);
392 extern int ip_sioctl_slifname_restart(ipif_t *, sin_t *, queue_t *,
393     mblk_t *, ip_ioctl_cmd_t *, void *);
394 
395 extern int ip_sioctl_slifindex(ipif_t *, sin_t *, queue_t *, mblk_t *,
396     ip_ioctl_cmd_t *, void *);
397 extern int ip_sioctl_get_lifindex(ipif_t *, sin_t *, queue_t *, mblk_t *,
398     ip_ioctl_cmd_t *, void *);
399 
400 extern int ip_sioctl_brdaddr(ipif_t *, sin_t *, queue_t *, mblk_t *,
401     ip_ioctl_cmd_t *, void *);
402 extern int ip_sioctl_get_brdaddr(ipif_t *, sin_t *, queue_t *, mblk_t *,
403     ip_ioctl_cmd_t *, void *);
404 
405 extern int ip_sioctl_get_muxid(ipif_t *, sin_t *, queue_t *, mblk_t *,
406     ip_ioctl_cmd_t *, void *);
407 extern int ip_sioctl_muxid(ipif_t *, sin_t *, queue_t *, mblk_t *,
408     ip_ioctl_cmd_t *, void *);
409 
410 extern int ip_sioctl_netmask(ipif_t *, sin_t *, queue_t *, mblk_t *,
411     ip_ioctl_cmd_t *, void *);
412 extern int ip_sioctl_get_netmask(ipif_t *, sin_t *, queue_t *, mblk_t *,
413     ip_ioctl_cmd_t *, void *);
414 extern int ip_sioctl_netmask_restart(ipif_t *, sin_t *, queue_t *, mblk_t *,
415     ip_ioctl_cmd_t *, void *);
416 
417 extern int ip_sioctl_subnet(ipif_t *, sin_t *, queue_t *, mblk_t *,
418     ip_ioctl_cmd_t *, void *);
419 extern int ip_sioctl_subnet_restart(ipif_t *, sin_t *, queue_t *, mblk_t *,
420     ip_ioctl_cmd_t *, void *);
421 extern int ip_sioctl_get_subnet(ipif_t *, sin_t *, queue_t *, mblk_t *,
422     ip_ioctl_cmd_t *, void *);
423 
424 extern int ip_sioctl_lnkinfo(ipif_t *, sin_t *, queue_t *, mblk_t *,
425     ip_ioctl_cmd_t *, void *);
426 extern int ip_sioctl_get_lnkinfo(ipif_t *, sin_t *, queue_t *, mblk_t *,
427     ip_ioctl_cmd_t *, void *);
428 
429 extern int ip_sioctl_metric(ipif_t *, sin_t *, queue_t *, mblk_t *,
430     ip_ioctl_cmd_t *, void *);
431 extern int ip_sioctl_get_metric(ipif_t *, sin_t *, queue_t *, mblk_t *,
432     ip_ioctl_cmd_t *, void *);
433 
434 extern int ip_sioctl_arp(ipif_t *, sin_t *, queue_t *, mblk_t *,
435     ip_ioctl_cmd_t *, void *);
436 
437 extern int ip_sioctl_addif(ipif_t *, sin_t *, queue_t *, mblk_t *,
438     ip_ioctl_cmd_t *, void *);
439 extern int ip_sioctl_removeif(ipif_t *, sin_t *, queue_t *, mblk_t *,
440     ip_ioctl_cmd_t *, void *);
441 extern int ip_sioctl_removeif_restart(ipif_t *, sin_t *, queue_t *, mblk_t *,
442     ip_ioctl_cmd_t *, void *);
443 
444 extern int ip_sioctl_tonlink(ipif_t *, sin_t *, queue_t *, mblk_t *,
445     ip_ioctl_cmd_t *, void *);
446 extern int ip_sioctl_tmysite(ipif_t *, sin_t *, queue_t *, mblk_t *,
447     ip_ioctl_cmd_t *, void *);
448 extern int ip_sioctl_tmyaddr(ipif_t *, sin_t *, queue_t *, mblk_t *,
449     ip_ioctl_cmd_t *, void *);
450 
451 extern int ip_sioctl_tunparam(ipif_t *, sin_t *, queue_t *, mblk_t *,
452     ip_ioctl_cmd_t *, void *);
453 
454 extern int ip_sioctl_groupname(ipif_t *, sin_t *, queue_t *,
455     mblk_t *, ip_ioctl_cmd_t *, void *);
456 extern int ip_sioctl_get_groupname(ipif_t *, sin_t *, queue_t *,
457     mblk_t *, ip_ioctl_cmd_t *, void *);
458 extern int ip_sioctl_slifoindex(ipif_t *, sin_t *, queue_t *,
459     mblk_t *, ip_ioctl_cmd_t *, void *);
460 extern int ip_sioctl_get_oindex(ipif_t *, sin_t *, queue_t *,
461     mblk_t *, ip_ioctl_cmd_t *, void *);
462 
463 extern int ip_sioctl_get_lifzone(ipif_t *, sin_t *, queue_t *,
464     mblk_t *, ip_ioctl_cmd_t *, void *);
465 extern int ip_sioctl_slifzone(ipif_t *, sin_t *, queue_t *,
466     mblk_t *, ip_ioctl_cmd_t *, void *);
467 extern int ip_sioctl_slifzone_restart(ipif_t *, sin_t *, queue_t *,
468     mblk_t *, ip_ioctl_cmd_t *, void *);
469 
470 extern int ip_sioctl_get_lifusesrc(ipif_t *, sin_t *, queue_t *,
471     mblk_t *, ip_ioctl_cmd_t *, void *);
472 extern int ip_sioctl_slifusesrc(ipif_t *, sin_t *, queue_t *,
473     mblk_t *, ip_ioctl_cmd_t *, void *);
474 extern int ip_sioctl_get_lifsrcof(ipif_t *, sin_t *, queue_t *,
475     mblk_t *, ip_ioctl_cmd_t *, void *);
476 extern int ip_sioctl_set_ipmpfailback(ipif_t *, sin_t *, queue_t *,
477     mblk_t *, ip_ioctl_cmd_t *, void *);
478 
479 extern	void	ip_sioctl_copyin_resume(ipsq_t *, queue_t *, mblk_t *, void *);
480 extern	void	ip_sioctl_copyin_setup(queue_t *, mblk_t *);
481 extern	void	ip_sioctl_iocack(queue_t *, mblk_t *);
482 extern	ip_ioctl_cmd_t *ip_sioctl_lookup(int);
483 extern int ip_sioctl_move(ipif_t *, sin_t *, queue_t *, mblk_t *,
484     ip_ioctl_cmd_t *, void *);
485 
486 extern	void	conn_delete_ire(conn_t *, caddr_t);
487 
488 /*
489  * Notes on reference tracing on ill, ipif, ire, nce data structures:
490  *
491  * The current model of references on an ipif or ill is purely based on threads
492  * acquiring a reference by doing a lookup on the ill or ipif or by calling a
493  * refhold function on the ill or ipif. In particular any data structure that
494  * points to an ipif or ill does not explicitly contribute to a reference on the
495  * ill or ipif. More details may be seen in the block comment above ipif_down().
496  * Thus in the quiescent state an ill or ipif has a refcnt of zero. Similarly
497  * when a thread exits, there can't be any references on the ipif or ill due to
498  * the exiting thread.
499  *
500  * As a debugging aid, the refhold and refrele functions call into tracing
501  * functions that record the stack trace of the caller and the references
502  * acquired or released by the calling thread, hashed by the structure address
503  * in thread-specific-data (TSD).  On thread exit, ip_thread_exit destroys the
504  * hash, and the destructor for the hash entries (th_trace_free) verifies that
505  * there are no outstanding references to the ipif or ill from the exiting
506  * thread.
507  *
508  * In the case of ires and nces, the model is slightly different. Typically each
509  * ire pointing to an nce contributes to the nce_refcnt. Similarly a conn_t
510  * pointing to an ire also contributes to the ire_refcnt. Excluding the above
511  * special cases, the tracing behavior is similar to the tracing on ipif / ill.
512  * Traces are neither recorded nor verified in the exception cases, and the code
513  * is careful to use the right refhold and refrele functions. On thread exit
514  * ire_thread_exit, nce_thread_exit does the verification that are no
515  * outstanding references on the ire / nce from the exiting thread.
516  *
517  * The reference verification is driven from the TSD destructor which calls
518  * into IP's verification function ip_thread_exit. This debugging aid may be
519  * helpful in tracing missing refrele's on a debug kernel. On a non-debug
520  * kernel, these missing refrele's are noticeable only when an interface is
521  * being unplumbed, and the unplumb hangs, long after the missing refrele. On a
522  * debug kernel, the traces (th_trace_t) which contain the stack backtraces can
523  * be examined on a crash dump to locate the missing refrele.
524  */
525 
526 #endif /* _KERNEL */
527 
528 #ifdef	__cplusplus
529 }
530 #endif
531 
532 #endif	/* _INET_IP_IF_H */
533