10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*2157Sdh155122  * Common Development and Distribution License (the "License").
6*2157Sdh155122  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*2157Sdh155122  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	INTERFACE_H
270Sstevel@tonic-gate #define	INTERFACE_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate /*
320Sstevel@tonic-gate  * interface.[ch] encapsulate all of the agent's knowledge of network
330Sstevel@tonic-gate  * interfaces from the DHCP agent's perspective.  see interface.c
340Sstevel@tonic-gate  * for documentation on how to use the exported functions.  note that
350Sstevel@tonic-gate  * there are not functional interfaces for manipulating all of the fields
360Sstevel@tonic-gate  * in an ifslist -- please read the comments in the ifslist structure
370Sstevel@tonic-gate  * definition below for the rules on accessing various fields.
380Sstevel@tonic-gate  */
390Sstevel@tonic-gate 
400Sstevel@tonic-gate #ifdef	__cplusplus
410Sstevel@tonic-gate extern "C" {
420Sstevel@tonic-gate #endif
430Sstevel@tonic-gate 
440Sstevel@tonic-gate #include <netinet/in.h>
450Sstevel@tonic-gate #include <sys/socket.h>
460Sstevel@tonic-gate #include <net/if.h>			/* IFNAMSIZ */
470Sstevel@tonic-gate #include <sys/types.h>
480Sstevel@tonic-gate #include <netinet/dhcp.h>
490Sstevel@tonic-gate #include <dhcpagent_ipc.h>
500Sstevel@tonic-gate #include <libinetutil.h>
510Sstevel@tonic-gate 
520Sstevel@tonic-gate #include "async.h"
530Sstevel@tonic-gate #include "agent.h"
540Sstevel@tonic-gate #include "dlpi_io.h"
550Sstevel@tonic-gate #include "ipc_action.h"
560Sstevel@tonic-gate #include "packet.h"
570Sstevel@tonic-gate #include "util.h"
580Sstevel@tonic-gate 
590Sstevel@tonic-gate enum { DHCP_T1_TIMER, DHCP_T2_TIMER, DHCP_LEASE_TIMER };
600Sstevel@tonic-gate 
610Sstevel@tonic-gate typedef int script_callback_t (struct ifslist *, const char *);
620Sstevel@tonic-gate 
630Sstevel@tonic-gate struct ifslist {
640Sstevel@tonic-gate 
650Sstevel@tonic-gate 	/*
660Sstevel@tonic-gate 	 * ifslist chain pointers, maintained by insert_ifs() /
670Sstevel@tonic-gate 	 * remove_ifs().
680Sstevel@tonic-gate 	 */
690Sstevel@tonic-gate 
700Sstevel@tonic-gate 	struct ifslist		*next;
710Sstevel@tonic-gate 	struct ifslist		*prev;
720Sstevel@tonic-gate 
730Sstevel@tonic-gate 	/*
740Sstevel@tonic-gate 	 * hold count on this ifslist, maintained by hold_ifs() /
750Sstevel@tonic-gate 	 * release_ifs() -- see below for a discussion of ifs memory
760Sstevel@tonic-gate 	 * management.
770Sstevel@tonic-gate 	 */
780Sstevel@tonic-gate 
790Sstevel@tonic-gate 	uchar_t			if_hold_count;
800Sstevel@tonic-gate 
810Sstevel@tonic-gate 	/*
820Sstevel@tonic-gate 	 * each interface can have at most one pending asynchronous
830Sstevel@tonic-gate 	 * action, which is represented in a `struct async_action'.
840Sstevel@tonic-gate 	 * if that asynchronous action was a result of a user request,
850Sstevel@tonic-gate 	 * then the `struct ipc_action' is used to hold information
860Sstevel@tonic-gate 	 * about the user request.  these structures are opaque to
870Sstevel@tonic-gate 	 * users of the ifslist, and the functional interfaces
880Sstevel@tonic-gate 	 * provided in async.[ch] and ipc_action.[ch] should be used
890Sstevel@tonic-gate 	 * to maintain them.
900Sstevel@tonic-gate 	 */
910Sstevel@tonic-gate 
920Sstevel@tonic-gate 	struct ipc_action	if_ia;
930Sstevel@tonic-gate 	struct async_action	if_async;
940Sstevel@tonic-gate 
950Sstevel@tonic-gate 	/*
960Sstevel@tonic-gate 	 * current state of the interface
970Sstevel@tonic-gate 	 */
980Sstevel@tonic-gate 
990Sstevel@tonic-gate 	DHCPSTATE		if_state;
1000Sstevel@tonic-gate 
1010Sstevel@tonic-gate 	/*
1020Sstevel@tonic-gate 	 * flags specific to DHCP (see dhcpagent_ipc.h)
1030Sstevel@tonic-gate 	 */
1040Sstevel@tonic-gate 
1050Sstevel@tonic-gate 	uint16_t		if_dflags;
1060Sstevel@tonic-gate 
1070Sstevel@tonic-gate 	/*
1080Sstevel@tonic-gate 	 * general interface information -- this information is initialized
1090Sstevel@tonic-gate 	 * in insert_ifs() and does not change over the lifetime of the
1100Sstevel@tonic-gate 	 * interface.
1110Sstevel@tonic-gate 	 */
1120Sstevel@tonic-gate 
1130Sstevel@tonic-gate 	char		if_name[IFNAMSIZ];
1140Sstevel@tonic-gate 
1150Sstevel@tonic-gate 	uint16_t	if_max;		/* largest DHCP packet on this if */
1160Sstevel@tonic-gate 	uint16_t	if_min;		/* minimum mtu size on this if */
1170Sstevel@tonic-gate 	uint16_t	if_opt;		/* amount of space for options in PKT */
1180Sstevel@tonic-gate 
1190Sstevel@tonic-gate 	uchar_t		*if_hwaddr;	/* our link-layer address */
1200Sstevel@tonic-gate 	uchar_t		if_hwlen;	/* our link-layer address len */
1210Sstevel@tonic-gate 	uchar_t		if_hwtype;	/* type of link-layer */
1220Sstevel@tonic-gate 
1230Sstevel@tonic-gate 	uchar_t		*if_cid;	/* client id, if set in defaults file */
1240Sstevel@tonic-gate 	uchar_t		if_cidlen;	/* client id len */
1250Sstevel@tonic-gate 
1260Sstevel@tonic-gate 	uchar_t		*if_prl;	/* if non-NULL, param request list */
1270Sstevel@tonic-gate 	uchar_t		if_prllen;	/* param request list len */
1280Sstevel@tonic-gate 
1290Sstevel@tonic-gate 		/*
1300Sstevel@tonic-gate 		 * the destination address is the broadcast address of
1310Sstevel@tonic-gate 		 * the interface, in DLPI terms (which means it
1320Sstevel@tonic-gate 		 * includes both a link-layer broadcast address and a
1330Sstevel@tonic-gate 		 * sap, and the order isn't consistent.)  fun, huh?
1340Sstevel@tonic-gate 		 * blame AT&T.  we store it as a token like this
1350Sstevel@tonic-gate 		 * because it's generally how we need to use it.  we
1360Sstevel@tonic-gate 		 * can pull it apart using the saplen and sap_before
1370Sstevel@tonic-gate 		 * fields below.
1380Sstevel@tonic-gate 		 */
1390Sstevel@tonic-gate 
1400Sstevel@tonic-gate 	uchar_t		*if_daddr;	/* our destination address */
1410Sstevel@tonic-gate 	uchar_t		if_dlen;	/* our destination address len */
1420Sstevel@tonic-gate 
1430Sstevel@tonic-gate 	uchar_t		if_saplen;	/* the SAP len */
1440Sstevel@tonic-gate 	uchar_t		if_sap_before;	/* does SAP come before address? */
1450Sstevel@tonic-gate 
1460Sstevel@tonic-gate 		/*
1470Sstevel@tonic-gate 		 * network descriptors; one is used for the DLPI
1480Sstevel@tonic-gate 		 * traffic before we have our IP address configured;
1490Sstevel@tonic-gate 		 * the other two are used afterwards.  there have to
1500Sstevel@tonic-gate 		 * be two socket descriptors since:
1510Sstevel@tonic-gate 		 *
1520Sstevel@tonic-gate 		 * o  we need one to be bound to IPPORT_BOOTPC and
1530Sstevel@tonic-gate 		 *    and INADDR_BROADCAST, so it can receive all
1540Sstevel@tonic-gate 		 *    broadcast traffic.  this is if_sock_fd.  it
1550Sstevel@tonic-gate 		 *    is also used as a general descriptor to perform
1560Sstevel@tonic-gate 		 *    socket-related ioctls on, like SIOCGIFFLAGS.
1570Sstevel@tonic-gate 		 *
1580Sstevel@tonic-gate 		 * o  we need another to be bound to IPPORT_BOOTPC and
1590Sstevel@tonic-gate 		 *    the IP address given to us by the DHCP server,
1600Sstevel@tonic-gate 		 *    so we can guarantee the IP address of outgoing
1610Sstevel@tonic-gate 		 *    packets when multihomed. (the problem being that
1620Sstevel@tonic-gate 		 *    if a packet goes out with the wrong IP address,
1630Sstevel@tonic-gate 		 *    then the server's response will come back on the
1640Sstevel@tonic-gate 		 *    wrong interface).  this is if_sock_ip_fd.
1650Sstevel@tonic-gate 		 *
1660Sstevel@tonic-gate 		 * note that if_sock_fd is created in init_ifs() but
1670Sstevel@tonic-gate 		 * not bound until dhcp_bound(); this is because we
1680Sstevel@tonic-gate 		 * cannot even bind to the broadcast address until we
1690Sstevel@tonic-gate 		 * have an IP address.
1700Sstevel@tonic-gate 		 *
1710Sstevel@tonic-gate 		 * if_sock_ip_fd isn't created until dhcp_bound(),
1720Sstevel@tonic-gate 		 * since we don't need it until then and we can't
1730Sstevel@tonic-gate 		 * bind it until after we have an IP address anyway.
1740Sstevel@tonic-gate 		 *
1750Sstevel@tonic-gate 		 * both socket descriptors are closed in reset_ifs().
1760Sstevel@tonic-gate 		 */
1770Sstevel@tonic-gate 
1780Sstevel@tonic-gate 	int		if_dlpi_fd;
1790Sstevel@tonic-gate 	int		if_sock_fd;
1800Sstevel@tonic-gate 	int		if_sock_ip_fd;
1810Sstevel@tonic-gate 
1820Sstevel@tonic-gate 	/*
1830Sstevel@tonic-gate 	 * the following fields are set when a lease is acquired, and
1840Sstevel@tonic-gate 	 * may be updated over the lifetime of the lease.  they are
1850Sstevel@tonic-gate 	 * all reset by reset_ifs().
1860Sstevel@tonic-gate 	 */
1870Sstevel@tonic-gate 
1880Sstevel@tonic-gate 	iu_timer_id_t	if_timer[3];	/* T1, T2, and LEASE timers */
1890Sstevel@tonic-gate 
1900Sstevel@tonic-gate 	lease_t		if_t1;		/* relative renewal start time, hbo */
1910Sstevel@tonic-gate 	lease_t		if_t2;		/* relative rebinding start time, hbo */
1920Sstevel@tonic-gate 	lease_t		if_lease;	/* relative expire time, hbo */
1930Sstevel@tonic-gate 
1940Sstevel@tonic-gate 	unsigned int	if_nrouters;	/* the number of default routers */
1950Sstevel@tonic-gate 	struct in_addr	*if_routers;	/* an array of default routers */
1960Sstevel@tonic-gate 	struct in_addr	if_server;	/* our DHCP server, nbo */
1970Sstevel@tonic-gate 
1980Sstevel@tonic-gate 	/*
1990Sstevel@tonic-gate 	 * while in any states except ADOPTING, INIT, INFORMATION and
2000Sstevel@tonic-gate 	 * INFORM_SENT, the following three fields are equal to what
2010Sstevel@tonic-gate 	 * we believe the current address, netmask, and broadcast
2020Sstevel@tonic-gate 	 * address on the interface to be.  this is so we can detect
2030Sstevel@tonic-gate 	 * if the user changes them and abandon the interface.
2040Sstevel@tonic-gate 	 */
2050Sstevel@tonic-gate 
2060Sstevel@tonic-gate 	struct in_addr	if_addr;	/* our IP address, nbo */
2070Sstevel@tonic-gate 	struct in_addr	if_netmask;	/* our netmask, nbo */
2080Sstevel@tonic-gate 	struct in_addr	if_broadcast;	/* our broadcast address, nbo */
2090Sstevel@tonic-gate 
2100Sstevel@tonic-gate 	PKT_LIST	*if_ack;	/* ACK from the server */
2110Sstevel@tonic-gate 
2120Sstevel@tonic-gate 	/*
2130Sstevel@tonic-gate 	 * We retain the very first ack obtained on the interface to
2140Sstevel@tonic-gate 	 * provide access to options which were originally assigned by
2150Sstevel@tonic-gate 	 * the server but may not have been included in subsequent
2160Sstevel@tonic-gate 	 * acks, as there are servers which do this and customers have
2170Sstevel@tonic-gate 	 * had unsatisfactory results when using our agent with them.
2180Sstevel@tonic-gate 	 * ipc_event() in agent.c provides a fallback to the original
2190Sstevel@tonic-gate 	 * ack when the current ack doesn't have the information
2200Sstevel@tonic-gate 	 * requested.
2210Sstevel@tonic-gate 	 */
2220Sstevel@tonic-gate 
2230Sstevel@tonic-gate 	PKT_LIST	*if_orig_ack;
2240Sstevel@tonic-gate 
2250Sstevel@tonic-gate 	/*
2260Sstevel@tonic-gate 	 * other miscellaneous variables set or needed in the process
2270Sstevel@tonic-gate 	 * of acquiring a lease.
2280Sstevel@tonic-gate 	 */
2290Sstevel@tonic-gate 
2300Sstevel@tonic-gate 	int		if_offer_wait;	/* seconds between offers */
2310Sstevel@tonic-gate 	iu_event_id_t	if_offer_id;	/* event offer id */
2320Sstevel@tonic-gate 	iu_event_id_t	if_acknak_id;	/* event acknak id */
2330Sstevel@tonic-gate 	iu_event_id_t	if_acknak_bcast_id;
2340Sstevel@tonic-gate 
2350Sstevel@tonic-gate 		/*
2360Sstevel@tonic-gate 		 * `if_neg_monosec' represents the time since lease
2370Sstevel@tonic-gate 		 * acquisition or renewal began, and is used for
2380Sstevel@tonic-gate 		 * computing the pkt->secs field.  `if_newstart_monosec'
2390Sstevel@tonic-gate 		 * represents the time the ACKed REQUEST was sent,
2400Sstevel@tonic-gate 		 * which represents the start time of a new lease.
2410Sstevel@tonic-gate 		 * when the lease actually begins (and thus becomes
2420Sstevel@tonic-gate 		 * current), `if_curstart_monosec' is set to
2430Sstevel@tonic-gate 		 * `if_newstart_monosec'.
2440Sstevel@tonic-gate 		 */
2450Sstevel@tonic-gate 
2460Sstevel@tonic-gate 	monosec_t		if_neg_monosec;
2470Sstevel@tonic-gate 	monosec_t		if_newstart_monosec;
2480Sstevel@tonic-gate 	monosec_t		if_curstart_monosec;
2490Sstevel@tonic-gate 
2500Sstevel@tonic-gate 		/*
2510Sstevel@tonic-gate 		 * time we sent the DISCOVER relative to if_neg_monosec,
2520Sstevel@tonic-gate 		 * so that the REQUEST can have the same pkt->secs.
2530Sstevel@tonic-gate 		 */
2540Sstevel@tonic-gate 
2550Sstevel@tonic-gate 	uint16_t		if_disc_secs;
2560Sstevel@tonic-gate 
2570Sstevel@tonic-gate 		/*
2580Sstevel@tonic-gate 		 * the host name we've been asked to request is remembered
2590Sstevel@tonic-gate 		 * here between the DISCOVER and the REQUEST
2600Sstevel@tonic-gate 		 */
2610Sstevel@tonic-gate 	char			*if_reqhost;
2620Sstevel@tonic-gate 
2630Sstevel@tonic-gate 	/*
2640Sstevel@tonic-gate 	 * this is a chain of packets which have been received on this
2650Sstevel@tonic-gate 	 * interface over some interval of time.  the packets may have
2660Sstevel@tonic-gate 	 * to meet some criteria in order to be put on this list.  in
2670Sstevel@tonic-gate 	 * general, packets are put on this list through recv_pkt()
2680Sstevel@tonic-gate 	 */
2690Sstevel@tonic-gate 
2700Sstevel@tonic-gate 	PKT_LIST		*if_recv_pkt_list;
2710Sstevel@tonic-gate 
2720Sstevel@tonic-gate 	/*
2730Sstevel@tonic-gate 	 * these three fields are initially zero, and get incremented
2740Sstevel@tonic-gate 	 * as the ifslist goes from INIT -> BOUND.  if and when the
2750Sstevel@tonic-gate 	 * ifslist moves to the RENEWING state, these fields are
2760Sstevel@tonic-gate 	 * reset, so they always either indicate the number of packets
2770Sstevel@tonic-gate 	 * sent, received, and declined while obtaining the current
2780Sstevel@tonic-gate 	 * lease (if BOUND), or the number of packets sent, received,
2790Sstevel@tonic-gate 	 * and declined while attempting to obtain a future lease
2800Sstevel@tonic-gate 	 * (if any other state).
2810Sstevel@tonic-gate 	 */
2820Sstevel@tonic-gate 
2830Sstevel@tonic-gate 	uint32_t		if_sent;
2840Sstevel@tonic-gate 	uint32_t		if_received;
2850Sstevel@tonic-gate 	uint32_t		if_bad_offers;
2860Sstevel@tonic-gate 
2870Sstevel@tonic-gate 	/*
2880Sstevel@tonic-gate 	 * if_send_pkt.pkt is dynamically allocated to be as big a
2890Sstevel@tonic-gate 	 * packet as we can send out on this interface.  the remainder
2900Sstevel@tonic-gate 	 * of this information is needed to make it easy to handle
2910Sstevel@tonic-gate 	 * retransmissions.  note that other than if_bad_offers, all
2920Sstevel@tonic-gate 	 * of these fields are maintained internally in send_pkt(),
2930Sstevel@tonic-gate 	 * and consequently should never need to be modified by any
2940Sstevel@tonic-gate 	 * other functions.
2950Sstevel@tonic-gate 	 */
2960Sstevel@tonic-gate 
2970Sstevel@tonic-gate 	dhcp_pkt_t		if_send_pkt;
2980Sstevel@tonic-gate 	uint32_t		if_send_timeout;
2990Sstevel@tonic-gate 	struct sockaddr_in	if_send_dest;
3000Sstevel@tonic-gate 	stop_func_t		*if_send_stop_func;
3010Sstevel@tonic-gate 	uint32_t		if_packet_sent;
3020Sstevel@tonic-gate 	iu_timer_id_t		if_retrans_timer;
303*2157Sdh155122 	iu_timer_id_t		if_offer_timer;
3040Sstevel@tonic-gate 
3050Sstevel@tonic-gate 	int			if_script_fd;
3060Sstevel@tonic-gate 	pid_t			if_script_pid;
3070Sstevel@tonic-gate 	pid_t			if_script_helper_pid;
3080Sstevel@tonic-gate 	const char		*if_script_event;
3090Sstevel@tonic-gate 	iu_event_id_t		if_script_event_id;
3100Sstevel@tonic-gate 	const char		*if_callback_msg;
3110Sstevel@tonic-gate 	script_callback_t	*if_script_callback;
3120Sstevel@tonic-gate };
3130Sstevel@tonic-gate 
3140Sstevel@tonic-gate /*
3150Sstevel@tonic-gate  * a word on memory management and ifslists:
3160Sstevel@tonic-gate  *
3170Sstevel@tonic-gate  * since ifslists are often passed as context to callback functions,
3180Sstevel@tonic-gate  * they cannot be freed when the interface they represent is dropped
3190Sstevel@tonic-gate  * or released (or when those callbacks finally go off, they will be
3200Sstevel@tonic-gate  * hosed).  to handle this situation, ifslists are reference counted.
3210Sstevel@tonic-gate  * here are the rules for managing ifslists:
3220Sstevel@tonic-gate  *
3230Sstevel@tonic-gate  * an ifslist is created through insert_ifs().  along with
3240Sstevel@tonic-gate  * initializing the ifslist, this puts a hold on the ifslist through
3250Sstevel@tonic-gate  * hold_ifs().
3260Sstevel@tonic-gate  *
3270Sstevel@tonic-gate  * whenever an ifslist is released or dropped (implicitly or
3280Sstevel@tonic-gate  * explicitly), remove_ifs() is called, which sets the DHCP_IF_REMOVED
3290Sstevel@tonic-gate  * flag and removes the interface from the internal list of managed
3300Sstevel@tonic-gate  * interfaces.  lastly, remove_ifs() calls release_ifs() to remove the
3310Sstevel@tonic-gate  * hold acquired in insert_ifs().  if this decrements the hold count
3320Sstevel@tonic-gate  * on the interface to zero, then free_ifs() is called.  if there are
3330Sstevel@tonic-gate  * holds other than the hold acquired in insert_ifs(), the hold count
3340Sstevel@tonic-gate  * will still be > 0, and the interface will remain allocated (though
3350Sstevel@tonic-gate  * dormant).
3360Sstevel@tonic-gate  *
3370Sstevel@tonic-gate  * whenever a callback is scheduled against an ifslist, another hold
3380Sstevel@tonic-gate  * must be put on the ifslist through hold_ifs().
3390Sstevel@tonic-gate  *
3400Sstevel@tonic-gate  * whenever a callback is called back against an ifslist,
3410Sstevel@tonic-gate  * release_ifs() must be called to decrement the hold count, which may
3420Sstevel@tonic-gate  * end up freeing the ifslist if the hold count becomes zero.
3430Sstevel@tonic-gate  *
3440Sstevel@tonic-gate  * if release_ifs() returns 0, then there are no remaining holds
3450Sstevel@tonic-gate  * against this ifslist, and the ifslist in fact no longer exists.
3460Sstevel@tonic-gate  *
3470Sstevel@tonic-gate  * since some callbacks may take a long time to get called back (such
3480Sstevel@tonic-gate  * as timeout callbacks for lease expiration, etc), it is sometimes
3490Sstevel@tonic-gate  * more appropriate to cancel the callbacks and call release_ifs() if
3500Sstevel@tonic-gate  * the cancellation succeeds.  this is done in remove_ifs() for the
3510Sstevel@tonic-gate  * lease, t1, and t2 callbacks.
3520Sstevel@tonic-gate  *
3530Sstevel@tonic-gate  * in general, a callback should also call verify_ifs() when it gets
3540Sstevel@tonic-gate  * called back in addition to release_ifs(), to make sure that the
3550Sstevel@tonic-gate  * interface is still in fact under the dhcpagent's control.  to make
3560Sstevel@tonic-gate  * coding simpler, there is a third function, check_ifs(), which
3570Sstevel@tonic-gate  * performs both the release_ifs() and the verify_ifs().  in addition,
3580Sstevel@tonic-gate  * if check_ifs() detects that the callback has the last hold against
3590Sstevel@tonic-gate  * a given interface, it informs it instead of performing the final
3600Sstevel@tonic-gate  * release, and thus allows it to clean up appropriately before
3610Sstevel@tonic-gate  * performing the final release.
3620Sstevel@tonic-gate  */
3630Sstevel@tonic-gate 
3640Sstevel@tonic-gate int		canonize_ifs(struct ifslist *);
3650Sstevel@tonic-gate int		check_ifs(struct ifslist *);
3660Sstevel@tonic-gate void		hold_ifs(struct ifslist *);
3670Sstevel@tonic-gate struct ifslist *insert_ifs(const char *, boolean_t, int *);
3680Sstevel@tonic-gate struct ifslist *lookup_ifs(const char *);
3690Sstevel@tonic-gate struct ifslist *lookup_ifs_by_xid(uint32_t);
3700Sstevel@tonic-gate void		nuke_ifslist(boolean_t);
3710Sstevel@tonic-gate void		refresh_ifslist(iu_eh_t *, int, void *);
3720Sstevel@tonic-gate int		release_ifs(struct ifslist *);
3730Sstevel@tonic-gate void		remove_ifs(struct ifslist *);
3740Sstevel@tonic-gate void		reset_ifs(struct ifslist *);
3750Sstevel@tonic-gate int		verify_ifs(struct ifslist *);
3760Sstevel@tonic-gate unsigned int	ifs_count(void);
3770Sstevel@tonic-gate void		cancel_ifs_timers(struct ifslist *);
3780Sstevel@tonic-gate int		schedule_ifs_timer(struct ifslist *, int, uint32_t,
3790Sstevel@tonic-gate 		    iu_tq_callback_t *);
3800Sstevel@tonic-gate 
3810Sstevel@tonic-gate #ifdef	__cplusplus
3820Sstevel@tonic-gate }
3830Sstevel@tonic-gate #endif
3840Sstevel@tonic-gate 
3850Sstevel@tonic-gate #endif	/* INTERFACE_H */
386