ip_if.h revision 11042:2d6e217af1b4
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 2009 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
33extern "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#ifdef	_KERNEL
42/*
43 * Interface flags actually represent the state/properties of 3 different
44 * abstractions of interfaces in IP. Interface flags are set using
45 * SIOCS[L]IFFLAGS ioctl. The three abstractions are :
46 *
47 * 1) Physical interface (phyint) : There is one phyint allocated common
48 *    to both IPv4 and IPv6 physical interface instance.
49 *
50 * 2) Physical interface instance (ill) : This encompasses all the state
51 *    that is common across all IP addresses assigned to a physical
52 *    interface but different between the IPv4 and IPv6 instance.
53 *
54 * 3) Logical interface (ipif) : This has state about a single IP address.
55 *
56 * Values for the various states are derived from the same name space
57 * as applications querying the state using SIOCGIFFLAGS/SIOCGLIFFLAGS
58 * see only one state returned in lifr_flags which is a union of all
59 * the above states/properties. Thus deriving the values from the common
60 * name space makes implementation easier. All these values are stored in
61 * uint64_t and any other structure/code using these flags should use
62 * uint64_ts.
63 *
64 * As we maintain the interface flags in 3 different flags namely
65 * phyint_flags, ill_flags, ipif_flags we define the following flag values
66 * to be used within the kernel to reduce potential errors. The ones
67 * starting with PHYI_ are supposed to be used with phyint_flags, the ones
68 * starting with ILLF_ are supposed to be used with ill_flags and the ones
69 * starting with IPIF_ are supposed to be used with ipif_flags. If you see
70 * any code with a mismatch i.e phyint_flags & IPIF_UP - it is wrong. Only
71 * PHYI_XXX can be used with phyint_flags.
72 *
73 * NOTE : For EVERY FLAG in if.h, there should be a corresponding value
74 * defined HERE and this is the one that should be USED within IP. We
75 * use IFF_ flags within IP only when we examine lifr_flags.
76 */
77#define	IFF_PHYINT_FLAGS	(IFF_LOOPBACK|IFF_RUNNING|IFF_PROMISC| \
78    IFF_ALLMULTI|IFF_INTELLIGENT|IFF_MULTI_BCAST|IFF_FAILED|IFF_STANDBY| \
79    IFF_INACTIVE|IFF_OFFLINE|IFF_VIRTUAL|IFF_IPMP)
80
81#define	IFF_PHYINTINST_FLAGS	(IFF_DEBUG|IFF_NOTRAILERS|IFF_NOARP| \
82    IFF_MULTICAST|IFF_ROUTER|IFF_NONUD|IFF_NORTEXCH|IFF_IPV4|IFF_IPV6| \
83    IFF_COS_ENABLED|IFF_FIXEDMTU)
84
85#define	IFF_LOGINT_FLAGS	(IFF_UP|IFF_BROADCAST|IFF_POINTOPOINT| \
86    IFF_UNNUMBERED|IFF_DHCPRUNNING|IFF_PRIVATE|IFF_NOXMIT|IFF_NOLOCAL| \
87    IFF_DEPRECATED|IFF_ADDRCONF|IFF_ANYCAST|IFF_NOFAILOVER| \
88    IFF_PREFERRED|IFF_TEMPORARY|IFF_DUPLICATE)
89
90#define	PHYI_LOOPBACK		IFF_LOOPBACK	/* is a loopback net */
91#define	PHYI_RUNNING		IFF_RUNNING	/* resources allocated */
92#define	PHYI_PROMISC		IFF_PROMISC	/* receive all packets */
93#define	PHYI_ALLMULTI		IFF_ALLMULTI	/* receive all multi packets */
94#define	PHYI_INTELLIGENT	IFF_INTELLIGENT	/* protocol code on board */
95#define	PHYI_MULTI_BCAST	IFF_MULTI_BCAST	/* multicast using broadcast */
96#define	PHYI_FAILED		IFF_FAILED	/* NIC has failed */
97#define	PHYI_STANDBY		IFF_STANDBY	/* Standby NIC  */
98#define	PHYI_INACTIVE		IFF_INACTIVE	/* Standby active or not ? */
99#define	PHYI_OFFLINE		IFF_OFFLINE	/* NIC has been offlined */
100#define	PHYI_VIRTUAL		IFF_VIRTUAL	/* Will not send or recv pkts */
101#define	PHYI_IPMP		IFF_IPMP	/* IPMP meta-interface */
102
103#define	ILLF_DEBUG		IFF_DEBUG	/* turn on debugging */
104#define	ILLF_NOTRAILERS		IFF_NOTRAILERS	/* avoid use of trailers */
105#define	ILLF_NOARP		IFF_NOARP	/* no ARP for this interface */
106#define	ILLF_MULTICAST		IFF_MULTICAST	/* supports multicast */
107#define	ILLF_ROUTER		IFF_ROUTER	/* router on this interface */
108#define	ILLF_NONUD		IFF_NONUD	/* No NUD on this interface */
109#define	ILLF_NORTEXCH		IFF_NORTEXCH	/* No routing info exchange */
110#define	ILLF_IPV4		IFF_IPV4	/* IPv4 interface */
111#define	ILLF_IPV6		IFF_IPV6	/* IPv6 interface */
112#define	ILLF_COS_ENABLED	IFF_COS_ENABLED	/* Is CoS marking supported */
113#define	ILLF_FIXEDMTU		IFF_FIXEDMTU	/* set with SIOCSLIFMTU */
114
115#define	IPIF_UP			IFF_UP		/* interface is up */
116#define	IPIF_BROADCAST		IFF_BROADCAST	/* broadcast address valid */
117#define	IPIF_POINTOPOINT	IFF_POINTOPOINT	/* point-to-point link */
118#define	IPIF_UNNUMBERED		IFF_UNNUMBERED	/* non-unique address */
119#define	IPIF_DHCPRUNNING	IFF_DHCPRUNNING	/* DHCP controlled interface */
120#define	IPIF_PRIVATE		IFF_PRIVATE	/* do not advertise */
121#define	IPIF_NOXMIT		IFF_NOXMIT	/* Do not transmit packets */
122#define	IPIF_NOLOCAL		IFF_NOLOCAL	/* Just on-link subnet */
123#define	IPIF_DEPRECATED		IFF_DEPRECATED	/* address deprecated */
124#define	IPIF_ADDRCONF		IFF_ADDRCONF	/* stateless addrconf */
125#define	IPIF_ANYCAST		IFF_ANYCAST	/* Anycast address */
126#define	IPIF_NOFAILOVER		IFF_NOFAILOVER	/* No failover on NIC failure */
127#define	IPIF_PREFERRED		IFF_PREFERRED	/* Prefer as source address */
128#define	IPIF_TEMPORARY		IFF_TEMPORARY	/* RFC3041 */
129#define	IPIF_DUPLICATE		IFF_DUPLICATE	/* address is in use */
130
131#ifdef DEBUG
132#define	ILL_MAC_PERIM_HELD(ill)	ill_mac_perim_held(ill)
133#else
134#define	ILL_MAC_PERIM_HELD(ill)
135#endif
136
137/*
138 * match flags for ipif_lookup_addr_common* functions
139 */
140#define	IPIF_MATCH_ILLGRP	0x00000001
141#define	IPIF_MATCH_NONDUP	0x00000002
142
143/* for ipif_resolver_up */
144enum ip_resolver_action {
145	Res_act_initial,		/* initial address establishment */
146	Res_act_rebind,			/* IPMP address rebind (new hwaddr) */
147	Res_act_defend,			/* address defense */
148	Res_act_none			/* do nothing */
149};
150
151extern	int	ill_add_ires(ill_t *);
152extern	void	ill_delete_ires(ill_t *);
153extern	void	ill_dlpi_done(ill_t *, t_uscalar_t);
154extern	boolean_t ill_dlpi_pending(ill_t *, t_uscalar_t);
155extern	void	ill_dlpi_dispatch(ill_t *, mblk_t *);
156extern	void	ill_dlpi_send(ill_t *, mblk_t *);
157extern	void	ill_dlpi_send_deferred(ill_t *);
158extern	void	ill_dlpi_queue(ill_t *, mblk_t *);
159extern	void	ill_dlpi_send_queued(ill_t *);
160extern	void	ill_mcast_queue(ill_t *, mblk_t *);
161extern	void	ill_mcast_send_queued(ill_t *);
162extern	void	ill_mcast_timer_start(ip_stack_t *);
163extern	void	ill_capability_done(ill_t *);
164
165extern	mblk_t	*ill_dlur_gen(uchar_t *, uint_t, t_uscalar_t, t_scalar_t);
166/* NOTE: Keep unmodified ill_lookup_on_ifindex for ipp for now */
167extern  ill_t	*ill_lookup_on_ifindex_global_instance(uint_t, boolean_t);
168extern  ill_t	*ill_lookup_on_ifindex(uint_t, boolean_t, ip_stack_t *);
169extern  ill_t	*ill_lookup_on_ifindex_zoneid(uint_t, zoneid_t, boolean_t,
170    ip_stack_t *);
171extern	ill_t	*ill_lookup_on_name(char *, boolean_t,
172    boolean_t, boolean_t *, ip_stack_t *);
173extern boolean_t ip_ifindex_valid(uint_t, boolean_t, ip_stack_t *);
174extern uint_t	ill_get_next_ifindex(uint_t, boolean_t, ip_stack_t *);
175extern uint_t	ill_get_ifindex_by_name(char *, ip_stack_t *);
176extern uint_t	ill_get_upper_ifindex(const ill_t *);
177extern	void	ill_delete(ill_t *);
178extern	void	ill_delete_tail(ill_t *);
179extern	int	ill_dl_phys(ill_t *, ipif_t *, mblk_t *, queue_t *);
180extern	int	ill_dls_info(struct sockaddr_dl *, const ill_t *);
181extern	void	ill_fastpath_ack(ill_t *, mblk_t *);
182extern	int	ill_fastpath_probe(ill_t *, mblk_t *);
183extern	int	ill_forward_set(ill_t *, boolean_t);
184extern	void	ill_frag_prune(ill_t *, uint_t);
185extern	void	ill_frag_free_pkts(ill_t *, ipfb_t *, ipf_t *, int);
186extern	time_t	ill_frag_timeout(ill_t *, time_t);
187extern	int	ill_init(queue_t *, ill_t *);
188extern	void	ill_restart_dad(ill_t *, boolean_t);
189extern	void	ill_setdefaulttoken(ill_t *);
190extern	void	ill_setdesttoken(ill_t *);
191extern	void	ill_set_inputfn(ill_t *);
192extern	void	ill_set_inputfn_all(ip_stack_t *);
193extern	int	ill_set_phys_addr(ill_t *, mblk_t *);
194extern	int	ill_replumb(ill_t *, mblk_t *);
195extern	void	ill_set_ndmp(ill_t *, mblk_t *, uint_t, uint_t);
196
197extern	boolean_t ill_is_freeable(ill_t *ill);
198extern	void	ill_refhold(ill_t *);
199extern	void	ill_refhold_locked(ill_t *);
200extern	boolean_t ill_check_and_refhold(ill_t *);
201extern	void	ill_refrele(ill_t *);
202extern	boolean_t ill_waiter_inc(ill_t *);
203extern	void	ill_waiter_dcr(ill_t *);
204extern	void	ill_trace_ref(ill_t *);
205extern	void	ill_untrace_ref(ill_t *);
206extern	void	ill_downi(ire_t *, char *);
207extern	void	ill_downi_if_clone(ire_t *, char *);
208extern	boolean_t ill_down_start(queue_t *, mblk_t *);
209extern	ill_t	*ill_lookup_group_v4(ipaddr_t, zoneid_t,
210    ip_stack_t *, boolean_t *, ipaddr_t *);
211extern	ill_t	*ill_lookup_group_v6(const in6_addr_t *, zoneid_t,
212    ip_stack_t *, boolean_t *, in6_addr_t *);
213
214extern	void	ill_capability_ack(ill_t *, mblk_t *);
215extern	void	ill_capability_probe(ill_t *);
216extern	void	ill_capability_reset(ill_t *, boolean_t);
217extern	void	ill_taskq_dispatch(ip_stack_t *);
218
219extern	void	ill_get_name(const ill_t *, char *, int);
220extern	void	ill_group_cleanup(ill_t *);
221extern	int	ill_up_ipifs(ill_t *, queue_t *, mblk_t *);
222extern	void	ip_update_source_selection(ip_stack_t *);
223extern uint_t	ill_appaddr_cnt(const ill_t *);
224extern uint_t	ill_ptpaddr_cnt(const ill_t *);
225extern uint_t   ill_admupaddr_cnt(const ill_t *);
226
227extern	ill_t	*ill_lookup_multicast(ip_stack_t *, zoneid_t, boolean_t);
228extern void	ill_save_ire(ill_t *, ire_t *);
229extern void	ill_remove_saved_ire(ill_t *, ire_t *);
230extern int	ill_recover_saved_ire(ill_t *);
231
232extern	void	ip_interface_cleanup(ip_stack_t *);
233extern	void	ipif_get_name(const ipif_t *, char *, int);
234extern	ipif_t	*ipif_getby_indexes(uint_t, uint_t, boolean_t, ip_stack_t *);
235extern	void	ipif_init(ip_stack_t *);
236extern	ipif_t	*ipif_lookup_addr(ipaddr_t, ill_t *, zoneid_t, ip_stack_t *);
237extern	ipif_t	*ipif_lookup_addr_exact(ipaddr_t, ill_t *, ip_stack_t *);
238extern	ipif_t	*ipif_lookup_addr_nondup(ipaddr_t, ill_t *, zoneid_t,
239    ip_stack_t *);
240extern	ipif_t	*ipif_lookup_addr_v6(const in6_addr_t *, ill_t *, zoneid_t,
241    ip_stack_t *);
242extern	ipif_t	*ipif_lookup_addr_exact_v6(const in6_addr_t *, ill_t *,
243    ip_stack_t *);
244extern	ipif_t	*ipif_lookup_addr_nondup_v6(const in6_addr_t *, ill_t *,
245    zoneid_t, ip_stack_t *);
246extern	zoneid_t ipif_lookup_addr_zoneid(ipaddr_t, ill_t *, ip_stack_t *);
247extern	zoneid_t ipif_lookup_addr_zoneid_v6(const in6_addr_t *, ill_t *,
248    ip_stack_t *);
249extern  ipif_t	*ipif_lookup_interface(ipaddr_t, ipaddr_t, ip_stack_t *);
250extern	ipif_t	*ipif_lookup_remote(ill_t *, ipaddr_t, zoneid_t);
251extern boolean_t ipif_lookup_testaddr_v6(ill_t *, const in6_addr_t *,
252    ipif_t **);
253extern boolean_t ipif_lookup_testaddr_v4(ill_t *, const in_addr_t *,
254    ipif_t **);
255extern	ipif_t	*ipif_select_source_v4(ill_t *, ipaddr_t, zoneid_t, boolean_t,
256    boolean_t *);
257extern	boolean_t ipif_zone_avail(uint_t, boolean_t, zoneid_t, ip_stack_t *);
258extern	ipif_t	*ipif_good_addr(ill_t *, zoneid_t);
259extern	int	ip_select_source_v4(ill_t *, ipaddr_t, ipaddr_t, ipaddr_t,
260    zoneid_t, ip_stack_t *, ipaddr_t *, uint32_t *, uint64_t *);
261extern	void	ipif_refhold(ipif_t *);
262extern	void	ipif_refhold_locked(ipif_t *);
263extern	void	ipif_refrele(ipif_t *);
264extern	void	ipif_all_down_tail(ipsq_t *, queue_t *, mblk_t *, void *);
265extern	int	ipif_resolver_up(ipif_t *, enum ip_resolver_action);
266extern	int	ipif_down(ipif_t *, queue_t *, mblk_t *);
267extern	int	ipif_down_tail(ipif_t *);
268extern	void	ipif_multicast_down(ipif_t *);
269extern	void	ipif_multicast_up(ipif_t *);
270extern	void	ipif_ndp_down(ipif_t *);
271extern	int	ipif_ndp_up(ipif_t *, boolean_t);
272extern	int	ipif_up_done(ipif_t *);
273extern	int	ipif_up_done_v6(ipif_t *);
274extern	void	ipif_up_notify(ipif_t *);
275extern	ipif_t	*ipif_select_source_v6(ill_t *, const in6_addr_t *, boolean_t,
276    uint32_t, zoneid_t, boolean_t, boolean_t *);
277extern	int	ip_select_source_v6(ill_t *, const in6_addr_t *,
278    const in6_addr_t *, zoneid_t, ip_stack_t *, uint_t, uint32_t, in6_addr_t *,
279    uint32_t *, uint64_t *);
280extern	boolean_t	ipif_cant_setlinklocal(ipif_t *);
281extern	void	ipif_setlinklocal(ipif_t *);
282extern	void	ipif_setdestlinklocal(ipif_t *);
283extern	ipif_t	*ipif_lookup_on_ifindex(uint_t, boolean_t, zoneid_t,
284    ip_stack_t *);
285extern	ipif_t	*ipif_get_next_ipif(ipif_t *curr, ill_t *ill);
286extern	void	ipif_ill_refrele_tail(ill_t *ill);
287extern	void	ipif_nce_down(ipif_t *ipif);
288extern	int	ipif_arp_down(ipif_t *ipif);
289extern	void	ipif_mask_reply(ipif_t *);
290extern	int 	ipif_up(ipif_t *, queue_t *, mblk_t *);
291
292extern	void	ipsq_current_start(ipsq_t *, ipif_t *, int);
293extern	void	ipsq_current_finish(ipsq_t *);
294extern	void	ipsq_enq(ipsq_t *, queue_t *, mblk_t *, ipsq_func_t, int,
295    ill_t *);
296extern	boolean_t ipsq_enter(ill_t *, boolean_t, int);
297extern	ipsq_t	*ipsq_try_enter(ipif_t *, ill_t *, queue_t *, mblk_t *,
298    ipsq_func_t, int, boolean_t);
299extern	void	ipsq_exit(ipsq_t *);
300extern	boolean_t ill_mac_perim_held(ill_t *);
301extern mblk_t	*ipsq_pending_mp_get(ipsq_t *, conn_t **);
302extern boolean_t ipsq_pending_mp_add(conn_t *, ipif_t *, queue_t *,
303    mblk_t *, int);
304extern	void	qwriter_ip(ill_t *, queue_t *, mblk_t *, ipsq_func_t, int,
305    boolean_t);
306
307typedef	int	ip_extract_func_t(queue_t *, mblk_t *, const ip_ioctl_cmd_t *,
308    cmd_info_t *);
309
310extern	ip_extract_func_t ip_extract_arpreq, ip_extract_lifreq;
311
312extern	int	ip_addr_availability_check(ipif_t *);
313extern	void	ip_ll_subnet_defaults(ill_t *, mblk_t *);
314
315extern	int	ip_rt_add(ipaddr_t, ipaddr_t, ipaddr_t, ipaddr_t, int,
316    ill_t *, ire_t **, boolean_t, struct rtsa_s *, ip_stack_t *, zoneid_t);
317extern	int	ip_rt_add_v6(const in6_addr_t *, const in6_addr_t *,
318    const in6_addr_t *, const in6_addr_t *, int, ill_t *, ire_t **,
319    struct rtsa_s *, ip_stack_t *, zoneid_t);
320extern	int	ip_rt_delete(ipaddr_t, ipaddr_t, ipaddr_t, uint_t, int,
321    ill_t *, boolean_t, ip_stack_t *, zoneid_t);
322extern	int	ip_rt_delete_v6(const in6_addr_t *, const in6_addr_t *,
323    const in6_addr_t *, uint_t, int, ill_t *, ip_stack_t *, zoneid_t);
324extern int ip_siocdelndp_v6(ipif_t *, sin_t *, queue_t *, mblk_t *,
325    ip_ioctl_cmd_t *, void *);
326extern int ip_siocqueryndp_v6(ipif_t *, sin_t *, queue_t *, mblk_t *,
327    ip_ioctl_cmd_t *, void *);
328extern int ip_siocsetndp_v6(ipif_t *, sin_t *, queue_t *, mblk_t *,
329    ip_ioctl_cmd_t *, void *);
330
331extern int ip_siocaddrt(ipif_t *, sin_t *, queue_t *, mblk_t *,
332    ip_ioctl_cmd_t *, void *);
333extern int ip_siocdelrt(ipif_t *, sin_t *, queue_t *, mblk_t *,
334    ip_ioctl_cmd_t *, void *);
335
336extern int ip_sioctl_addr(ipif_t *, sin_t *, queue_t *, mblk_t *,
337    ip_ioctl_cmd_t *, void *);
338extern int ip_sioctl_addr_restart(ipif_t *, sin_t *, queue_t *, mblk_t *,
339    ip_ioctl_cmd_t *, void *);
340extern int ip_sioctl_get_addr(ipif_t *, sin_t *, queue_t *, mblk_t *,
341    ip_ioctl_cmd_t *, void *);
342
343extern int ip_sioctl_dstaddr(ipif_t *, sin_t *, queue_t *, mblk_t *,
344    ip_ioctl_cmd_t *, void *);
345extern int ip_sioctl_dstaddr_restart(ipif_t *, sin_t *, queue_t *, mblk_t *,
346    ip_ioctl_cmd_t *, void *);
347extern int ip_sioctl_get_dstaddr(ipif_t *, sin_t *, queue_t *, mblk_t *,
348    ip_ioctl_cmd_t *, void *);
349
350extern int ip_sioctl_flags(ipif_t *, sin_t *, queue_t *, mblk_t *,
351    ip_ioctl_cmd_t *, void *);
352extern int ip_sioctl_flags_restart(ipif_t *, sin_t *, queue_t *, mblk_t *,
353    ip_ioctl_cmd_t *, void *);
354extern int ip_sioctl_get_flags(ipif_t *, sin_t *, queue_t *, mblk_t *,
355    ip_ioctl_cmd_t *, void *);
356
357extern int ip_sioctl_mtu(ipif_t *, sin_t *, queue_t *, mblk_t *,
358    ip_ioctl_cmd_t *, void *);
359extern int ip_sioctl_get_mtu(ipif_t *, sin_t *, queue_t *, mblk_t *,
360    ip_ioctl_cmd_t *, void *);
361
362extern int ip_sioctl_get_ifconf(ipif_t *, sin_t *, queue_t *, mblk_t *,
363    ip_ioctl_cmd_t *, void *);
364extern int ip_sioctl_get_lifconf(ipif_t *, sin_t *, queue_t *, mblk_t *,
365    ip_ioctl_cmd_t *, void *);
366extern int ip_sioctl_get_ifnum(ipif_t *, sin_t *, queue_t *, mblk_t *,
367    ip_ioctl_cmd_t *, void *);
368extern int ip_sioctl_get_lifnum(ipif_t *, sin_t *, queue_t *, mblk_t *,
369    ip_ioctl_cmd_t *, void *);
370
371extern int ip_sioctl_token(ipif_t *, sin_t *, queue_t *, mblk_t *,
372    ip_ioctl_cmd_t *, void *);
373extern int ip_sioctl_get_token(ipif_t *, sin_t *, queue_t *, mblk_t *,
374    ip_ioctl_cmd_t *, void *);
375
376extern int if_unitsel(ipif_t *, sin_t *, queue_t *, mblk_t *,
377    ip_ioctl_cmd_t *, void *);
378extern int if_unitsel_restart(ipif_t *, sin_t *, queue_t *, mblk_t *,
379    ip_ioctl_cmd_t *, void *);
380
381extern int ip_sioctl_sifname(ipif_t *, sin_t *, queue_t *, mblk_t *,
382    ip_ioctl_cmd_t *, void *);
383
384extern int ip_sioctl_slifname(ipif_t *, sin_t *, queue_t *, mblk_t *,
385    ip_ioctl_cmd_t *, void *);
386extern int ip_sioctl_slifname_restart(ipif_t *, sin_t *, queue_t *,
387    mblk_t *, ip_ioctl_cmd_t *, void *);
388
389extern int ip_sioctl_slifindex(ipif_t *, sin_t *, queue_t *, mblk_t *,
390    ip_ioctl_cmd_t *, void *);
391extern int ip_sioctl_get_lifindex(ipif_t *, sin_t *, queue_t *, mblk_t *,
392    ip_ioctl_cmd_t *, void *);
393
394extern int ip_sioctl_brdaddr(ipif_t *, sin_t *, queue_t *, mblk_t *,
395    ip_ioctl_cmd_t *, void *);
396extern int ip_sioctl_get_brdaddr(ipif_t *, sin_t *, queue_t *, mblk_t *,
397    ip_ioctl_cmd_t *, void *);
398
399extern int ip_sioctl_get_muxid(ipif_t *, sin_t *, queue_t *, mblk_t *,
400    ip_ioctl_cmd_t *, void *);
401extern int ip_sioctl_muxid(ipif_t *, sin_t *, queue_t *, mblk_t *,
402    ip_ioctl_cmd_t *, void *);
403
404extern int ip_sioctl_netmask(ipif_t *, sin_t *, queue_t *, mblk_t *,
405    ip_ioctl_cmd_t *, void *);
406extern int ip_sioctl_get_netmask(ipif_t *, sin_t *, queue_t *, mblk_t *,
407    ip_ioctl_cmd_t *, void *);
408extern int ip_sioctl_netmask_restart(ipif_t *, sin_t *, queue_t *, mblk_t *,
409    ip_ioctl_cmd_t *, void *);
410
411extern int ip_sioctl_subnet(ipif_t *, sin_t *, queue_t *, mblk_t *,
412    ip_ioctl_cmd_t *, void *);
413extern int ip_sioctl_subnet_restart(ipif_t *, sin_t *, queue_t *, mblk_t *,
414    ip_ioctl_cmd_t *, void *);
415extern int ip_sioctl_get_subnet(ipif_t *, sin_t *, queue_t *, mblk_t *,
416    ip_ioctl_cmd_t *, void *);
417
418extern int ip_sioctl_lnkinfo(ipif_t *, sin_t *, queue_t *, mblk_t *,
419    ip_ioctl_cmd_t *, void *);
420extern int ip_sioctl_get_lnkinfo(ipif_t *, sin_t *, queue_t *, mblk_t *,
421    ip_ioctl_cmd_t *, void *);
422
423extern int ip_sioctl_metric(ipif_t *, sin_t *, queue_t *, mblk_t *,
424    ip_ioctl_cmd_t *, void *);
425extern int ip_sioctl_get_metric(ipif_t *, sin_t *, queue_t *, mblk_t *,
426    ip_ioctl_cmd_t *, void *);
427
428extern int ip_sioctl_arp(ipif_t *, sin_t *, queue_t *, mblk_t *,
429    ip_ioctl_cmd_t *, void *);
430
431extern int ip_sioctl_addif(ipif_t *, sin_t *, queue_t *, mblk_t *,
432    ip_ioctl_cmd_t *, void *);
433extern int ip_sioctl_removeif(ipif_t *, sin_t *, queue_t *, mblk_t *,
434    ip_ioctl_cmd_t *, void *);
435extern int ip_sioctl_removeif_restart(ipif_t *, sin_t *, queue_t *, mblk_t *,
436    ip_ioctl_cmd_t *, void *);
437
438extern int ip_sioctl_tonlink(ipif_t *, sin_t *, queue_t *, mblk_t *,
439    ip_ioctl_cmd_t *, void *);
440extern int ip_sioctl_tmysite(ipif_t *, sin_t *, queue_t *, mblk_t *,
441    ip_ioctl_cmd_t *, void *);
442extern int ip_sioctl_tmyaddr(ipif_t *, sin_t *, queue_t *, mblk_t *,
443    ip_ioctl_cmd_t *, void *);
444
445extern int ip_sioctl_get_binding(ipif_t *, sin_t *, queue_t *,
446    mblk_t *, ip_ioctl_cmd_t *, void *);
447extern int ip_sioctl_groupname(ipif_t *, sin_t *, queue_t *,
448    mblk_t *, ip_ioctl_cmd_t *, void *);
449extern int ip_sioctl_get_groupname(ipif_t *, sin_t *, queue_t *,
450    mblk_t *, ip_ioctl_cmd_t *, void *);
451extern int ip_sioctl_groupinfo(ipif_t *, sin_t *, queue_t *,
452    mblk_t *, ip_ioctl_cmd_t *, void *);
453
454extern int ip_sioctl_get_lifzone(ipif_t *, sin_t *, queue_t *,
455    mblk_t *, ip_ioctl_cmd_t *, void *);
456extern int ip_sioctl_slifzone(ipif_t *, sin_t *, queue_t *,
457    mblk_t *, ip_ioctl_cmd_t *, void *);
458extern int ip_sioctl_slifzone_restart(ipif_t *, sin_t *, queue_t *,
459    mblk_t *, ip_ioctl_cmd_t *, void *);
460
461extern int ip_sioctl_get_lifusesrc(ipif_t *, sin_t *, queue_t *,
462    mblk_t *, ip_ioctl_cmd_t *, void *);
463extern int ip_sioctl_slifusesrc(ipif_t *, sin_t *, queue_t *,
464    mblk_t *, ip_ioctl_cmd_t *, void *);
465extern int ip_sioctl_get_lifsrcof(ipif_t *, sin_t *, queue_t *,
466    mblk_t *, ip_ioctl_cmd_t *, void *);
467
468extern	void	ip_sioctl_copyin_resume(ipsq_t *, queue_t *, mblk_t *, void *);
469extern	void	ip_sioctl_copyin_setup(queue_t *, mblk_t *);
470extern	ip_ioctl_cmd_t *ip_sioctl_lookup(int);
471extern void	ipif_delete_ires_v4(ipif_t *);
472extern void	ipif_delete_ires_v6(ipif_t *);
473extern int	ipif_arp_up(ipif_t *, enum ip_resolver_action, boolean_t);
474extern void	ipif_dup_recovery(void *);
475extern void	ipif_do_recovery(ipif_t *);
476
477/*
478 * Notes on reference tracing on ill, ipif, ire, nce data structures:
479 *
480 * The current model of references on an ipif or ill is purely based on threads
481 * acquiring a reference by doing a lookup on the ill or ipif or by calling a
482 * refhold function on the ill or ipif. In particular any data structure that
483 * points to an ipif or ill does not explicitly contribute to a reference on the
484 * ill or ipif. More details may be seen in the block comment above ipif_down().
485 * Thus in the quiescent state an ill or ipif has a refcnt of zero. Similarly
486 * when a thread exits, there can't be any references on the ipif or ill due to
487 * the exiting thread.
488 *
489 * As a debugging aid, the refhold and refrele functions call into tracing
490 * functions that record the stack trace of the caller and the references
491 * acquired or released by the calling thread, hashed by the structure address
492 * in thread-specific-data (TSD).  On thread exit, ip_thread_exit destroys the
493 * hash, and the destructor for the hash entries (th_trace_free) verifies that
494 * there are no outstanding references to the ipif or ill from the exiting
495 * thread.
496 *
497 * In the case of ires and nces, the model is slightly different. Typically each
498 * ire pointing to an nce contributes to the nce_refcnt. Similarly a conn_t
499 * pointing to an ire also contributes to the ire_refcnt. Excluding the above
500 * special cases, the tracing behavior is similar to the tracing on ipif / ill.
501 * Traces are neither recorded nor verified in the exception cases, and the code
502 * is careful to use the right refhold and refrele functions. On thread exit
503 * ire_thread_exit, nce_thread_exit does the verification that are no
504 * outstanding references on the ire / nce from the exiting thread.
505 *
506 * The reference verification is driven from the TSD destructor which calls
507 * into IP's verification function ip_thread_exit. This debugging aid may be
508 * helpful in tracing missing refrele's on a debug kernel. On a non-debug
509 * kernel, these missing refrele's are noticeable only when an interface is
510 * being unplumbed, and the unplumb hangs, long after the missing refrele. On a
511 * debug kernel, the traces (th_trace_t) which contain the stack backtraces can
512 * be examined on a crash dump to locate the missing refrele.
513 */
514
515#endif /* _KERNEL */
516
517#ifdef	__cplusplus
518}
519#endif
520
521#endif	/* _INET_IP_IF_H */
522