if_var.h revision 84931
1184610Salfred/* 2184610Salfred * Copyright (c) 1982, 1986, 1989, 1993 3184610Salfred * The Regents of the University of California. All rights reserved. 4184610Salfred * 5184610Salfred * Redistribution and use in source and binary forms, with or without 6184610Salfred * modification, are permitted provided that the following conditions 7184610Salfred * are met: 8184610Salfred * 1. Redistributions of source code must retain the above copyright 9184610Salfred * notice, this list of conditions and the following disclaimer. 10184610Salfred * 2. Redistributions in binary form must reproduce the above copyright 11184610Salfred * notice, this list of conditions and the following disclaimer in the 12184610Salfred * documentation and/or other materials provided with the distribution. 13184610Salfred * 3. All advertising materials mentioning features or use of this software 14184610Salfred * must display the following acknowledgement: 15184610Salfred * This product includes software developed by the University of 16184610Salfred * California, Berkeley and its contributors. 17184610Salfred * 4. Neither the name of the University nor the names of its contributors 18184610Salfred * may be used to endorse or promote products derived from this software 19184610Salfred * without specific prior written permission. 20184610Salfred * 21184610Salfred * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22184610Salfred * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23184610Salfred * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24184610Salfred * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25184610Salfred * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26184610Salfred * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27188942Sthompsa * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28188942Sthompsa * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29188942Sthompsa * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30188942Sthompsa * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31184610Salfred * SUCH DAMAGE. 32184610Salfred * 33184610Salfred * From: @(#)if.h 8.1 (Berkeley) 6/10/93 34188942Sthompsa * $FreeBSD: head/sys/net/if_var.h 84931 2001-10-14 20:17:53Z fjoe $ 35188942Sthompsa */ 36188942Sthompsa 37188942Sthompsa#ifndef _NET_IF_VAR_H_ 38188942Sthompsa#define _NET_IF_VAR_H_ 39188942Sthompsa 40188942Sthompsa/* 41188942Sthompsa * Structures defining a network interface, providing a packet 42188942Sthompsa * transport mechanism (ala level 0 of the PUP protocols). 43188942Sthompsa * 44188942Sthompsa * Each interface accepts output datagrams of a specified maximum 45188942Sthompsa * length, and provides higher level routines with input datagrams 46184610Salfred * received from its medium. 47188942Sthompsa * 48188942Sthompsa * Output occurs when the routine if_output is called, with three parameters: 49184610Salfred * (*ifp->if_output)(ifp, m, dst, rt) 50190191Sthompsa * Here m is the mbuf chain to be sent and dst is the destination address. 51190191Sthompsa * The output routine encapsulates the supplied datagram if necessary, 52184610Salfred * and then transmits it on its medium. 53184610Salfred * 54184610Salfred * On input, each interface unwraps the data received by it, and either 55184610Salfred * places it on the input queue of a internetwork datagram routine 56184610Salfred * and posts the associated software interrupt, or passes the datagram to a raw 57184610Salfred * packet input routine. 58184610Salfred * 59184610Salfred * Routines exist for locating interfaces by their addresses 60193045Sthompsa * or for locating a interface on a certain network, as well as more general 61193045Sthompsa * routing and gateway routines maintaining information used to locate 62193045Sthompsa * interfaces. These routines live in the files if.c and route.c 63193045Sthompsa */ 64193045Sthompsa 65193045Sthompsa#ifdef __STDC__ 66193045Sthompsa/* 67184610Salfred * Forward structure declarations for function prototypes [sic]. 68193045Sthompsa */ 69193045Sthompsastruct mbuf; 70193045Sthompsastruct thread; 71193045Sthompsastruct rtentry; 72193045Sthompsastruct socket; 73193045Sthompsastruct ether_header; 74193045Sthompsa#endif 75184610Salfred 76192984Sthompsa#include <sys/queue.h> /* get TAILQ macros */ 77192984Sthompsa 78192984Sthompsa#ifdef _KERNEL 79192984Sthompsa#include <sys/mbuf.h> 80192984Sthompsa#include <sys/systm.h> /* XXX */ 81192984Sthompsa#endif /* _KERNEL */ 82192984Sthompsa#include <sys/lock.h> /* XXX */ 83192984Sthompsa#include <sys/mutex.h> /* XXX */ 84192984Sthompsa#include <sys/event.h> /* XXX */ 85194228Sthompsa 86192984SthompsaTAILQ_HEAD(ifnethead, ifnet); /* we use TAILQs so that the order of */ 87192984SthompsaTAILQ_HEAD(ifaddrhead, ifaddr); /* instantiation is preserved in the list */ 88192984SthompsaTAILQ_HEAD(ifprefixhead, ifprefix); 89192984SthompsaTAILQ_HEAD(ifmultihead, ifmultiaddr); 90192984Sthompsa 91184610Salfred/* 92184610Salfred * Structure defining a queue for a network interface. 93184610Salfred */ 94194228Sthompsastruct ifqueue { 95184610Salfred struct mbuf *ifq_head; 96184610Salfred struct mbuf *ifq_tail; 97184610Salfred int ifq_len; 98185087Salfred int ifq_maxlen; 99184610Salfred int ifq_drops; 100184610Salfred struct mtx ifq_mtx; 101184610Salfred}; 102184610Salfred 103184610Salfred/* 104184610Salfred * Structure defining a network interface. 105184610Salfred * 106184610Salfred * (Would like to call this struct ``if'', but C isn't PL/1.) 107184610Salfred */ 108192502Sthompsa 109192502Sthompsa/* 110184610Salfred * NB: For FreeBSD, it is assumed that each NIC driver's softc starts with 111184610Salfred * one of these structures, typically held within an arpcom structure. 112184610Salfred */ 113184610Salfredstruct ifnet { 114184610Salfred void *if_softc; /* pointer to driver state */ 115184610Salfred char *if_name; /* name, e.g. ``en'' or ``lo'' */ 116184610Salfred TAILQ_ENTRY(ifnet) if_link; /* all struct ifnets are chained */ 117192984Sthompsa struct ifaddrhead if_addrhead; /* linked list of addresses per if */ 118192984Sthompsa struct klist if_klist; /* events attached to this if */ 119184610Salfred int if_pcount; /* number of promiscuous listeners */ 120193644Sthompsa struct bpf_if *if_bpf; /* packet filter structure */ 121192984Sthompsa u_short if_index; /* numeric abbreviation for this if */ 122193644Sthompsa short if_unit; /* sub-unit for lower level driver */ 123184610Salfred short if_timer; /* time 'til if_watchdog called */ 124184610Salfred short if_flags; /* up/down, broadcast, etc. */ 125184610Salfred int if_capabilities; /* interface capabilities */ 126184610Salfred int if_capenable; /* enabled features */ 127184610Salfred int if_mpsafe; /* XXX TEMPORARY */ 128194228Sthompsa int if_ipending; /* interrupts pending */ 129184610Salfred void *if_linkmib; /* link-type-specific MIB data */ 130184610Salfred size_t if_linkmiblen; /* length of above data */ 131194228Sthompsa struct if_data if_data; 132184610Salfred struct ifmultihead if_multiaddrs; /* multicast addresses configured */ 133184610Salfred int if_amcount; /* number of all-multicast requests */ 134184610Salfred/* procedure handles */ 135184610Salfred int (*if_output) /* output routine (enqueue) */ 136194228Sthompsa __P((struct ifnet *, struct mbuf *, struct sockaddr *, 137184610Salfred struct rtentry *)); 138184610Salfred void (*if_start) /* initiate output routine */ 139194228Sthompsa __P((struct ifnet *)); 140184610Salfred int (*if_done) /* output complete routine */ 141184610Salfred __P((struct ifnet *)); /* (XXX not used; fake prototype) */ 142184610Salfred int (*if_ioctl) /* ioctl routine */ 143184610Salfred __P((struct ifnet *, u_long, caddr_t)); 144194228Sthompsa void (*if_watchdog) /* timer routine */ 145184610Salfred __P((struct ifnet *)); 146184610Salfred int (*if_poll_recv) /* polled receive routine */ 147184610Salfred __P((struct ifnet *, int *)); 148184610Salfred int (*if_poll_xmit) /* polled transmit routine */ 149184610Salfred __P((struct ifnet *, int *)); 150184610Salfred void (*if_poll_intren) /* polled interrupt reenable routine */ 151184610Salfred __P((struct ifnet *)); 152184610Salfred void (*if_poll_slowinput) /* input routine for slow devices */ 153192984Sthompsa __P((struct ifnet *, struct mbuf *)); 154184610Salfred void (*if_init) /* Init routine */ 155193644Sthompsa __P((void *)); 156193644Sthompsa int (*if_resolvemulti) /* validate/resolve multicast */ 157184610Salfred __P((struct ifnet *, struct sockaddr **, struct sockaddr *)); 158184610Salfred struct ifqueue if_snd; /* output queue */ 159184610Salfred struct ifqueue *if_poll_slowq; /* input queue for slow devices */ 160184610Salfred struct ifprefixhead if_prefixhead; /* list of prefixes per if */ 161184610Salfred u_int8_t *if_broadcastaddr; /* linklevel broadcast bytestring */ 162194228Sthompsa}; 163187180Sthompsa 164187180Sthompsatypedef void if_init_f_t __P((void *)); 165187180Sthompsa 166187180Sthompsa#define if_mtu if_data.ifi_mtu 167187180Sthompsa#define if_type if_data.ifi_type 168187180Sthompsa#define if_physical if_data.ifi_physical 169184610Salfred#define if_addrlen if_data.ifi_addrlen 170184610Salfred#define if_hdrlen if_data.ifi_hdrlen 171187180Sthompsa#define if_metric if_data.ifi_metric 172184610Salfred#define if_baudrate if_data.ifi_baudrate 173184610Salfred#define if_hwassist if_data.ifi_hwassist 174184610Salfred#define if_ipackets if_data.ifi_ipackets 175184610Salfred#define if_ierrors if_data.ifi_ierrors 176184610Salfred#define if_opackets if_data.ifi_opackets 177184610Salfred#define if_oerrors if_data.ifi_oerrors 178184610Salfred#define if_collisions if_data.ifi_collisions 179184610Salfred#define if_ibytes if_data.ifi_ibytes 180184610Salfred#define if_obytes if_data.ifi_obytes 181184610Salfred#define if_imcasts if_data.ifi_imcasts 182184610Salfred#define if_omcasts if_data.ifi_omcasts 183184610Salfred#define if_iqdrops if_data.ifi_iqdrops 184184610Salfred#define if_noproto if_data.ifi_noproto 185184610Salfred#define if_lastchange if_data.ifi_lastchange 186184610Salfred#define if_recvquota if_data.ifi_recvquota 187192984Sthompsa#define if_xmitquota if_data.ifi_xmitquota 188184610Salfred#define if_rawoutput(if, m, sa) if_output(if, m, sa, (struct rtentry *)0) 189184610Salfred 190184610Salfred/* for compatibility with other BSDs */ 191184610Salfred#define if_addrlist if_addrhead 192184610Salfred#define if_list if_link 193184610Salfred 194194228Sthompsa/* 195194228Sthompsa * Bit values in if_ipending 196184610Salfred */ 197184610Salfred#define IFI_RECV 1 /* I want to receive */ 198194228Sthompsa#define IFI_XMIT 2 /* I want to transmit */ 199194228Sthompsa 200184610Salfred/* 201184610Salfred * Output queues (ifp->if_snd) and slow device input queues (*ifp->if_slowq) 202184610Salfred * are queues of messages stored on ifqueue structures 203185290Salfred * (defined above). Entries are added to and deleted from these structures 204184610Salfred * by these macros, which should be called with ipl raised to splimp(). 205184610Salfred */ 206184610Salfred#define IF_LOCK(ifq) mtx_lock(&(ifq)->ifq_mtx) 207184610Salfred#define IF_UNLOCK(ifq) mtx_unlock(&(ifq)->ifq_mtx) 208192984Sthompsa#define _IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen) 209184610Salfred#define _IF_DROP(ifq) ((ifq)->ifq_drops++) 210192984Sthompsa#define _IF_QLEN(ifq) ((ifq)->ifq_len) 211193644Sthompsa 212193644Sthompsa#define _IF_ENQUEUE(ifq, m) do { \ 213184610Salfred (m)->m_nextpkt = NULL; \ 214184610Salfred if ((ifq)->ifq_tail == NULL) \ 215184610Salfred (ifq)->ifq_head = m; \ 216184610Salfred else \ 217184610Salfred (ifq)->ifq_tail->m_nextpkt = m; \ 218184610Salfred (ifq)->ifq_tail = m; \ 219184610Salfred (ifq)->ifq_len++; \ 220192984Sthompsa} while (0) 221184610Salfred 222192984Sthompsa#define IF_ENQUEUE(ifq, m) do { \ 223192984Sthompsa IF_LOCK(ifq); \ 224192984Sthompsa _IF_ENQUEUE(ifq, m); \ 225192984Sthompsa IF_UNLOCK(ifq); \ 226192984Sthompsa} while (0) 227192984Sthompsa 228192984Sthompsa#define _IF_PREPEND(ifq, m) do { \ 229192984Sthompsa (m)->m_nextpkt = (ifq)->ifq_head; \ 230184610Salfred if ((ifq)->ifq_tail == NULL) \ 231192984Sthompsa (ifq)->ifq_tail = (m); \ 232192984Sthompsa (ifq)->ifq_head = (m); \ 233192984Sthompsa (ifq)->ifq_len++; \ 234192984Sthompsa} while (0) 235192984Sthompsa 236192984Sthompsa#define IF_PREPEND(ifq, m) do { \ 237184610Salfred IF_LOCK(ifq); \ 238184610Salfred _IF_PREPEND(ifq, m); \ 239184610Salfred IF_UNLOCK(ifq); \ 240184610Salfred} while (0) 241184610Salfred 242192984Sthompsa#define _IF_DEQUEUE(ifq, m) do { \ 243184610Salfred (m) = (ifq)->ifq_head; \ 244192984Sthompsa if (m) { \ 245192984Sthompsa if (((ifq)->ifq_head = (m)->m_nextpkt) == 0) \ 246192984Sthompsa (ifq)->ifq_tail = NULL; \ 247192984Sthompsa (m)->m_nextpkt = NULL; \ 248192984Sthompsa (ifq)->ifq_len--; \ 249184610Salfred } \ 250184610Salfred} while (0) 251184610Salfred 252184610Salfred#define IF_DEQUEUE(ifq, m) do { \ 253184610Salfred IF_LOCK(ifq); \ 254184610Salfred _IF_DEQUEUE(ifq, m); \ 255184610Salfred IF_UNLOCK(ifq); \ 256192984Sthompsa} while (0) 257192984Sthompsa 258192984Sthompsa#define IF_DRAIN(ifq) do { \ 259192984Sthompsa struct mbuf *m; \ 260192984Sthompsa IF_LOCK(ifq); \ 261184610Salfred for (;;) { \ 262184610Salfred _IF_DEQUEUE(ifq, m); \ 263192984Sthompsa if (m == NULL) \ 264184610Salfred break; \ 265192984Sthompsa m_freem(m); \ 266184610Salfred } \ 267184610Salfred IF_UNLOCK(ifq); \ 268184610Salfred} while (0) 269184610Salfred 270184610Salfred#ifdef _KERNEL 271184610Salfred#define IF_HANDOFF(ifq, m, ifp) if_handoff(ifq, m, ifp, 0) 272184610Salfred#define IF_HANDOFF_ADJ(ifq, m, ifp, adj) if_handoff(ifq, m, ifp, adj) 273184610Salfred 274184610Salfredstatic __inline int 275184610Salfredif_handoff(struct ifqueue *ifq, struct mbuf *m, struct ifnet *ifp, int adjust) 276192984Sthompsa{ 277184610Salfred int active = 0; 278192984Sthompsa 279193644Sthompsa IF_LOCK(ifq); 280193644Sthompsa if (_IF_QFULL(ifq)) { 281184610Salfred _IF_DROP(ifq); 282184610Salfred IF_UNLOCK(ifq); 283184610Salfred m_freem(m); 284184610Salfred return (0); 285184610Salfred } 286184610Salfred if (ifp != NULL) { 287184610Salfred ifp->if_obytes += m->m_pkthdr.len + adjust; 288192984Sthompsa if (m->m_flags & M_MCAST) 289184610Salfred ifp->if_omcasts++; 290192984Sthompsa active = ifp->if_flags & IFF_OACTIVE; 291192984Sthompsa } 292192984Sthompsa _IF_ENQUEUE(ifq, m); 293192984Sthompsa IF_UNLOCK(ifq); 294192984Sthompsa if (ifp != NULL && !active) { 295192984Sthompsa if (ifp->if_mpsafe) { 296192984Sthompsa DROP_GIANT_NOSWITCH(); 297192984Sthompsa (*ifp->if_start)(ifp); 298184610Salfred PICKUP_GIANT(); 299192984Sthompsa } else { 300192984Sthompsa (*ifp->if_start)(ifp); 301192984Sthompsa } 302192984Sthompsa } 303192984Sthompsa return (1); 304192984Sthompsa} 305184610Salfred 306184610Salfred/* 307184610Salfred * 72 was chosen below because it is the size of a TCP/IP 308184610Salfred * header (40) + the minimum mss (32). 309184610Salfred */ 310192984Sthompsa#define IF_MINMTU 72 311184610Salfred#define IF_MAXMTU 65535 312192984Sthompsa 313192984Sthompsa#endif /* _KERNEL */ 314192984Sthompsa 315192984Sthompsa/* 316184610Salfred * The ifaddr structure contains information about one address 317192984Sthompsa * of an interface. They are maintained by the different address families, 318184610Salfred * are allocated and attached when an address is set, and are linked 319184610Salfred * together so all addresses for an interface can be located. 320184610Salfred */ 321184610Salfredstruct ifaddr { 322184610Salfred struct sockaddr *ifa_addr; /* address of interface */ 323184610Salfred struct sockaddr *ifa_dstaddr; /* other end of p-to-p link */ 324184610Salfred#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ 325192984Sthompsa struct sockaddr *ifa_netmask; /* used to determine subnet */ 326192984Sthompsa struct if_data if_data; /* not all members are meaningful */ 327192984Sthompsa struct ifnet *ifa_ifp; /* back-pointer to interface */ 328192984Sthompsa TAILQ_ENTRY(ifaddr) ifa_link; /* queue macro glue */ 329192984Sthompsa void (*ifa_rtrequest) /* check or clean routes (+ or -)'d */ 330184610Salfred __P((int, struct rtentry *, struct sockaddr *)); 331184610Salfred u_short ifa_flags; /* mostly rt_flags for cloning */ 332192984Sthompsa u_int ifa_refcnt; /* references to this structure */ 333184610Salfred int ifa_metric; /* cost of going out this interface */ 334192984Sthompsa#ifdef notdef 335184610Salfred struct rtentry *ifa_rt; /* XXXX for ROUTETOIF ????? */ 336184610Salfred#endif 337184610Salfred int (*ifa_claim_addr) /* check if an addr goes to this if */ 338184610Salfred __P((struct ifaddr *, struct sockaddr *)); 339184610Salfred 340184610Salfred}; 341184610Salfred#define IFA_ROUTE RTF_UP /* route installed */ 342184610Salfred 343184610Salfred/* for compatibility with other BSDs */ 344184610Salfred#define ifa_list ifa_link 345184610Salfred 346192984Sthompsa/* 347184610Salfred * The prefix structure contains information about one prefix 348184610Salfred * of an interface. They are maintained by the different address families, 349184610Salfred * are allocated and attached when an prefix or an address is set, 350184610Salfred * and are linked together so all prefixes for an interface can be located. 351194228Sthompsa */ 352184610Salfredstruct ifprefix { 353184610Salfred struct sockaddr *ifpr_prefix; /* prefix of interface */ 354194228Sthompsa struct ifnet *ifpr_ifp; /* back-pointer to interface */ 355194228Sthompsa TAILQ_ENTRY(ifprefix) ifpr_list; /* queue macro glue */ 356184610Salfred u_char ifpr_plen; /* prefix length in bits */ 357184610Salfred u_char ifpr_type; /* protocol dependent prefix type */ 358184610Salfred}; 359192984Sthompsa 360184610Salfred/* 361184610Salfred * Multicast address structure. This is analogous to the ifaddr 362184610Salfred * structure except that it keeps track of multicast addresses. 363184610Salfred * Also, the reference count here is a count of requests for this 364194228Sthompsa * address, not a count of pointers to this structure. 365184610Salfred */ 366184610Salfredstruct ifmultiaddr { 367194228Sthompsa TAILQ_ENTRY(ifmultiaddr) ifma_link; /* queue macro glue */ 368194228Sthompsa struct sockaddr *ifma_addr; /* address this membership is for */ 369184610Salfred struct sockaddr *ifma_lladdr; /* link-layer translation, if any */ 370184610Salfred struct ifnet *ifma_ifp; /* back-pointer to interface */ 371184610Salfred u_int ifma_refcount; /* reference count */ 372192984Sthompsa void *ifma_protospec; /* protocol-specific state, if any */ 373184610Salfred}; 374184610Salfred 375194228Sthompsa#ifdef _KERNEL 376194228Sthompsa#define IFAFREE(ifa) \ 377184610Salfred do { \ 378184610Salfred if ((ifa)->ifa_refcnt <= 0) \ 379184610Salfred ifafree(ifa); \ 380192984Sthompsa else \ 381184610Salfred (ifa)->ifa_refcnt--; \ 382192984Sthompsa } while (0) 383192984Sthompsa 384184610Salfredstruct ifindex_entry { 385184610Salfred struct ifnet *ife_ifnet; 386184610Salfred struct ifaddr *ife_ifnet_addr; 387184610Salfred dev_t ife_dev; 388184610Salfred}; 389184610Salfred 390184610Salfred#define ifnet_byindex(idx) ifindex_table[(idx)].ife_ifnet 391184610Salfred#define ifaddr_byindex(idx) ifindex_table[(idx)].ife_ifnet_addr 392184610Salfred#define ifdev_byindex(idx) ifindex_table[(idx)].ife_dev 393184610Salfred 394184610Salfredextern struct ifnethead ifnet; 395184610Salfredextern struct ifindex_entry *ifindex_table; 396184610Salfredextern int ifqmaxlen; 397184610Salfredextern struct ifnet *loif; /* first loopback interface */ 398184610Salfredextern int if_index; 399184610Salfred 400184610Salfredvoid ether_ifattach __P((struct ifnet *, int)); 401184610Salfredvoid ether_ifdetach __P((struct ifnet *, int)); 402184610Salfredvoid ether_input __P((struct ifnet *, struct ether_header *, struct mbuf *)); 403184610Salfredvoid ether_demux __P((struct ifnet *, struct ether_header *, struct mbuf *)); 404194228Sthompsaint ether_output __P((struct ifnet *, 405184610Salfred struct mbuf *, struct sockaddr *, struct rtentry *)); 406184610Salfredint ether_output_frame __P((struct ifnet *, struct mbuf *)); 407184610Salfredint ether_ioctl __P((struct ifnet *, int, caddr_t)); 408184610Salfred 409194228Sthompsaint if_addmulti __P((struct ifnet *, struct sockaddr *, 410184610Salfred struct ifmultiaddr **)); 411184610Salfredint if_allmulti __P((struct ifnet *, int)); 412184610Salfredvoid if_attach __P((struct ifnet *)); 413184610Salfredint if_delmulti __P((struct ifnet *, struct sockaddr *)); 414184610Salfredvoid if_detach __P((struct ifnet *)); 415194228Sthompsavoid if_down __P((struct ifnet *)); 416184610Salfredvoid if_route __P((struct ifnet *, int flag, int fam)); 417184610Salfredint if_setlladdr __P((struct ifnet *, const u_char *, int)); 418184610Salfredvoid if_unroute __P((struct ifnet *, int flag, int fam)); 419184610Salfredvoid if_up __P((struct ifnet *)); 420184610Salfred/*void ifinit __P((void));*/ /* declared in systm.h for main() */ 421190188Sthompsaint ifioctl __P((struct socket *, u_long, caddr_t, struct thread *)); 422194228Sthompsaint ifpromisc __P((struct ifnet *, int)); 423184610Salfredstruct ifnet *ifunit __P((const char *)); 424184610Salfredstruct ifnet *if_withname __P((struct sockaddr *)); 425194228Sthompsa 426184610Salfredint if_poll_recv_slow __P((struct ifnet *ifp, int *quotap)); 427184610Salfredvoid if_poll_xmit_slow __P((struct ifnet *ifp, int *quotap)); 428184610Salfredvoid if_poll_throttle __P((void)); 429184610Salfredvoid if_poll_unthrottle __P((void *)); 430184610Salfredvoid if_poll_init __P((void)); 431184610Salfredvoid if_poll __P((void)); 432192984Sthompsa 433184610Salfredstruct ifaddr *ifa_ifwithaddr __P((struct sockaddr *)); 434192984Sthompsastruct ifaddr *ifa_ifwithdstaddr __P((struct sockaddr *)); 435193045Sthompsastruct ifaddr *ifa_ifwithnet __P((struct sockaddr *)); 436184610Salfredstruct ifaddr *ifa_ifwithroute __P((int, struct sockaddr *, 437184610Salfred struct sockaddr *)); 438184610Salfredstruct ifaddr *ifaof_ifpforaddr __P((struct sockaddr *, struct ifnet *)); 439184610Salfredvoid ifafree __P((struct ifaddr *)); 440184610Salfred 441184610Salfredstruct ifmultiaddr *ifmaof_ifpforaddr __P((struct sockaddr *, 442184610Salfred struct ifnet *)); 443184610Salfredint if_simloop __P((struct ifnet *ifp, struct mbuf *m, int af, int hlen)); 444184610Salfred 445184610Salfredvoid if_clone_attach __P((struct if_clone *)); 446184610Salfredvoid if_clone_detach __P((struct if_clone *)); 447194228Sthompsa 448184610Salfredint if_clone_create __P((char *, int)); 449184610Salfredint if_clone_destroy __P((const char *)); 450184610Salfred 451184610Salfred#define IF_LLADDR(ifp) \ 452184610Salfred LLADDR((struct sockaddr_dl *) ifaddr_byindex((ifp)->if_index)->ifa_addr) 453194228Sthompsa 454184610Salfred#endif /* _KERNEL */ 455184610Salfred 456194228Sthompsa#endif /* !_NET_IF_VAR_H_ */ 457184610Salfred