if_var.h revision 84380
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 84380 2001-10-02 18:08:34Z mjacob $
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;
7083366Sjulianstruct	thread;
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 */
8483130Sjlemon#include <sys/event.h>		/* XXX */
8569152Sjlemon
8660938SjakeTAILQ_HEAD(ifnethead, ifnet);	/* we use TAILQs so that the order of */
8760938SjakeTAILQ_HEAD(ifaddrhead, ifaddr);	/* instantiation is preserved in the list */
8860938SjakeTAILQ_HEAD(ifprefixhead, ifprefix);
8972084SphkTAILQ_HEAD(ifmultihead, ifmultiaddr);
9021259Swollman
9121259Swollman/*
9221259Swollman * Structure defining a queue for a network interface.
9321259Swollman */
9421259Swollmanstruct	ifqueue {
9521259Swollman	struct	mbuf *ifq_head;
9621259Swollman	struct	mbuf *ifq_tail;
9721259Swollman	int	ifq_len;
9821259Swollman	int	ifq_maxlen;
9921259Swollman	int	ifq_drops;
10069152Sjlemon	struct	mtx ifq_mtx;
10121259Swollman};
10221259Swollman
10321259Swollman/*
10421259Swollman * Structure defining a network interface.
10521259Swollman *
10621259Swollman * (Would like to call this struct ``if'', but C isn't PL/1.)
10721259Swollman */
10884380Smjacob
10984380Smjacob/*
11084380Smjacob * NB: For FreeBSD, it is assumed that each NIC driver's softc starts with
11184380Smjacob * one of these structures, typically held within an arpcom structure.
11284380Smjacob */
11321259Swollmanstruct ifnet {
11421259Swollman	void	*if_softc;		/* pointer to driver state */
11521259Swollman	char	*if_name;		/* name, e.g. ``en'' or ``lo'' */
11660938Sjake	TAILQ_ENTRY(ifnet) if_link; 	/* all struct ifnets are chained */
11721259Swollman	struct	ifaddrhead if_addrhead;	/* linked list of addresses per if */
11883130Sjlemon	struct	klist if_klist;		/* events attached to this if */
11983130Sjlemon	int	if_pcount;		/* number of promiscuous listeners */
12021259Swollman	struct	bpf_if *if_bpf;		/* packet filter structure */
12121259Swollman	u_short	if_index;		/* numeric abbreviation for this if  */
12221259Swollman	short	if_unit;		/* sub-unit for lower level driver */
12321259Swollman	short	if_timer;		/* time 'til if_watchdog called */
12421259Swollman	short	if_flags;		/* up/down, broadcast, etc. */
12583624Sjlemon	int	if_capabilities;	/* interface capabilities */
12683624Sjlemon	int	if_capenable;		/* enabled features */
12769152Sjlemon	int	if_mpsafe;		/* XXX TEMPORARY */
12821259Swollman	int	if_ipending;		/* interrupts pending */
12921259Swollman	void	*if_linkmib;		/* link-type-specific MIB data */
13021259Swollman	size_t	if_linkmiblen;		/* length of above data */
13121259Swollman	struct	if_data if_data;
13221404Swollman	struct	ifmultihead if_multiaddrs; /* multicast addresses configured */
13321404Swollman	int	if_amcount;		/* number of all-multicast requests */
13421259Swollman/* procedure handles */
13521259Swollman	int	(*if_output)		/* output routine (enqueue) */
13621259Swollman		__P((struct ifnet *, struct mbuf *, struct sockaddr *,
13721259Swollman		     struct rtentry *));
13821259Swollman	void	(*if_start)		/* initiate output routine */
13921259Swollman		__P((struct ifnet *));
14021259Swollman	int	(*if_done)		/* output complete routine */
14121259Swollman		__P((struct ifnet *));	/* (XXX not used; fake prototype) */
14221259Swollman	int	(*if_ioctl)		/* ioctl routine */
14336735Sdfr		__P((struct ifnet *, u_long, caddr_t));
14421259Swollman	void	(*if_watchdog)		/* timer routine */
14521259Swollman		__P((struct ifnet *));
14621259Swollman	int	(*if_poll_recv)		/* polled receive routine */
14721259Swollman		__P((struct ifnet *, int *));
14821259Swollman	int	(*if_poll_xmit)		/* polled transmit routine */
14921259Swollman		__P((struct ifnet *, int *));
15021259Swollman	void	(*if_poll_intren)	/* polled interrupt reenable routine */
15121259Swollman		__P((struct ifnet *));
15221259Swollman	void	(*if_poll_slowinput)	/* input routine for slow devices */
15321259Swollman		__P((struct ifnet *, struct mbuf *));
15421259Swollman	void	(*if_init)		/* Init routine */
15521259Swollman		__P((void *));
15621404Swollman	int	(*if_resolvemulti)	/* validate/resolve multicast */
15721404Swollman		__P((struct ifnet *, struct sockaddr **, struct sockaddr *));
15821259Swollman	struct	ifqueue if_snd;		/* output queue */
15921259Swollman	struct	ifqueue *if_poll_slowq;	/* input queue for slow devices */
16052904Sshin	struct	ifprefixhead if_prefixhead; /* list of prefixes per if */
16121259Swollman};
16269152Sjlemon
16321259Swollmantypedef void if_init_f_t __P((void *));
16421259Swollman
16521259Swollman#define	if_mtu		if_data.ifi_mtu
16621259Swollman#define	if_type		if_data.ifi_type
16721259Swollman#define if_physical	if_data.ifi_physical
16821259Swollman#define	if_addrlen	if_data.ifi_addrlen
16921259Swollman#define	if_hdrlen	if_data.ifi_hdrlen
17021259Swollman#define	if_metric	if_data.ifi_metric
17121259Swollman#define	if_baudrate	if_data.ifi_baudrate
17258698Sjlemon#define	if_hwassist	if_data.ifi_hwassist
17321259Swollman#define	if_ipackets	if_data.ifi_ipackets
17421259Swollman#define	if_ierrors	if_data.ifi_ierrors
17521259Swollman#define	if_opackets	if_data.ifi_opackets
17621259Swollman#define	if_oerrors	if_data.ifi_oerrors
17721259Swollman#define	if_collisions	if_data.ifi_collisions
17821259Swollman#define	if_ibytes	if_data.ifi_ibytes
17921259Swollman#define	if_obytes	if_data.ifi_obytes
18021259Swollman#define	if_imcasts	if_data.ifi_imcasts
18121259Swollman#define	if_omcasts	if_data.ifi_omcasts
18221259Swollman#define	if_iqdrops	if_data.ifi_iqdrops
18321259Swollman#define	if_noproto	if_data.ifi_noproto
18421259Swollman#define	if_lastchange	if_data.ifi_lastchange
18521259Swollman#define if_recvquota	if_data.ifi_recvquota
18621259Swollman#define	if_xmitquota	if_data.ifi_xmitquota
18721259Swollman#define if_rawoutput(if, m, sa) if_output(if, m, sa, (struct rtentry *)0)
18821259Swollman
18953541Sshin/* for compatibility with other BSDs */
19053541Sshin#define	if_addrlist	if_addrhead
19153541Sshin#define	if_list		if_link
19253541Sshin
19321259Swollman/*
19421259Swollman * Bit values in if_ipending
19521259Swollman */
19621259Swollman#define	IFI_RECV	1	/* I want to receive */
19721259Swollman#define	IFI_XMIT	2	/* I want to transmit */
19821259Swollman
19921259Swollman/*
20021259Swollman * Output queues (ifp->if_snd) and slow device input queues (*ifp->if_slowq)
20121259Swollman * are queues of messages stored on ifqueue structures
20221259Swollman * (defined above).  Entries are added to and deleted from these structures
20321259Swollman * by these macros, which should be called with ipl raised to splimp().
20421259Swollman */
20572200Sbmilekic#define IF_LOCK(ifq)		mtx_lock(&(ifq)->ifq_mtx)
20672200Sbmilekic#define IF_UNLOCK(ifq)		mtx_unlock(&(ifq)->ifq_mtx)
20769152Sjlemon#define	_IF_QFULL(ifq)		((ifq)->ifq_len >= (ifq)->ifq_maxlen)
20869152Sjlemon#define	_IF_DROP(ifq)		((ifq)->ifq_drops++)
20969152Sjlemon#define	_IF_QLEN(ifq)		((ifq)->ifq_len)
21021259Swollman
21169152Sjlemon#define	_IF_ENQUEUE(ifq, m) do { 				\
21269152Sjlemon	(m)->m_nextpkt = NULL;					\
21369152Sjlemon	if ((ifq)->ifq_tail == NULL) 				\
21469152Sjlemon		(ifq)->ifq_head = m; 				\
21569152Sjlemon	else 							\
21669152Sjlemon		(ifq)->ifq_tail->m_nextpkt = m; 		\
21769152Sjlemon	(ifq)->ifq_tail = m; 					\
21869152Sjlemon	(ifq)->ifq_len++; 					\
21969152Sjlemon} while (0)
22069152Sjlemon
22169152Sjlemon#define IF_ENQUEUE(ifq, m) do {					\
22269152Sjlemon	IF_LOCK(ifq); 						\
22369152Sjlemon	_IF_ENQUEUE(ifq, m); 					\
22469152Sjlemon	IF_UNLOCK(ifq); 					\
22569152Sjlemon} while (0)
22669152Sjlemon
22769152Sjlemon#define	_IF_PREPEND(ifq, m) do {				\
22869152Sjlemon	(m)->m_nextpkt = (ifq)->ifq_head; 			\
22969152Sjlemon	if ((ifq)->ifq_tail == NULL) 				\
23069152Sjlemon		(ifq)->ifq_tail = (m); 				\
23169152Sjlemon	(ifq)->ifq_head = (m); 					\
23269152Sjlemon	(ifq)->ifq_len++; 					\
23369152Sjlemon} while (0)
23469152Sjlemon
23569152Sjlemon#define IF_PREPEND(ifq, m) do {		 			\
23669152Sjlemon	IF_LOCK(ifq); 						\
23769152Sjlemon	_IF_PREPEND(ifq, m); 					\
23869152Sjlemon	IF_UNLOCK(ifq); 					\
23969152Sjlemon} while (0)
24069152Sjlemon
24169152Sjlemon#define	_IF_DEQUEUE(ifq, m) do { 				\
24269152Sjlemon	(m) = (ifq)->ifq_head; 					\
24369152Sjlemon	if (m) { 						\
24469152Sjlemon		if (((ifq)->ifq_head = (m)->m_nextpkt) == 0) 	\
24569152Sjlemon			(ifq)->ifq_tail = NULL; 		\
24669152Sjlemon		(m)->m_nextpkt = NULL; 				\
24769152Sjlemon		(ifq)->ifq_len--; 				\
24869152Sjlemon	} 							\
24969152Sjlemon} while (0)
25069152Sjlemon
25169152Sjlemon#define IF_DEQUEUE(ifq, m) do { 				\
25269152Sjlemon	IF_LOCK(ifq); 						\
25369152Sjlemon	_IF_DEQUEUE(ifq, m); 					\
25469152Sjlemon	IF_UNLOCK(ifq); 					\
25569152Sjlemon} while (0)
25669152Sjlemon
25769152Sjlemon#define IF_DRAIN(ifq) do { 					\
25869152Sjlemon	struct mbuf *m; 					\
25969152Sjlemon	IF_LOCK(ifq); 						\
26069152Sjlemon	for (;;) { 						\
26169152Sjlemon		_IF_DEQUEUE(ifq, m); 				\
26269152Sjlemon		if (m == NULL) 					\
26369152Sjlemon			break; 					\
26469152Sjlemon		m_freem(m); 					\
26569152Sjlemon	} 							\
26669152Sjlemon	IF_UNLOCK(ifq); 					\
26769152Sjlemon} while (0)
26869152Sjlemon
26955205Speter#ifdef _KERNEL
27069152Sjlemon#define	IF_HANDOFF(ifq, m, ifp)			if_handoff(ifq, m, ifp, 0)
27169152Sjlemon#define	IF_HANDOFF_ADJ(ifq, m, ifp, adj)	if_handoff(ifq, m, ifp, adj)
27221259Swollman
27335210Sbdestatic __inline int
27469152Sjlemonif_handoff(struct ifqueue *ifq, struct mbuf *m, struct ifnet *ifp, int adjust)
27521259Swollman{
27669152Sjlemon	int active = 0;
27721259Swollman
27869152Sjlemon	IF_LOCK(ifq);
27969152Sjlemon	if (_IF_QFULL(ifq)) {
28069152Sjlemon		_IF_DROP(ifq);
28169152Sjlemon		IF_UNLOCK(ifq);
28269152Sjlemon		m_freem(m);
28369152Sjlemon		return (0);
28469152Sjlemon	}
28569152Sjlemon	if (ifp != NULL) {
28669152Sjlemon		ifp->if_obytes += m->m_pkthdr.len + adjust;
28769152Sjlemon		if (m->m_flags & M_MCAST)
28869152Sjlemon			ifp->if_omcasts++;
28969152Sjlemon		active = ifp->if_flags & IFF_OACTIVE;
29069152Sjlemon	}
29169152Sjlemon	_IF_ENQUEUE(ifq, m);
29269152Sjlemon	IF_UNLOCK(ifq);
29369152Sjlemon	if (ifp != NULL && !active) {
29469152Sjlemon		if (ifp->if_mpsafe) {
29569152Sjlemon			DROP_GIANT_NOSWITCH();
29669152Sjlemon			(*ifp->if_start)(ifp);
29769152Sjlemon			PICKUP_GIANT();
29869152Sjlemon		} else {
29969152Sjlemon			(*ifp->if_start)(ifp);
30069152Sjlemon		}
30169152Sjlemon	}
30269152Sjlemon	return (1);
30321259Swollman}
30421259Swollman
30549459Sbrian/*
30649459Sbrian * 72 was chosen below because it is the size of a TCP/IP
30749459Sbrian * header (40) + the minimum mss (32).
30849459Sbrian */
30949459Sbrian#define	IF_MINMTU	72
31049459Sbrian#define	IF_MAXMTU	65535
31149459Sbrian
31255205Speter#endif /* _KERNEL */
31321259Swollman
31421259Swollman/*
31521259Swollman * The ifaddr structure contains information about one address
31621259Swollman * of an interface.  They are maintained by the different address families,
31721259Swollman * are allocated and attached when an address is set, and are linked
31821259Swollman * together so all addresses for an interface can be located.
31921259Swollman */
32021259Swollmanstruct ifaddr {
32121259Swollman	struct	sockaddr *ifa_addr;	/* address of interface */
32221259Swollman	struct	sockaddr *ifa_dstaddr;	/* other end of p-to-p link */
32321259Swollman#define	ifa_broadaddr	ifa_dstaddr	/* broadcast address interface */
32421259Swollman	struct	sockaddr *ifa_netmask;	/* used to determine subnet */
32567334Sjoe	struct	if_data if_data;	/* not all members are meaningful */
32621259Swollman	struct	ifnet *ifa_ifp;		/* back-pointer to interface */
32760938Sjake	TAILQ_ENTRY(ifaddr) ifa_link;	/* queue macro glue */
32821259Swollman	void	(*ifa_rtrequest)	/* check or clean routes (+ or -)'d */
32921259Swollman		__P((int, struct rtentry *, struct sockaddr *));
33021259Swollman	u_short	ifa_flags;		/* mostly rt_flags for cloning */
33147254Spb	u_int	ifa_refcnt;		/* references to this structure */
33221259Swollman	int	ifa_metric;		/* cost of going out this interface */
33321259Swollman#ifdef notdef
33421259Swollman	struct	rtentry *ifa_rt;	/* XXXX for ROUTETOIF ????? */
33521259Swollman#endif
33628845Sjulian	int (*ifa_claim_addr)		/* check if an addr goes to this if */
33728845Sjulian		__P((struct ifaddr *, struct sockaddr *));
33828845Sjulian
33921259Swollman};
34021259Swollman#define	IFA_ROUTE	RTF_UP		/* route installed */
34121259Swollman
34253541Sshin/* for compatibility with other BSDs */
34353541Sshin#define	ifa_list	ifa_link
34453541Sshin
34521404Swollman/*
34652904Sshin * The prefix structure contains information about one prefix
34752904Sshin * of an interface.  They are maintained by the different address families,
34852904Sshin * are allocated and attached when an prefix or an address is set,
34953541Sshin * and are linked together so all prefixes for an interface can be located.
35052904Sshin */
35152904Sshinstruct ifprefix {
35252904Sshin	struct	sockaddr *ifpr_prefix;	/* prefix of interface */
35352904Sshin	struct	ifnet *ifpr_ifp;	/* back-pointer to interface */
35460938Sjake	TAILQ_ENTRY(ifprefix) ifpr_list; /* queue macro glue */
35552904Sshin	u_char	ifpr_plen;		/* prefix length in bits */
35652904Sshin	u_char	ifpr_type;		/* protocol dependent prefix type */
35752904Sshin};
35852904Sshin
35952904Sshin/*
36021404Swollman * Multicast address structure.  This is analogous to the ifaddr
36121404Swollman * structure except that it keeps track of multicast addresses.
36221404Swollman * Also, the reference count here is a count of requests for this
36321404Swollman * address, not a count of pointers to this structure.
36421404Swollman */
36521404Swollmanstruct ifmultiaddr {
36672084Sphk	TAILQ_ENTRY(ifmultiaddr) ifma_link; /* queue macro glue */
36721434Swollman	struct	sockaddr *ifma_addr; 	/* address this membership is for */
36821434Swollman	struct	sockaddr *ifma_lladdr;	/* link-layer translation, if any */
36921434Swollman	struct	ifnet *ifma_ifp;	/* back-pointer to interface */
37021434Swollman	u_int	ifma_refcount;		/* reference count */
37121434Swollman	void	*ifma_protospec;	/* protocol-specific state, if any */
37221404Swollman};
37321404Swollman
37455205Speter#ifdef _KERNEL
37521259Swollman#define	IFAFREE(ifa) \
37646568Speter	do { \
37746568Speter		if ((ifa)->ifa_refcnt <= 0) \
37846568Speter			ifafree(ifa); \
37946568Speter		else \
38046568Speter			(ifa)->ifa_refcnt--; \
38146568Speter	} while (0)
38221259Swollman
38383130Sjlemonstruct ifindex_entry {
38483130Sjlemon	struct 	ifnet *ife_ifnet;
38583130Sjlemon	struct	ifaddr *ife_ifnet_addr;
38683130Sjlemon	dev_t	ife_dev;
38783130Sjlemon};
38883130Sjlemon
38983130Sjlemon#define ifnet_byindex(idx)	ifindex_table[(idx)].ife_ifnet
39083130Sjlemon#define ifaddr_byindex(idx)	ifindex_table[(idx)].ife_ifnet_addr
39183130Sjlemon#define ifdev_byindex(idx)	ifindex_table[(idx)].ife_dev
39283130Sjlemon
39321259Swollmanextern	struct ifnethead ifnet;
39483130Sjlemonextern	struct ifindex_entry *ifindex_table;
39521259Swollmanextern	int ifqmaxlen;
39671791Speterextern	struct ifnet *loif;	/* first loopback interface */
39721259Swollmanextern	int if_index;
39821259Swollman
39963090Sarchievoid	ether_ifattach __P((struct ifnet *, int));
40063090Sarchievoid	ether_ifdetach __P((struct ifnet *, int));
40121259Swollmanvoid	ether_input __P((struct ifnet *, struct ether_header *, struct mbuf *));
40262143Sarchievoid	ether_demux __P((struct ifnet *, struct ether_header *, struct mbuf *));
40321259Swollmanint	ether_output __P((struct ifnet *,
40421259Swollman	   struct mbuf *, struct sockaddr *, struct rtentry *));
40562143Sarchieint	ether_output_frame __P((struct ifnet *, struct mbuf *));
40621259Swollmanint	ether_ioctl __P((struct ifnet *, int, caddr_t));
40721259Swollman
40853541Sshinint	if_addmulti __P((struct ifnet *, struct sockaddr *,
40921434Swollman			 struct ifmultiaddr **));
41021404Swollmanint	if_allmulti __P((struct ifnet *, int));
41121259Swollmanvoid	if_attach __P((struct ifnet *));
41221404Swollmanint	if_delmulti __P((struct ifnet *, struct sockaddr *));
41345720Spetervoid	if_detach __P((struct ifnet *));
41421259Swollmanvoid	if_down __P((struct ifnet *));
41541879Sphkvoid	if_route __P((struct ifnet *, int flag, int fam));
41664651Sarchieint	if_setlladdr __P((struct ifnet *, const u_char *, int));
41741879Sphkvoid	if_unroute __P((struct ifnet *, int flag, int fam));
41821259Swollmanvoid	if_up __P((struct ifnet *));
41921259Swollman/*void	ifinit __P((void));*/ /* declared in systm.h for main() */
42083366Sjulianint	ifioctl __P((struct socket *, u_long, caddr_t, struct thread *));
42121259Swollmanint	ifpromisc __P((struct ifnet *, int));
42279103Sbrooksstruct	ifnet *ifunit __P((const char *));
42352904Sshinstruct	ifnet *if_withname __P((struct sockaddr *));
42421259Swollman
42521259Swollmanint	if_poll_recv_slow __P((struct ifnet *ifp, int *quotap));
42621259Swollmanvoid	if_poll_xmit_slow __P((struct ifnet *ifp, int *quotap));
42721259Swollmanvoid	if_poll_throttle __P((void));
42821259Swollmanvoid	if_poll_unthrottle __P((void *));
42921259Swollmanvoid	if_poll_init __P((void));
43021259Swollmanvoid	if_poll __P((void));
43121259Swollman
43221259Swollmanstruct	ifaddr *ifa_ifwithaddr __P((struct sockaddr *));
43321259Swollmanstruct	ifaddr *ifa_ifwithdstaddr __P((struct sockaddr *));
43421259Swollmanstruct	ifaddr *ifa_ifwithnet __P((struct sockaddr *));
43521259Swollmanstruct	ifaddr *ifa_ifwithroute __P((int, struct sockaddr *,
43621259Swollman					struct sockaddr *));
43721259Swollmanstruct	ifaddr *ifaof_ifpforaddr __P((struct sockaddr *, struct ifnet *));
43821259Swollmanvoid	ifafree __P((struct ifaddr *));
43921259Swollman
44053541Sshinstruct	ifmultiaddr *ifmaof_ifpforaddr __P((struct sockaddr *,
44121434Swollman					    struct ifnet *));
44260889Sarchieint	if_simloop __P((struct ifnet *ifp, struct mbuf *m, int af, int hlen));
44321434Swollman
44479103Sbrooksvoid	if_clone_attach __P((struct if_clone *));
44579103Sbrooksvoid	if_clone_detach __P((struct if_clone *));
44679103Sbrooks
44779103Sbrooksint	if_clone_create __P((char *, int));
44879103Sbrooksint	if_clone_destroy __P((const char *));
44979103Sbrooks
45055205Speter#endif /* _KERNEL */
45121259Swollman
45221259Swollman#endif /* !_NET_IF_VAR_H_ */
453