if_var.h revision 79103
121259Swollman/*
221259Swollman * Copyright (c) 1982, 1986, 1989, 1993
321259Swollman *	The Regents of the University of California.  All rights reserved.
421259Swollman *
521259Swollman * Redistribution and use in source and binary forms, with or without
621259Swollman * modification, are permitted provided that the following conditions
721259Swollman * are met:
821259Swollman * 1. Redistributions of source code must retain the above copyright
921259Swollman *    notice, this list of conditions and the following disclaimer.
1021259Swollman * 2. Redistributions in binary form must reproduce the above copyright
1121259Swollman *    notice, this list of conditions and the following disclaimer in the
1221259Swollman *    documentation and/or other materials provided with the distribution.
1321259Swollman * 3. All advertising materials mentioning features or use of this software
1421259Swollman *    must display the following acknowledgement:
1521259Swollman *	This product includes software developed by the University of
1621259Swollman *	California, Berkeley and its contributors.
1721259Swollman * 4. Neither the name of the University nor the names of its contributors
1821259Swollman *    may be used to endorse or promote products derived from this software
1921259Swollman *    without specific prior written permission.
2021259Swollman *
2121259Swollman * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2221259Swollman * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2321259Swollman * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2421259Swollman * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2521259Swollman * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2621259Swollman * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2721259Swollman * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2821259Swollman * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2921259Swollman * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3021259Swollman * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3121259Swollman * SUCH DAMAGE.
3221259Swollman *
3321259Swollman *	From: @(#)if.h	8.1 (Berkeley) 6/10/93
3450477Speter * $FreeBSD: head/sys/net/if_var.h 79103 2001-07-02 20:49:25Z brooks $
3521259Swollman */
3621259Swollman
3721259Swollman#ifndef	_NET_IF_VAR_H_
3821259Swollman#define	_NET_IF_VAR_H_
3921259Swollman
4021259Swollman/*
4121259Swollman * Structures defining a network interface, providing a packet
4221259Swollman * transport mechanism (ala level 0 of the PUP protocols).
4321259Swollman *
4421259Swollman * Each interface accepts output datagrams of a specified maximum
4521259Swollman * length, and provides higher level routines with input datagrams
4621259Swollman * received from its medium.
4721259Swollman *
4821259Swollman * Output occurs when the routine if_output is called, with three parameters:
4921259Swollman *	(*ifp->if_output)(ifp, m, dst, rt)
5021259Swollman * Here m is the mbuf chain to be sent and dst is the destination address.
5121259Swollman * The output routine encapsulates the supplied datagram if necessary,
5221259Swollman * and then transmits it on its medium.
5321259Swollman *
5421259Swollman * On input, each interface unwraps the data received by it, and either
5521259Swollman * places it on the input queue of a internetwork datagram routine
5621259Swollman * and posts the associated software interrupt, or passes the datagram to a raw
5721259Swollman * packet input routine.
5821259Swollman *
5921259Swollman * Routines exist for locating interfaces by their addresses
6021259Swollman * or for locating a interface on a certain network, as well as more general
6121259Swollman * routing and gateway routines maintaining information used to locate
6221259Swollman * interfaces.  These routines live in the files if.c and route.c
6321259Swollman */
6421259Swollman
6521259Swollman#ifdef __STDC__
6621259Swollman/*
6721259Swollman * Forward structure declarations for function prototypes [sic].
6821259Swollman */
6921259Swollmanstruct	mbuf;
7021259Swollmanstruct	proc;
7121259Swollmanstruct	rtentry;
7221259Swollmanstruct	socket;
7321259Swollmanstruct	ether_header;
7421259Swollman#endif
7521259Swollman
7621259Swollman#include <sys/queue.h>		/* get TAILQ macros */
7721259Swollman
7869224Sjlemon#ifdef _KERNEL
7969152Sjlemon#include <sys/mbuf.h>
8074914Sjhb#include <sys/systm.h>		/* XXX */
8169224Sjlemon#endif /* _KERNEL */
8274914Sjhb#include <sys/lock.h>		/* XXX */
8374914Sjhb#include <sys/mutex.h>		/* XXX */
8469152Sjlemon
8560938SjakeTAILQ_HEAD(ifnethead, ifnet);	/* we use TAILQs so that the order of */
8660938SjakeTAILQ_HEAD(ifaddrhead, ifaddr);	/* instantiation is preserved in the list */
8760938SjakeTAILQ_HEAD(ifprefixhead, ifprefix);
8872084SphkTAILQ_HEAD(ifmultihead, ifmultiaddr);
8921259Swollman
9021259Swollman/*
9121259Swollman * Structure defining a queue for a network interface.
9221259Swollman */
9321259Swollmanstruct	ifqueue {
9421259Swollman	struct	mbuf *ifq_head;
9521259Swollman	struct	mbuf *ifq_tail;
9621259Swollman	int	ifq_len;
9721259Swollman	int	ifq_maxlen;
9821259Swollman	int	ifq_drops;
9969152Sjlemon	struct	mtx ifq_mtx;
10021259Swollman};
10121259Swollman
10221259Swollman/*
10321259Swollman * Structure defining a network interface.
10421259Swollman *
10521259Swollman * (Would like to call this struct ``if'', but C isn't PL/1.)
10621259Swollman */
10721259Swollmanstruct ifnet {
10821259Swollman	void	*if_softc;		/* pointer to driver state */
10921259Swollman	char	*if_name;		/* name, e.g. ``en'' or ``lo'' */
11060938Sjake	TAILQ_ENTRY(ifnet) if_link; 	/* all struct ifnets are chained */
11121259Swollman	struct	ifaddrhead if_addrhead;	/* linked list of addresses per if */
11221259Swollman        int	if_pcount;		/* number of promiscuous listeners */
11321259Swollman	struct	bpf_if *if_bpf;		/* packet filter structure */
11421259Swollman	u_short	if_index;		/* numeric abbreviation for this if  */
11521259Swollman	short	if_unit;		/* sub-unit for lower level driver */
11621259Swollman	short	if_timer;		/* time 'til if_watchdog called */
11721259Swollman	short	if_flags;		/* up/down, broadcast, etc. */
11869152Sjlemon	int	if_mpsafe;		/* XXX TEMPORARY */
11921259Swollman	int	if_ipending;		/* interrupts pending */
12021259Swollman	void	*if_linkmib;		/* link-type-specific MIB data */
12121259Swollman	size_t	if_linkmiblen;		/* length of above data */
12221259Swollman	struct	if_data if_data;
12321404Swollman	struct	ifmultihead if_multiaddrs; /* multicast addresses configured */
12421404Swollman	int	if_amcount;		/* number of all-multicast requests */
12521259Swollman/* procedure handles */
12621259Swollman	int	(*if_output)		/* output routine (enqueue) */
12721259Swollman		__P((struct ifnet *, struct mbuf *, struct sockaddr *,
12821259Swollman		     struct rtentry *));
12921259Swollman	void	(*if_start)		/* initiate output routine */
13021259Swollman		__P((struct ifnet *));
13121259Swollman	int	(*if_done)		/* output complete routine */
13221259Swollman		__P((struct ifnet *));	/* (XXX not used; fake prototype) */
13321259Swollman	int	(*if_ioctl)		/* ioctl routine */
13436735Sdfr		__P((struct ifnet *, u_long, caddr_t));
13521259Swollman	void	(*if_watchdog)		/* timer routine */
13621259Swollman		__P((struct ifnet *));
13721259Swollman	int	(*if_poll_recv)		/* polled receive routine */
13821259Swollman		__P((struct ifnet *, int *));
13921259Swollman	int	(*if_poll_xmit)		/* polled transmit routine */
14021259Swollman		__P((struct ifnet *, int *));
14121259Swollman	void	(*if_poll_intren)	/* polled interrupt reenable routine */
14221259Swollman		__P((struct ifnet *));
14321259Swollman	void	(*if_poll_slowinput)	/* input routine for slow devices */
14421259Swollman		__P((struct ifnet *, struct mbuf *));
14521259Swollman	void	(*if_init)		/* Init routine */
14621259Swollman		__P((void *));
14721404Swollman	int	(*if_resolvemulti)	/* validate/resolve multicast */
14821404Swollman		__P((struct ifnet *, struct sockaddr **, struct sockaddr *));
14921259Swollman	struct	ifqueue if_snd;		/* output queue */
15021259Swollman	struct	ifqueue *if_poll_slowq;	/* input queue for slow devices */
15152904Sshin	struct	ifprefixhead if_prefixhead; /* list of prefixes per if */
15221259Swollman};
15369152Sjlemon
15421259Swollmantypedef void if_init_f_t __P((void *));
15521259Swollman
15621259Swollman#define	if_mtu		if_data.ifi_mtu
15721259Swollman#define	if_type		if_data.ifi_type
15821259Swollman#define if_physical	if_data.ifi_physical
15921259Swollman#define	if_addrlen	if_data.ifi_addrlen
16021259Swollman#define	if_hdrlen	if_data.ifi_hdrlen
16121259Swollman#define	if_metric	if_data.ifi_metric
16221259Swollman#define	if_baudrate	if_data.ifi_baudrate
16358698Sjlemon#define	if_hwassist	if_data.ifi_hwassist
16421259Swollman#define	if_ipackets	if_data.ifi_ipackets
16521259Swollman#define	if_ierrors	if_data.ifi_ierrors
16621259Swollman#define	if_opackets	if_data.ifi_opackets
16721259Swollman#define	if_oerrors	if_data.ifi_oerrors
16821259Swollman#define	if_collisions	if_data.ifi_collisions
16921259Swollman#define	if_ibytes	if_data.ifi_ibytes
17021259Swollman#define	if_obytes	if_data.ifi_obytes
17121259Swollman#define	if_imcasts	if_data.ifi_imcasts
17221259Swollman#define	if_omcasts	if_data.ifi_omcasts
17321259Swollman#define	if_iqdrops	if_data.ifi_iqdrops
17421259Swollman#define	if_noproto	if_data.ifi_noproto
17521259Swollman#define	if_lastchange	if_data.ifi_lastchange
17621259Swollman#define if_recvquota	if_data.ifi_recvquota
17721259Swollman#define	if_xmitquota	if_data.ifi_xmitquota
17821259Swollman#define if_rawoutput(if, m, sa) if_output(if, m, sa, (struct rtentry *)0)
17921259Swollman
18053541Sshin/* for compatibility with other BSDs */
18153541Sshin#define	if_addrlist	if_addrhead
18253541Sshin#define	if_list		if_link
18353541Sshin
18421259Swollman/*
18521259Swollman * Bit values in if_ipending
18621259Swollman */
18721259Swollman#define	IFI_RECV	1	/* I want to receive */
18821259Swollman#define	IFI_XMIT	2	/* I want to transmit */
18921259Swollman
19021259Swollman/*
19121259Swollman * Output queues (ifp->if_snd) and slow device input queues (*ifp->if_slowq)
19221259Swollman * are queues of messages stored on ifqueue structures
19321259Swollman * (defined above).  Entries are added to and deleted from these structures
19421259Swollman * by these macros, which should be called with ipl raised to splimp().
19521259Swollman */
19672200Sbmilekic#define IF_LOCK(ifq)		mtx_lock(&(ifq)->ifq_mtx)
19772200Sbmilekic#define IF_UNLOCK(ifq)		mtx_unlock(&(ifq)->ifq_mtx)
19869152Sjlemon#define	_IF_QFULL(ifq)		((ifq)->ifq_len >= (ifq)->ifq_maxlen)
19969152Sjlemon#define	_IF_DROP(ifq)		((ifq)->ifq_drops++)
20069152Sjlemon#define	_IF_QLEN(ifq)		((ifq)->ifq_len)
20121259Swollman
20269152Sjlemon#define	_IF_ENQUEUE(ifq, m) do { 				\
20369152Sjlemon	(m)->m_nextpkt = NULL;					\
20469152Sjlemon	if ((ifq)->ifq_tail == NULL) 				\
20569152Sjlemon		(ifq)->ifq_head = m; 				\
20669152Sjlemon	else 							\
20769152Sjlemon		(ifq)->ifq_tail->m_nextpkt = m; 		\
20869152Sjlemon	(ifq)->ifq_tail = m; 					\
20969152Sjlemon	(ifq)->ifq_len++; 					\
21069152Sjlemon} while (0)
21169152Sjlemon
21269152Sjlemon#define IF_ENQUEUE(ifq, m) do {					\
21369152Sjlemon	IF_LOCK(ifq); 						\
21469152Sjlemon	_IF_ENQUEUE(ifq, m); 					\
21569152Sjlemon	IF_UNLOCK(ifq); 					\
21669152Sjlemon} while (0)
21769152Sjlemon
21869152Sjlemon#define	_IF_PREPEND(ifq, m) do {				\
21969152Sjlemon	(m)->m_nextpkt = (ifq)->ifq_head; 			\
22069152Sjlemon	if ((ifq)->ifq_tail == NULL) 				\
22169152Sjlemon		(ifq)->ifq_tail = (m); 				\
22269152Sjlemon	(ifq)->ifq_head = (m); 					\
22369152Sjlemon	(ifq)->ifq_len++; 					\
22469152Sjlemon} while (0)
22569152Sjlemon
22669152Sjlemon#define IF_PREPEND(ifq, m) do {		 			\
22769152Sjlemon	IF_LOCK(ifq); 						\
22869152Sjlemon	_IF_PREPEND(ifq, m); 					\
22969152Sjlemon	IF_UNLOCK(ifq); 					\
23069152Sjlemon} while (0)
23169152Sjlemon
23269152Sjlemon#define	_IF_DEQUEUE(ifq, m) do { 				\
23369152Sjlemon	(m) = (ifq)->ifq_head; 					\
23469152Sjlemon	if (m) { 						\
23569152Sjlemon		if (((ifq)->ifq_head = (m)->m_nextpkt) == 0) 	\
23669152Sjlemon			(ifq)->ifq_tail = NULL; 		\
23769152Sjlemon		(m)->m_nextpkt = NULL; 				\
23869152Sjlemon		(ifq)->ifq_len--; 				\
23969152Sjlemon	} 							\
24069152Sjlemon} while (0)
24169152Sjlemon
24269152Sjlemon#define IF_DEQUEUE(ifq, m) do { 				\
24369152Sjlemon	IF_LOCK(ifq); 						\
24469152Sjlemon	_IF_DEQUEUE(ifq, m); 					\
24569152Sjlemon	IF_UNLOCK(ifq); 					\
24669152Sjlemon} while (0)
24769152Sjlemon
24869152Sjlemon#define IF_DRAIN(ifq) do { 					\
24969152Sjlemon	struct mbuf *m; 					\
25069152Sjlemon	IF_LOCK(ifq); 						\
25169152Sjlemon	for (;;) { 						\
25269152Sjlemon		_IF_DEQUEUE(ifq, m); 				\
25369152Sjlemon		if (m == NULL) 					\
25469152Sjlemon			break; 					\
25569152Sjlemon		m_freem(m); 					\
25669152Sjlemon	} 							\
25769152Sjlemon	IF_UNLOCK(ifq); 					\
25869152Sjlemon} while (0)
25969152Sjlemon
26055205Speter#ifdef _KERNEL
26169152Sjlemon#define	IF_HANDOFF(ifq, m, ifp)			if_handoff(ifq, m, ifp, 0)
26269152Sjlemon#define	IF_HANDOFF_ADJ(ifq, m, ifp, adj)	if_handoff(ifq, m, ifp, adj)
26321259Swollman
26435210Sbdestatic __inline int
26569152Sjlemonif_handoff(struct ifqueue *ifq, struct mbuf *m, struct ifnet *ifp, int adjust)
26621259Swollman{
26769152Sjlemon	int active = 0;
26821259Swollman
26969152Sjlemon	IF_LOCK(ifq);
27069152Sjlemon	if (_IF_QFULL(ifq)) {
27169152Sjlemon		_IF_DROP(ifq);
27269152Sjlemon		IF_UNLOCK(ifq);
27369152Sjlemon		m_freem(m);
27469152Sjlemon		return (0);
27569152Sjlemon	}
27669152Sjlemon	if (ifp != NULL) {
27769152Sjlemon		ifp->if_obytes += m->m_pkthdr.len + adjust;
27869152Sjlemon		if (m->m_flags & M_MCAST)
27969152Sjlemon			ifp->if_omcasts++;
28069152Sjlemon		active = ifp->if_flags & IFF_OACTIVE;
28169152Sjlemon	}
28269152Sjlemon	_IF_ENQUEUE(ifq, m);
28369152Sjlemon	IF_UNLOCK(ifq);
28469152Sjlemon	if (ifp != NULL && !active) {
28569152Sjlemon		if (ifp->if_mpsafe) {
28669152Sjlemon			DROP_GIANT_NOSWITCH();
28769152Sjlemon			(*ifp->if_start)(ifp);
28869152Sjlemon			PICKUP_GIANT();
28969152Sjlemon		} else {
29069152Sjlemon			(*ifp->if_start)(ifp);
29169152Sjlemon		}
29269152Sjlemon	}
29369152Sjlemon	return (1);
29421259Swollman}
29521259Swollman
29649459Sbrian/*
29749459Sbrian * 72 was chosen below because it is the size of a TCP/IP
29849459Sbrian * header (40) + the minimum mss (32).
29949459Sbrian */
30049459Sbrian#define	IF_MINMTU	72
30149459Sbrian#define	IF_MAXMTU	65535
30249459Sbrian
30355205Speter#endif /* _KERNEL */
30421259Swollman
30521259Swollman/*
30621259Swollman * The ifaddr structure contains information about one address
30721259Swollman * of an interface.  They are maintained by the different address families,
30821259Swollman * are allocated and attached when an address is set, and are linked
30921259Swollman * together so all addresses for an interface can be located.
31021259Swollman */
31121259Swollmanstruct ifaddr {
31221259Swollman	struct	sockaddr *ifa_addr;	/* address of interface */
31321259Swollman	struct	sockaddr *ifa_dstaddr;	/* other end of p-to-p link */
31421259Swollman#define	ifa_broadaddr	ifa_dstaddr	/* broadcast address interface */
31521259Swollman	struct	sockaddr *ifa_netmask;	/* used to determine subnet */
31667334Sjoe	struct	if_data if_data;	/* not all members are meaningful */
31721259Swollman	struct	ifnet *ifa_ifp;		/* back-pointer to interface */
31860938Sjake	TAILQ_ENTRY(ifaddr) ifa_link;	/* queue macro glue */
31921259Swollman	void	(*ifa_rtrequest)	/* check or clean routes (+ or -)'d */
32021259Swollman		__P((int, struct rtentry *, struct sockaddr *));
32121259Swollman	u_short	ifa_flags;		/* mostly rt_flags for cloning */
32247254Spb	u_int	ifa_refcnt;		/* references to this structure */
32321259Swollman	int	ifa_metric;		/* cost of going out this interface */
32421259Swollman#ifdef notdef
32521259Swollman	struct	rtentry *ifa_rt;	/* XXXX for ROUTETOIF ????? */
32621259Swollman#endif
32728845Sjulian	int (*ifa_claim_addr)		/* check if an addr goes to this if */
32828845Sjulian		__P((struct ifaddr *, struct sockaddr *));
32928845Sjulian
33021259Swollman};
33121259Swollman#define	IFA_ROUTE	RTF_UP		/* route installed */
33221259Swollman
33353541Sshin/* for compatibility with other BSDs */
33453541Sshin#define	ifa_list	ifa_link
33553541Sshin
33621404Swollman/*
33752904Sshin * The prefix structure contains information about one prefix
33852904Sshin * of an interface.  They are maintained by the different address families,
33952904Sshin * are allocated and attached when an prefix or an address is set,
34053541Sshin * and are linked together so all prefixes for an interface can be located.
34152904Sshin */
34252904Sshinstruct ifprefix {
34352904Sshin	struct	sockaddr *ifpr_prefix;	/* prefix of interface */
34452904Sshin	struct	ifnet *ifpr_ifp;	/* back-pointer to interface */
34560938Sjake	TAILQ_ENTRY(ifprefix) ifpr_list; /* queue macro glue */
34652904Sshin	u_char	ifpr_plen;		/* prefix length in bits */
34752904Sshin	u_char	ifpr_type;		/* protocol dependent prefix type */
34852904Sshin};
34952904Sshin
35052904Sshin/*
35121404Swollman * Multicast address structure.  This is analogous to the ifaddr
35221404Swollman * structure except that it keeps track of multicast addresses.
35321404Swollman * Also, the reference count here is a count of requests for this
35421404Swollman * address, not a count of pointers to this structure.
35521404Swollman */
35621404Swollmanstruct ifmultiaddr {
35772084Sphk	TAILQ_ENTRY(ifmultiaddr) ifma_link; /* queue macro glue */
35821434Swollman	struct	sockaddr *ifma_addr; 	/* address this membership is for */
35921434Swollman	struct	sockaddr *ifma_lladdr;	/* link-layer translation, if any */
36021434Swollman	struct	ifnet *ifma_ifp;	/* back-pointer to interface */
36121434Swollman	u_int	ifma_refcount;		/* reference count */
36221434Swollman	void	*ifma_protospec;	/* protocol-specific state, if any */
36321404Swollman};
36421404Swollman
36555205Speter#ifdef _KERNEL
36621259Swollman#define	IFAFREE(ifa) \
36746568Speter	do { \
36846568Speter		if ((ifa)->ifa_refcnt <= 0) \
36946568Speter			ifafree(ifa); \
37046568Speter		else \
37146568Speter			(ifa)->ifa_refcnt--; \
37246568Speter	} while (0)
37321259Swollman
37421259Swollmanextern	struct ifnethead ifnet;
37552904Sshinextern struct	ifnet	**ifindex2ifnet;
37621259Swollmanextern	int ifqmaxlen;
37771791Speterextern	struct ifnet *loif;	/* first loopback interface */
37821259Swollmanextern	int if_index;
37921259Swollmanextern	struct ifaddr **ifnet_addrs;
38021259Swollman
38163090Sarchievoid	ether_ifattach __P((struct ifnet *, int));
38263090Sarchievoid	ether_ifdetach __P((struct ifnet *, int));
38321259Swollmanvoid	ether_input __P((struct ifnet *, struct ether_header *, struct mbuf *));
38462143Sarchievoid	ether_demux __P((struct ifnet *, struct ether_header *, struct mbuf *));
38521259Swollmanint	ether_output __P((struct ifnet *,
38621259Swollman	   struct mbuf *, struct sockaddr *, struct rtentry *));
38762143Sarchieint	ether_output_frame __P((struct ifnet *, struct mbuf *));
38821259Swollmanint	ether_ioctl __P((struct ifnet *, int, caddr_t));
38921259Swollman
39053541Sshinint	if_addmulti __P((struct ifnet *, struct sockaddr *,
39121434Swollman			 struct ifmultiaddr **));
39221404Swollmanint	if_allmulti __P((struct ifnet *, int));
39321259Swollmanvoid	if_attach __P((struct ifnet *));
39421404Swollmanint	if_delmulti __P((struct ifnet *, struct sockaddr *));
39545720Spetervoid	if_detach __P((struct ifnet *));
39621259Swollmanvoid	if_down __P((struct ifnet *));
39741879Sphkvoid	if_route __P((struct ifnet *, int flag, int fam));
39864651Sarchieint	if_setlladdr __P((struct ifnet *, const u_char *, int));
39941879Sphkvoid	if_unroute __P((struct ifnet *, int flag, int fam));
40021259Swollmanvoid	if_up __P((struct ifnet *));
40121259Swollman/*void	ifinit __P((void));*/ /* declared in systm.h for main() */
40236735Sdfrint	ifioctl __P((struct socket *, u_long, caddr_t, struct proc *));
40321259Swollmanint	ifpromisc __P((struct ifnet *, int));
40479103Sbrooksstruct	ifnet *ifunit __P((const char *));
40552904Sshinstruct	ifnet *if_withname __P((struct sockaddr *));
40621259Swollman
40721259Swollmanint	if_poll_recv_slow __P((struct ifnet *ifp, int *quotap));
40821259Swollmanvoid	if_poll_xmit_slow __P((struct ifnet *ifp, int *quotap));
40921259Swollmanvoid	if_poll_throttle __P((void));
41021259Swollmanvoid	if_poll_unthrottle __P((void *));
41121259Swollmanvoid	if_poll_init __P((void));
41221259Swollmanvoid	if_poll __P((void));
41321259Swollman
41421259Swollmanstruct	ifaddr *ifa_ifwithaddr __P((struct sockaddr *));
41521259Swollmanstruct	ifaddr *ifa_ifwithdstaddr __P((struct sockaddr *));
41621259Swollmanstruct	ifaddr *ifa_ifwithnet __P((struct sockaddr *));
41721259Swollmanstruct	ifaddr *ifa_ifwithroute __P((int, struct sockaddr *,
41821259Swollman					struct sockaddr *));
41921259Swollmanstruct	ifaddr *ifaof_ifpforaddr __P((struct sockaddr *, struct ifnet *));
42021259Swollmanvoid	ifafree __P((struct ifaddr *));
42121259Swollman
42253541Sshinstruct	ifmultiaddr *ifmaof_ifpforaddr __P((struct sockaddr *,
42321434Swollman					    struct ifnet *));
42460889Sarchieint	if_simloop __P((struct ifnet *ifp, struct mbuf *m, int af, int hlen));
42521434Swollman
42679103Sbrooksvoid	if_clone_attach __P((struct if_clone *));
42779103Sbrooksvoid	if_clone_detach __P((struct if_clone *));
42879103Sbrooks
42979103Sbrooksint	if_clone_create __P((char *, int));
43079103Sbrooksint	if_clone_destroy __P((const char *));
43179103Sbrooks
43255205Speter#endif /* _KERNEL */
43321259Swollman
43421259Swollman#endif /* !_NET_IF_VAR_H_ */
435