]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - share/man/man9/ifnet.9
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / share / man / man9 / ifnet.9
1 .\" -*- Nroff -*-
2 .\" Copyright 1996, 1997 Massachusetts Institute of Technology
3 .\"
4 .\" Permission to use, copy, modify, and distribute this software and
5 .\" its documentation for any purpose and without fee is hereby
6 .\" granted, provided that both the above copyright notice and this
7 .\" permission notice appear in all copies, that both the above
8 .\" copyright notice and this permission notice appear in all
9 .\" supporting documentation, and that the name of M.I.T. not be used
10 .\" in advertising or publicity pertaining to distribution of the
11 .\" software without specific, written prior permission.  M.I.T. makes
12 .\" no representations about the suitability of this software for any
13 .\" purpose.  It is provided "as is" without express or implied
14 .\" warranty.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS
17 .\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
18 .\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
20 .\" SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 .\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 .\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 .\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 .\" SUCH DAMAGE.
28 .\"
29 .\" $FreeBSD$
30 .\"
31 .Dd July 3, 2011
32 .Dt IFNET 9
33 .Os
34 .Sh NAME
35 .Nm ifnet ,
36 .Nm ifaddr ,
37 .Nm ifqueue ,
38 .Nm if_data
39 .Nd kernel interfaces for manipulating network interfaces
40 .Sh SYNOPSIS
41 .In sys/param.h
42 .In sys/time.h
43 .In sys/socket.h
44 .In net/if.h
45 .In net/if_var.h
46 .In net/if_types.h
47 .\"
48 .Ss "Interface Manipulation Functions"
49 .Ft "struct ifnet *"
50 .Fn if_alloc "u_char type"
51 .Ft void
52 .Fn if_attach "struct ifnet *ifp"
53 .Ft void
54 .Fn if_detach "struct ifnet *ifp"
55 .Ft void
56 .Fn if_free "struct ifnet *ifp"
57 .Ft void
58 .Fn if_free_type "struct ifnet *ifp" "u_char type"
59 .Ft void
60 .Fn if_down "struct ifnet *ifp"
61 .Ft int
62 .Fn ifioctl "struct socket *so" "u_long cmd" "caddr_t data" "struct thread *td"
63 .Ft int
64 .Fn ifpromisc "struct ifnet *ifp" "int pswitch"
65 .Ft int
66 .Fn if_allmulti "struct ifnet *ifp" "int amswitch"
67 .Ft "struct ifnet *"
68 .Fn ifunit "const char *name"
69 .Ft void
70 .Fn if_up "struct ifnet *ifp"
71 .\"
72 .Ss "Interface Address Functions"
73 .Ft "struct ifaddr *"
74 .Fn ifa_ifwithaddr "struct sockaddr *addr"
75 .Ft "struct ifaddr *"
76 .Fn ifa_ifwithdstaddr "struct sockaddr *addr"
77 .Ft "struct ifaddr *"
78 .Fn ifa_ifwithnet "struct sockaddr *addr"
79 .Ft "struct ifaddr *"
80 .Fn ifaof_ifpforaddr "struct sockaddr *addr" "struct ifnet *ifp"
81 .Ft void
82 .Fn ifafree "struct ifaddr *ifa"
83 .Fn IFAFREE "struct ifaddr *ifa"
84 .\"
85 .Ss "Interface Multicast Address Functions"
86 .Ft int
87 .Fn if_addmulti "struct ifnet *ifp" "struct sockaddr *sa" "struct ifmultiaddr **ifmap"
88 .Ft int
89 .Fn if_delmulti "struct ifnet *ifp" "struct sockaddr *sa"
90 .Ft "struct ifmultiaddr *"
91 .Fn ifmaof_ifpforaddr "struct sockaddr *addr" "struct ifnet *ifp"
92 .Ss "Output queue macros"
93 .Fn IF_DEQUEUE "struct ifqueue *ifq" "struct mbuf *m"
94 .\"
95 .Ss "struct ifnet Member Functions"
96 .Ft void
97 .Fn \*(lp*if_input\*(rp "struct ifnet *ifp" "struct mbuf *m"
98 .Ft int
99 .Fo \*(lp*if_output\*(rp
100 .Fa "struct ifnet *ifp" "struct mbuf *m"
101 .Fa "struct sockaddr *dst" "struct rtentry *rt"
102 .Fc
103 .Ft void
104 .Fn \*(lp*if_start\*(rp "struct ifnet *ifp"
105 .Ft int
106 .Fn \*(lp*if_transmit\*(rp "struct ifnet *ifp" "struct mbuf *m"
107 .Ft void
108 .Fn \*(lp*if_qflush\*(rp "struct ifnet *ifp"
109 .Ft int
110 .Fn \*(lp*if_ioctl\*(rp "struct ifnet *ifp" "int cmd" "caddr_t data"
111 .Ft void
112 .Fn \*(lp*if_watchdog\*(rp "struct ifnet *ifp"
113 .Ft void
114 .Fn \*(lp*if_init\*(rp "void *if_softc"
115 .Ft int
116 .Fo \*(lp*if_resolvemulti\*(rp
117 .Fa "struct ifnet *ifp" "struct sockaddr **retsa" "struct sockaddr *addr"
118 .Fc
119 .Ss "struct ifaddr member function"
120 .Ft void
121 .Fo \*(lp*ifa_rtrequest\*(rp
122 .Fa "int cmd" "struct rtentry *rt" "struct sockaddr *dst"
123 .Fc
124 .\"
125 .Ss "Global Variables"
126 .Vt extern struct ifnethead ifnet ;
127 .Vt extern struct ifaddr **ifnet_addrs ;
128 .Vt extern int if_index ;
129 .Vt extern int ifqmaxlen ;
130 .Sh DATA STRUCTURES
131 The kernel mechanisms for handling network interfaces reside primarily
132 in the
133 .Vt ifnet , if_data , ifaddr ,
134 and
135 .Vt ifmultiaddr
136 structures in
137 .In net/if.h
138 and
139 .In net/if_var.h
140 and the functions named above and defined in
141 .Pa /sys/net/if.c .
142 Those interfaces which are intended to be used by user programs
143 are defined in
144 .In net/if.h ;
145 these include the interface flags, the
146 .Vt if_data
147 structure, and the structures defining the appearance of
148 interface-related messages on the
149 .Xr route 4
150 routing socket and in
151 .Xr sysctl 3 .
152 The header file
153 .In net/if_var.h
154 defines the kernel-internal interfaces, including the
155 .Vt ifnet , ifaddr ,
156 and
157 .Vt ifmultiaddr
158 structures and the functions which manipulate them.
159 (A few user programs will need
160 .In net/if_var.h
161 because it is the prerequisite of some other header file like
162 .In netinet/if_ether.h .
163 Most references to those two files in particular can be replaced by
164 .In net/ethernet.h . )
165 .Pp
166 The system keeps a linked list of interfaces using the
167 .Li TAILQ
168 macros defined in
169 .Xr queue 3 ;
170 this list is headed by a
171 .Vt "struct ifnethead"
172 called
173 .Va ifnet .
174 The elements of this list are of type
175 .Vt "struct ifnet" ,
176 and most kernel routines which manipulate interface as such accept or
177 return pointers to these structures.
178 Each interface structure
179 contains an
180 .Vt if_data
181 structure, which contains statistics and identifying information used
182 by management programs, and which is exported to user programs by way
183 of the
184 .Xr ifmib 4
185 branch of the
186 .Xr sysctl 3
187 MIB.
188 Each interface also has a
189 .Li TAILQ
190 of interface addresses, described by
191 .Vt ifaddr
192 structures; the head of the queue is always an
193 .Dv AF_LINK
194 address
195 (see
196 .Xr link_addr 3 )
197 describing the link layer implemented by the interface (if any).
198 (Some trivial interfaces do not provide any link layer addresses;
199 this structure, while still present, serves only to identify the
200 interface name and index.)
201 .Pp
202 Finally, those interfaces supporting reception of multicast datagrams
203 have a
204 .Li TAILQ
205 of multicast group memberships, described by
206 .Vt ifmultiaddr
207 structures.
208 These memberships are reference-counted.
209 .Pp
210 Interfaces are also associated with an output queue, defined as a
211 .Vt "struct ifqueue" ;
212 this structure is used to hold packets while the interface is in the
213 process of sending another.
214 .Pp
215 .Ss The Vt ifnet Ss structure
216 The fields of
217 .Vt "struct ifnet"
218 are as follows:
219 .Bl -tag -width ".Va if_capabilities" -offset indent
220 .It Va if_softc
221 .Pq Vt "void *"
222 A pointer to the driver's private state block.
223 (Initialized by driver.)
224 .It Va if_l2com
225 .Pq Vt "void *"
226 A pointer to the common data for the interface's layer 2 protocol.
227 (Initialized by
228 .Fn if_alloc . )
229 .It Va if_link
230 .Pq Fn TAILQ_ENTRY ifnet
231 .Xr queue 3
232 macro glue.
233 .It Va if_xname
234 .Pq Vt "char *"
235 The name of the interface,
236 (e.g.,
237 .Dq Li fxp0
238 or
239 .Dq Li lo0 ) .
240 (Initialized by driver
241 (usually via
242 .Fn if_initname ) . )
243 .It Va if_dname
244 .Pq Vt "const char *"
245 The name of the driver.
246 (Initialized by driver
247 (usually via
248 .Fn if_initname ) . )
249 .It Va if_dunit
250 .Pq Vt int
251 A unique number assigned to each interface managed by a particular
252 driver.
253 Drivers may choose to set this to
254 .Dv IF_DUNIT_NONE
255 if a unit number is not associated with the device.
256 (Initialized by driver
257 (usually via
258 .Fn if_initname ) . )
259 .It Va if_addrhead
260 .Pq Vt "struct ifaddrhead"
261 The head of the
262 .Xr queue 3
263 .Li TAILQ
264 containing the list of addresses assigned to this interface.
265 .It Va if_pcount
266 .Pq Vt int
267 A count of promiscuous listeners on this interface, used to
268 reference-count the
269 .Dv IFF_PROMISC
270 flag.
271 .It Va if_bpf
272 .Pq Vt "struct bpf_if *"
273 Opaque per-interface data for the packet filter,
274 .Xr bpf 4 .
275 (Initialized by
276 .Fn bpf_attach . )
277 .It Va if_index
278 .Pq Vt u_short
279 A unique number assigned to each interface in sequence as it is
280 attached.
281 This number can be used in a
282 .Vt "struct sockaddr_dl"
283 to refer to a particular interface by index
284 (see
285 .Xr link_addr 3 ) .
286 (Initialized by
287 .Fn if_alloc . )
288 .It Va if_flags
289 .Pq Vt int
290 Flags describing operational parameters of this interface (see below).
291 (Manipulated by generic code.)
292 .It Va if_drv_flags
293 .Pq Vt int
294 Flags describing operational status of this interface (see below).
295 (Manipulated by driver.)
296 .It Va if_capabilities
297 .Pq Vt int
298 Flags describing the capabilities the interface supports (see below).
299 .It Va if_capenable
300 .Pq Vt int
301 Flags describing the enabled capabilities of the interface (see below).
302 .\" .It Va if_ipending
303 .\" Interrupt-pending bits for polled operation:
304 .\" .Dv IFI_XMIT
305 .\" (transmit complete interrupt)
306 .\" and
307 .\" .Dv IFI_RECV
308 .\" (received packet ready interrupt).
309 .\" See the
310 .\" .Sx Polling
311 .\" section, below.
312 .\" (Manipulated by driver.)
313 .It Va if_linkmib
314 .Pq Vt "void *"
315 A pointer to an interface-specific MIB structure exported by
316 .Xr ifmib 4 .
317 (Initialized by driver.)
318 .It Va if_linkmiblen
319 .Pq Vt size_t
320 The size of said structure.
321 (Initialized by driver.)
322 .It Va if_data
323 .Pq Vt "struct if_data"
324 More statistics and information; see
325 .Sx "The if_data structure" ,
326 below.
327 (Initialized by driver, manipulated by both driver and generic
328 code.)
329 .It Va if_snd
330 .Pq Vt "struct ifqueue"
331 The output queue.
332 (Manipulated by driver.)
333 .\".It Va if_poll_slowq
334 .\".Pq Vt "struct ifqueue *"
335 .\"A pointer to the input queue for devices which do not support polling
336 .\"well.
337 .\"See the
338 .\".Sx Polling
339 .\"section, below.
340 .\"(Initialized by driver.)
341 .El
342 .Pp
343 There are in addition a number of function pointers which the driver
344 must initialize to complete its interface with the generic interface
345 layer:
346 .Bl -ohang -offset indent
347 .It Fn if_input
348 Pass a packet to an appropriate upper layer as determined
349 from the link-layer header of the packet.
350 This routine is to be called from an interrupt handler or
351 used to emulate reception of a packet on this interface.
352 A single function implementing
353 .Fn if_input
354 can be shared among multiple drivers utilizing the same link-layer
355 framing, e.g., Ethernet.
356 .It Fn if_output
357 Output a packet on interface
358 .Fa ifp ,
359 or queue it on the output queue if the interface is already active.
360 .It Fn if_transmit
361 Transmit a packet on an interface or queue it if the interface is
362 in use.
363 This function will return
364 .Dv ENOBUFS
365 if the devices software and hardware queues are both full.
366 This function must be installed after
367 .Fn if_attach 
368 to override the default implementation.
369 This function is exposed in order to allow drivers to manage their own queues
370 and to reduce the latency caused by a frequently gratuitous enqueue / dequeue
371 pair to ifq.
372 The suggested internal software queueing mechanism is buf_ring.
373 .It Fn if_qflush
374 Free mbufs in internally managed queues when the interface is marked down.
375 This function must be installed after 
376 .Fn if_attach 
377 to override the default implementation.
378 This function is exposed in order to allow drivers to manage their own queues
379 and to reduce the latency caused by a frequently gratuitous enqueue / dequeue
380 pair to ifq.
381 The suggested internal software queueing mechanism is buf_ring.
382 .It Fn if_start
383 Start queued output on an interface.
384 This function is exposed in
385 order to provide for some interface classes to share a
386 .Fn if_output
387 among all drivers.
388 .Fn if_start
389 may only be called when the
390 .Dv IFF_DRV_OACTIVE
391 flag is not set.
392 (Thus,
393 .Dv IFF_DRV_OACTIVE
394 does not literally mean that output is active, but rather that the
395 device's internal output queue is full.) Please note that this function
396 will soon be deprecated.
397 .It Fn if_done
398 Not used.
399 We are not even sure what it was ever for.
400 The prototype is faked.
401 .It Fn if_ioctl
402 Process interface-related
403 .Xr ioctl 2
404 requests
405 (defined in
406 .In sys/sockio.h ) .
407 Preliminary processing is done by the generic routine
408 .Fn ifioctl
409 to check for appropriate privileges, locate the interface being
410 manipulated, and perform certain generic operations like twiddling
411 flags and flushing queues.
412 See the description of
413 .Fn ifioctl
414 below for more information.
415 .\" .It Fn if_poll_recv
416 .\" .It Fn if_poll_xmit
417 .\" .It Fn if_poll_slowinput
418 .\" .It Fn if_poll_intren
419 .\" See the
420 .\" .Sx Polling
421 .\" section, below.
422 .It Fn if_init
423 Initialize and bring up the hardware,
424 e.g., reset the chip and enable the receiver unit.
425 Should mark the interface running,
426 but not active
427 .Dv ( IFF_DRV_RUNNING , ~IIF_DRV_OACTIVE ) .
428 .It Fn if_resolvemulti
429 Check the requested multicast group membership,
430 .Fa addr ,
431 for validity, and if necessary compute a link-layer group which
432 corresponds to that address which is returned in
433 .Fa *retsa .
434 Returns zero on success, or an error code on failure.
435 .El
436 .Ss "Interface Flags"
437 Interface flags are used for a number of different purposes.
438 Some
439 flags simply indicate information about the type of interface and its
440 capabilities; others are dynamically manipulated to reflect the
441 current state of the interface.
442 Flags of the former kind are marked
443 .Aq S
444 in this table; the latter are marked
445 .Aq D .
446 Flags which begin with
447 .Dq IFF_DRV_
448 are stored in
449 .Va if_drv_flags ;
450 all other flags are stored in
451 .Va if_flags .
452 .Pp
453 The macro
454 .Dv IFF_CANTCHANGE
455 defines the bits which cannot be set by a user program using the
456 .Dv SIOCSIFFLAGS
457 command to
458 .Xr ioctl 2 ;
459 these are indicated by an asterisk
460 .Pq Ql *
461 in the following listing.
462 .Pp
463 .Bl -tag -width ".Dv IFF_POINTOPOINT" -offset indent -compact
464 .It Dv IFF_UP
465 .Aq D
466 The interface has been configured up by the user-level code.
467 .It Dv IFF_BROADCAST
468 .Aq S*
469 The interface supports broadcast.
470 .It Dv IFF_DEBUG
471 .Aq D
472 Used to enable/disable driver debugging code.
473 .It Dv IFF_LOOPBACK
474 .Aq S
475 The interface is a loopback device.
476 .It Dv IFF_POINTOPOINT
477 .Aq S*
478 The interface is point-to-point;
479 .Dq broadcast
480 address is actually the address of the other end.
481 .It Dv IFF_DRV_RUNNING
482 .Aq D*
483 The interface has been configured and dynamic resources were
484 successfully allocated.
485 Probably only useful internal to the
486 interface.
487 .It Dv IFF_NOARP
488 .Aq D
489 Disable network address resolution on this interface.
490 .It Dv IFF_PROMISC
491 .Aq D*
492 This interface is in promiscuous mode.
493 .It Dv IFF_PPROMISC
494 .Aq D
495 This interface is in the permanently promiscuous mode (implies
496 .Dv IFF_PROMISC ) .
497 .It Dv IFF_ALLMULTI
498 .Aq D*
499 This interface is in all-multicasts mode (used by multicast routers).
500 .It Dv IFF_DRV_OACTIVE
501 .Aq D*
502 The interface's hardware output queue (if any) is full; output packets
503 are to be queued.
504 .It Dv IFF_SIMPLEX
505 .Aq S*
506 The interface cannot hear its own transmissions.
507 .It Dv IFF_LINK0
508 .It Dv IFF_LINK1
509 .It Dv IFF_LINK2
510 .Aq D
511 Control flags for the link layer.
512 (Currently abused to select among
513 multiple physical layers on some devices.)
514 .It Dv IFF_MULTICAST
515 .Aq S*
516 This interface supports multicast.
517 .It Dv IFF_POLLING
518 .Aq D*
519 The interface is in
520 .Xr polling 4
521 mode.
522 See
523 .Sx Interface Capabilities Flags
524 for details.
525 .El
526 .Ss "Interface Capabilities Flags"
527 Interface capabilities are specialized features an interface may
528 or may not support.
529 These capabilities are very hardware-specific
530 and allow, when enabled,
531 to offload specific network processing to the interface
532 or to offer a particular feature for use by other kernel parts.
533 .Pp
534 It should be stressed that a capability can be completely
535 uncontrolled (i.e., stay always enabled with no way to disable it)
536 or allow limited control over itself (e.g., depend on another
537 capability's state.)
538 Such peculiarities are determined solely by the hardware and driver
539 of a particular interface.
540 Only the driver possesses
541 the knowledge on whether and how the interface capabilities
542 can be controlled.
543 Consequently, capabilities flags in
544 .Va if_capenable
545 should never be modified directly by kernel code other than
546 the interface driver.
547 The command
548 .Dv SIOCSIFCAP
549 to
550 .Fn ifioctl
551 is the dedicated means to attempt altering
552 .Va if_capenable
553 on an interface.
554 Userland code shall use
555 .Xr ioctl 2 .
556 .Pp
557 The following capabilities are currently supported by the system:
558 .Bl -tag -width ".Dv IFCAP_VLAN_HWTAGGING" -offset indent
559 .It Dv IFCAP_NETCONS
560 This interface can be a network console.
561 .It Dv IFCAP_POLLING
562 This interface supports
563 .Xr polling 4 .
564 See below for details.
565 .It Dv IFCAP_RXCSUM
566 This interface can do checksum validation on receiving data.
567 Some interfaces do not have sufficient buffer storage to store frames
568 above a certain MTU-size completely.
569 The driver for the interface might disable hardware checksum validation
570 if the MTU is set above the hardcoded limit.
571 .It Dv IFCAP_TXCSUM
572 This interface can do checksum calculation on transmitting data.
573 .It Dv IFCAP_HWCSUM
574 A shorthand for
575 .Pq Dv IFCAP_RXCSUM | IFCAP_TXCSUM .
576 .It Dv IFCAP_VLAN_HWTAGGING
577 This interface can do VLAN tagging on output and
578 demultiplex frames by their VLAN tag on input.
579 .It Dv IFCAP_VLAN_MTU
580 The
581 .Xr vlan 4
582 driver can operate over this interface in software tagging mode
583 without having to decrease MTU on
584 .Xr vlan 4
585 interfaces below 1500 bytes.
586 This implies the ability of this interface to cope with frames somewhat
587 longer than permitted by the Ethernet specification.
588 .It Dv IFCAP_JUMBO_MTU
589 This Ethernet interface can transmit and receive frames up to
590 9000 bytes long.
591 .It Dv IFCAP_TSO4
592 This Ethernet interface supports TCP Segmentation offloading.
593 .It Dv IFCAP_TSO6
594 This Ethernet interface supports TCP6 Segmentation offloading.
595 .It Dv IFCAP_TSO
596 A shorthand for 
597 .Pq Dv IFCAP_TSO4 | IFCAP_TSO6 .
598 .It Dv IFCAP_TOE4
599 This Ethernet interface supports TCP offloading.
600 .It Dv IFCAP_TOE6
601 This Ethernet interface supports TCP6 offloading.
602 .It Dv ICAP_TOE
603 A Shorthand for 
604 .Pq Dv IFCAP_TOE4 | IFCAP_TOE6 .
605 .It Dv IFCAP_WOL_UCAST
606 This Ethernet interface supports waking up on any Unicast packet.
607 .It Dv IFCAP_WOL_MCAST
608 This Ethernet interface supports waking up on any Multicast packet.
609 .It Dv IFCAP_WOL_MAGIC
610 This Ethernet interface supports waking up on any Magic packet such
611 as those sent by
612 .Xr wake 8 .
613 .It Dv IFCAP_WOL
614 A shorthand for
615 .Pq Dv IFCAP_WOL_UCAST | IFCAP_WOL_MCAST | IFCAP_WOL_MAGIC .
616 .El
617 .Pp
618 The ability of advanced network interfaces to offload certain
619 computational tasks from the host CPU to the board is limited
620 mostly to TCP/IP.
621 Therefore a separate field associated with an interface
622 (see
623 .Va ifnet.if_data.ifi_hwassist
624 below)
625 keeps a detailed description of its enabled capabilities
626 specific to TCP/IP processing.
627 The TCP/IP module consults the field to see which tasks
628 can be done on an
629 .Em outgoing
630 packet by the interface.
631 The flags defined for that field are a superset of those for
632 .Va mbuf.m_pkthdr.csum_flags ,
633 namely:
634 .Bl -tag -width ".Dv CSUM_FRAGMENT" -offset indent
635 .It Dv CSUM_IP
636 The interface will compute IP checksums.
637 .It Dv CSUM_TCP
638 The interface will compute TCP checksums.
639 .It Dv CSUM_UDP
640 The interface will compute UDP checksums.
641 .It Dv CSUM_IP_FRAGS
642 The interface can compute a TCP or UDP checksum for a packet
643 fragmented by the host CPU.
644 Makes sense only along with
645 .Dv CSUM_TCP
646 or
647 .Dv CSUM_UDP .
648 .It Dv CSUM_FRAGMENT
649 The interface will do the fragmentation of IP packets if necessary.
650 The host CPU does not need to care about MTU on this interface
651 as long as a packet to transmit through it is an IP one and it
652 does not exceed the size of the hardware buffer.
653 .El
654 .Pp
655 An interface notifies the TCP/IP module about the tasks
656 the former has performed on an
657 .Em incoming
658 packet by setting the corresponding flags in the field
659 .Va mbuf.m_pkthdr.csum_flags
660 of the
661 .Vt mbuf chain
662 containing the packet.
663 See
664 .Xr mbuf 9
665 for details.
666 .Pp
667 The capability of a network interface to operate in
668 .Xr polling 4
669 mode involves several flags in different
670 global variables and per-interface fields.
671 First, there is a system-wide
672 .Xr sysctl 8
673 master switch named
674 .Va kern.polling.enable ,
675 which can toggle
676 .Xr polling 4
677 globally.
678 If that variable is set to non-zero,
679 .Xr polling 4
680 will be used on those devices where it is enabled individually.
681 Otherwise,
682 .Xr polling 4
683 will not be used in the system.
684 Second, the capability flag
685 .Dv IFCAP_POLLING
686 set in interface's
687 .Va if_capabilities
688 indicates support for
689 .Xr polling 4
690 on the particular interface.
691 If set in
692 .Va if_capabilities ,
693 the same flag can be marked or cleared in the interface's
694 .Va if_capenable ,
695 thus initiating switch of the interface to
696 .Xr polling 4
697 mode or interrupt
698 mode, respectively.
699 The actual mode change will occur at an implementation-specific moment
700 in the future, e.g., during the next interrupt or
701 .Xr polling 4
702 cycle.
703 And finally, if the mode transition has been successful, the flag
704 .Dv IFF_POLLING
705 is marked or cleared in the interface's
706 .Va if_flags
707 to indicate the current mode of the interface.
708 .Ss The Vt if_data Ss Structure
709 In
710 .Bx 4.4 ,
711 a subset of the interface information believed to be of interest to
712 management stations was segregated from the
713 .Vt ifnet
714 structure and moved into its own
715 .Vt if_data
716 structure to facilitate its use by user programs.
717 The following elements of the
718 .Vt if_data
719 structure are initialized by the interface and are not expected to change
720 significantly over the course of normal operation:
721 .Bl -tag -width ".Va ifi_lastchange" -offset indent
722 .It Va ifi_type
723 .Pq Vt u_char
724 The type of the interface, as defined in
725 .In net/if_types.h
726 and described below in the
727 .Sx "Interface Types"
728 section.
729 .It Va ifi_physical
730 .Pq Vt u_char
731 Intended to represent a selection of physical layers on devices which
732 support more than one; never implemented.
733 .It Va ifi_addrlen
734 .Pq Vt u_char
735 Length of a link-layer address on this device, or zero if there are
736 none.
737 Used to initialized the address length field in
738 .Vt sockaddr_dl
739 structures referring to this interface.
740 .It Va ifi_hdrlen
741 .Pq Vt u_char
742 Maximum length of any link-layer header which might be prepended by
743 the driver to a packet before transmission.
744 The generic code computes
745 the maximum over all interfaces and uses that value to influence the
746 placement of data in
747 .Vt mbuf Ns s
748 to attempt to ensure that there is always
749 sufficient space to prepend a link-layer header without allocating an
750 additional
751 .Vt mbuf .
752 .\" (See
753 .\" .Xr mbuf 9 . )
754 .\" .It Va ifi_recvquota
755 .\" .Pq Vt u_char
756 .\" Number of packets the interface is permitted to receive at one time
757 .\" when in polled mode.
758 .\" .It Va ifi_xmitquota
759 .\" .Pq Vt u_char
760 .\" Number of packets the interface is permitted to queue for transmission
761 .\" at one time when in polled mode.
762 .\" There is some controversy over
763 .\" whether such a restriction makes any sense at all.
764 .It Va ifi_datalen
765 .Pq Vt u_char
766 Length of the
767 .Vt if_data
768 structure.
769 Allows some stabilization of the routing socket ABI in the face of
770 increases in the length of
771 .Vt struct ifdata .
772 .It Va ifi_mtu
773 .Pq Vt u_long
774 The maximum transmission unit of the medium, exclusive of any
775 link-layer overhead.
776 .It Va ifi_metric
777 .Pq Vt u_long
778 A dimensionless metric interpreted by a user-mode routing process.
779 .It Va ifi_baudrate
780 .Pq Vt u_long
781 The line rate of the interface, in bits per second.
782 .It Va ifi_hwassist
783 .Pq Vt u_long
784 A detailed interpretation of the capabilities
785 to offload computational tasks for
786 .Em outgoing
787 packets.
788 The interface driver must keep this field in accord with
789 the current value of
790 .Va if_capenable .
791 .It Va ifi_epoch
792 .Pq Vt time_t
793 The system uptime when interface was attached or the statistics
794 below were reset.
795 This is intended to be used to set the SNMP variable
796 .Va ifCounterDiscontinuityTime .
797 It may also be used to determine if two successive queries for an
798 interface of the same index have returned results for the same
799 interface.
800 .El
801 .Pp
802 The structure additionally contains generic statistics applicable to a
803 variety of different interface types (except as noted, all members are
804 of type
805 .Vt u_long ) :
806 .Bl -tag -width ".Va ifi_lastchange" -offset indent
807 .It Va ifi_link_state
808 .Pq Vt u_char
809 The current link state of Ethernet interfaces.
810 See the
811 .Sx Interface Link States
812 section for possible values.
813 .It Va ifi_ipackets
814 Number of packets received.
815 .It Va ifi_ierrors
816 Number of receive errors detected (e.g., FCS errors, DMA overruns,
817 etc.).
818 More detailed breakdowns can often be had by way of a
819 link-specific MIB.
820 .It Va ifi_opackets
821 Number of packets transmitted.
822 .It Va ifi_oerrors
823 Number of output errors detected (e.g., late collisions, DMA overruns,
824 etc.).
825 More detailed breakdowns can often be had by way of a
826 link-specific MIB.
827 .It Va ifi_collisions
828 Total number of collisions detected on output for CSMA interfaces.
829 (This member is sometimes [ab]used by other types of interfaces for
830 other output error counts.)
831 .It Va ifi_ibytes
832 Total traffic received, in bytes.
833 .It Va ifi_obytes
834 Total traffic transmitted, in bytes.
835 .It Va ifi_imcasts
836 Number of packets received which were sent by link-layer multicast.
837 .It Va ifi_omcasts
838 Number of packets sent by link-layer multicast.
839 .It Va ifi_iqdrops
840 Number of packets dropped on input.
841 Rarely implemented.
842 .It Va ifi_noproto
843 Number of packets received for unknown network-layer protocol.
844 .\" .It Va ifi_recvtiming
845 .\" Amount of time, in microseconds, spent to receive an average packet on
846 .\" this interface.
847 .\" See the
848 .\" .Sx Polling
849 .\" section, below.
850 .\" .It Va ifi_xmittiming
851 .\" Amount of time, in microseconds, spent to service a transmit-complete
852 .\" interrupt on this interface.
853 .\" See the
854 .\" .Sx Polling
855 .\" section, below.
856 .It Va ifi_lastchange
857 .Pq Vt "struct timeval"
858 The time of the last administrative change to the interface (as required
859 for
860 .Tn SNMP ) .
861 .El
862 .Ss Interface Types
863 The header file
864 .In net/if_types.h
865 defines symbolic constants for a number of different types of
866 interfaces.
867 The most common are:
868 .Pp
869 .Bl -tag -offset indent -width ".Dv IFT_PROPVIRTUAL" -compact
870 .It Dv IFT_OTHER
871 none of the following
872 .It Dv IFT_ETHER
873 Ethernet
874 .It Dv IFT_ISO88023
875 ISO 8802-3 CSMA/CD
876 .It Dv IFT_ISO88024
877 ISO 8802-4 Token Bus
878 .It Dv IFT_ISO88025
879 ISO 8802-5 Token Ring
880 .It Dv IFT_ISO88026
881 ISO 8802-6 DQDB MAN
882 .It Dv IFT_FDDI
883 FDDI
884 .It Dv IFT_PPP
885 Internet Point-to-Point Protocol
886 .Pq Xr ppp 8
887 .It Dv IFT_LOOP
888 The loopback
889 .Pq Xr lo 4
890 interface
891 .It Dv IFT_SLIP
892 Serial Line IP
893 .It Dv IFT_PARA
894 Parallel-port IP
895 .Pq Dq Tn PLIP
896 .It Dv IFT_ATM
897 Asynchronous Transfer Mode
898 .El
899 .Ss Interface Link States
900 The following link states are currently defined:
901 .Pp
902 .Bl -tag -offset indent -width ".Dv LINK_STATE_UNKNOWN" -compact
903 .It Dv LINK_STATE_UNKNOWN
904 The link is in an invalid or unknown state.
905 .It Dv LINK_STATE_DOWN
906 The link is down.
907 .It Dv LINK_STATE_UP
908 The link is up.
909 .El
910 .Ss The Vt ifaddr Ss Structure
911 Every interface is associated with a list
912 (or, rather, a
913 .Li TAILQ )
914 of addresses, rooted at the interface structure's
915 .Va if_addrlist
916 member.
917 The first element in this list is always an
918 .Dv AF_LINK
919 address representing the interface itself; multi-access network
920 drivers should complete this structure by filling in their link-layer
921 addresses after calling
922 .Fn if_attach .
923 Other members of the structure represent network-layer addresses which
924 have been configured by means of the
925 .Dv SIOCAIFADDR
926 command to
927 .Xr ioctl 2 ,
928 called on a socket of the appropriate protocol family.
929 The elements of this list consist of
930 .Vt ifaddr
931 structures.
932 Most protocols will declare their own protocol-specific
933 interface address structures, but all begin with a
934 .Vt "struct ifaddr"
935 which provides the most-commonly-needed functionality across all
936 protocols.
937 Interface addresses are reference-counted.
938 .Pp
939 The members of
940 .Vt "struct ifaddr"
941 are as follows:
942 .Bl -tag -width ".Va ifa_rtrequest" -offset indent
943 .It Va ifa_addr
944 .Pq Vt "struct sockaddr *"
945 The local address of the interface.
946 .It Va ifa_dstaddr
947 .Pq Vt "struct sockaddr *"
948 The remote address of point-to-point interfaces, and the broadcast
949 address of broadcast interfaces.
950 .Va ( ifa_broadaddr
951 is a macro for
952 .Va ifa_dstaddr . )
953 .It Va ifa_netmask
954 .Pq Vt "struct sockaddr *"
955 The network mask for multi-access interfaces, and the confusion
956 generator for point-to-point interfaces.
957 .It Va ifa_ifp
958 .Pq Vt "struct ifnet *"
959 A link back to the interface structure.
960 .It Va ifa_link
961 .Pq Fn TAILQ_ENTRY ifaddr
962 .Xr queue 3
963 glue for list of addresses on each interface.
964 .It Va ifa_rtrequest
965 See below.
966 .It Va ifa_flags
967 .Pq Vt u_short
968 Some of the flags which would be used for a route representing this
969 address in the route table.
970 .It Va ifa_refcnt
971 .Pq Vt short
972 The reference count.
973 .It Va ifa_metric
974 .Pq Vt int
975 A metric associated with this interface address, for the use of some
976 external routing protocol.
977 .El
978 .Pp
979 References to
980 .Vt ifaddr
981 structures are gained manually, by incrementing the
982 .Va ifa_refcnt
983 member.
984 References are released by calling either the
985 .Fn ifafree
986 function or the
987 .Fn IFAFREE
988 macro.
989 .Pp
990 .Fn ifa_rtrequest
991 is a pointer to a function which receives callouts from the routing
992 code
993 .Pq Fn rtrequest
994 to perform link-layer-specific actions upon requests to add, resolve,
995 or delete routes.
996 The
997 .Fa cmd
998 argument indicates the request in question:
999 .Dv RTM_ADD , RTM_RESOLVE ,
1000 or
1001 .Dv RTM_DELETE .
1002 The
1003 .Fa rt
1004 argument is the route in question; the
1005 .Fa dst
1006 argument is the specific destination being manipulated
1007 for
1008 .Dv RTM_RESOLVE ,
1009 or a null pointer otherwise.
1010 .Sh FUNCTIONS
1011 The functions provided by the generic interface code can be divided
1012 into two groups: those which manipulate interfaces, and those which
1013 manipulate interface addresses.
1014 In addition to these functions, there
1015 may also be link-layer support routines which are used by a number of
1016 drivers implementing a specific link layer over different hardware;
1017 see the documentation for that link layer for more details.
1018 .Ss The Vt ifmultiaddr Ss Structure
1019 Every multicast-capable interface is associated with a list of
1020 multicast group memberships, which indicate at a low level which
1021 link-layer multicast addresses (if any) should be accepted, and at a
1022 high level, in which network-layer multicast groups a user process has
1023 expressed interest.
1024 .Pp
1025 The elements of the structure are as follows:
1026 .Bl -tag -width ".Va ifma_refcount" -offset indent
1027 .It Va ifma_link
1028 .Pq Fn LIST_ENTRY ifmultiaddr
1029 .Xr queue 3
1030 macro glue.
1031 .It Va ifma_addr
1032 .Pq Vt "struct sockaddr *"
1033 A pointer to the address which this record represents.
1034 The
1035 memberships for various address families are stored in arbitrary
1036 order.
1037 .It Va ifma_lladdr
1038 .Pq Vt "struct sockaddr *"
1039 A pointer to the link-layer multicast address, if any, to which the
1040 network-layer multicast address in
1041 .Va ifma_addr
1042 is mapped, else a null pointer.
1043 If this element is non-nil, this
1044 membership also holds an invisible reference to another membership for
1045 that link-layer address.
1046 .It Va ifma_refcount
1047 .Pq Vt u_int
1048 A reference count of requests for this particular membership.
1049 .El
1050 .Ss Interface Manipulation Functions
1051 .Bl -ohang -offset indent
1052 .It Fn if_alloc
1053 Allocate and initialize
1054 .Vt "struct ifnet" .
1055 Initialization includes the allocation of an interface index and may
1056 include the allocation of a
1057 .Fa type
1058 specific structure in
1059 .Va if_l2com .
1060 .It Fn if_attach
1061 Link the specified interface
1062 .Fa ifp
1063 into the list of network interfaces.
1064 Also initialize the list of
1065 addresses on that interface, and create a link-layer
1066 .Vt ifaddr
1067 structure to be the first element in that list.
1068 (A pointer to
1069 this address structure is saved in the global array
1070 .Va ifnet_addrs . )
1071 The
1072 .Fa ifp
1073 must have been allocated by
1074 .Fn if_alloc .
1075 .It Fn if_detach
1076 Shut down and unlink the specified
1077 .Fa ifp
1078 from the interface list.
1079 .It Fn if_free
1080 Free the given
1081 .Fa ifp
1082 back to the system.
1083 The interface must have been previously detached if it was ever attached.
1084 .It Fn if_free_type
1085 Identical to
1086 .Fn if_free
1087 except that the given
1088 .Fa type
1089 is used to free
1090 .Va if_l2com
1091 instead of the type in
1092 .Va if_type .
1093 This is intended for use with drivers that change their interface type.
1094 .It Fn if_down
1095 Mark the interface
1096 .Fa ifp
1097 as down (i.e.,
1098 .Dv IFF_UP
1099 is not set),
1100 flush its output queue, notify protocols of the transition,
1101 and generate a message from the
1102 .Xr route 4
1103 routing socket.
1104 .It Fn if_up
1105 Mark the interface
1106 .Fa ifp
1107 as up, notify protocols of the transition,
1108 and generate a message from the
1109 .Xr route 4
1110 routing socket.
1111 .It Fn ifpromisc
1112 Add or remove a promiscuous reference to
1113 .Fa ifp .
1114 If
1115 .Fa pswitch
1116 is true, add a reference;
1117 if it is false, remove a reference.
1118 On reference count transitions
1119 from zero to one and one to zero, set the
1120 .Dv IFF_PROMISC
1121 flag appropriately and call
1122 .Fn if_ioctl
1123 to set up the interface in the desired mode.
1124 .It Fn if_allmulti
1125 As
1126 .Fn ifpromisc ,
1127 but for the all-multicasts
1128 .Pq Dv IFF_ALLMULTI
1129 flag instead of the promiscuous flag.
1130 .It Fn ifunit
1131 Return an
1132 .Vt ifnet
1133 pointer for the interface named
1134 .Fa name .
1135 .It Fn ifioctl
1136 Process the ioctl request
1137 .Fa cmd ,
1138 issued on socket
1139 .Fa so
1140 by thread
1141 .Fa td ,
1142 with data parameter
1143 .Fa data .
1144 This is the main routine for handling all interface configuration
1145 requests from user mode.
1146 It is ordinarily only called from the socket-layer
1147 .Xr ioctl 2
1148 handler, and only for commands with class
1149 .Sq Li i .
1150 Any unrecognized commands will be passed down to socket
1151 .Fa so Ns 's
1152 protocol for
1153 further interpretation.
1154 The following commands are handled by
1155 .Fn ifioctl :
1156 .Pp
1157 .Bl -tag -width ".Dv OSIOCGIFNETMASK" -offset indent -compact
1158 .It Dv SIOCGIFCONF
1159 .It Dv OSIOCGIFCONF
1160 Get interface configuration.
1161 (No call-down to driver.)
1162 .Pp
1163 .It Dv SIOCSIFNAME
1164 Set the interface name.
1165 .Dv RTM_IFANNOUNCE
1166 departure and arrival messages are sent so that
1167 routing code that relies on the interface name will update its interface
1168 list.
1169 Caller must have appropriate privilege.
1170 (No call-down to driver.)
1171 .It Dv SIOCGIFCAP
1172 .It Dv SIOCGIFFIB
1173 .It Dv SIOCGIFFLAGS
1174 .It Dv SIOCGIFMETRIC
1175 .It Dv SIOCGIFMTU
1176 .It Dv SIOCGIFPHYS
1177 Get interface capabilities, FIB, flags, metric, MTU, medium selection.
1178 (No call-down to driver.)
1179 .Pp
1180 .It Dv SIOCSIFCAP
1181 Enable or disable interface capabilities.
1182 Caller must have appropriate privilege.
1183 Before a call to the driver-specific
1184 .Fn if_ioctl
1185 routine, the requested mask for enabled capabilities is checked
1186 against the mask of capabilities supported by the interface,
1187 .Va if_capabilities .
1188 Requesting to enable an unsupported capability is invalid.
1189 The rest is supposed to be done by the driver,
1190 which includes updating
1191 .Va if_capenable
1192 and
1193 .Va if_data.ifi_hwassist
1194 appropriately.
1195 .Pp
1196 .It Dv SIOCSIFFIB
1197 Sets interface FIB.
1198 Caller must have appropriate privilege.
1199 FIB values start at 0 and values greater or equals than
1200 .Va net.fibs
1201 are considered invalid.
1202 .It Dv SIOCSIFFLAGS
1203 Change interface flags.
1204 Caller must have appropriate privilege.
1205 If a change to the
1206 .Dv IFF_UP
1207 flag is requested,
1208 .Fn if_up
1209 or
1210 .Fn if_down
1211 is called as appropriate.
1212 Flags listed in
1213 .Dv IFF_CANTCHANGE
1214 are masked off, and the field
1215 .Va if_flags
1216 in the interface structure is updated.
1217 Finally, the driver
1218 .Fn if_ioctl
1219 routine is called to perform any setup
1220 requested.
1221 .Pp
1222 .It Dv SIOCSIFMETRIC
1223 .It Dv SIOCSIFPHYS
1224 Change interface metric or medium.
1225 Caller must have appropriate privilege.
1226 .Pp
1227 .It Dv SIOCSIFMTU
1228 Change interface MTU.
1229 Caller must have appropriate privilege.
1230 MTU
1231 values less than 72 or greater than 65535 are considered invalid.
1232 The driver
1233 .Fn if_ioctl
1234 routine is called to implement the change; it is responsible for any
1235 additional sanity checking and for actually modifying the MTU in the
1236 interface structure.
1237 .Pp
1238 .It Dv SIOCADDMULTI
1239 .It Dv SIOCDELMULTI
1240 Add or delete permanent multicast group memberships on the interface.
1241 Caller must have appropriate privilege.
1242 The
1243 .Fn if_addmulti
1244 or
1245 .Fn if_delmulti
1246 function is called to perform the operation; qq.v.
1247 .Pp
1248 .It Dv SIOCSIFDSTADDR
1249 .It Dv SIOCSIFADDR
1250 .It Dv SIOCSIFBRDADDR
1251 .It Dv SIOCSIFNETMASK
1252 The socket's protocol control routine is called to implement the
1253 requested action.
1254 .Pp
1255 .It Dv OSIOCGIFADDR
1256 .It Dv OSIOCGIFDSTADDR
1257 .It Dv OSIOCGIFBRDADDR
1258 .It Dv OSIOCGIFNETMASK
1259 The socket's protocol control routine is called to implement the
1260 requested action.
1261 On return,
1262 .Vt sockaddr
1263 structures are converted into old-style (no
1264 .Va sa_len
1265 member).
1266 .El
1267 .El
1268 .Pp
1269 .Fn if_down ,
1270 .Fn ifioctl ,
1271 .Fn ifpromisc ,
1272 and
1273 .Fn if_up
1274 must be called at
1275 .Fn splnet
1276 or higher.
1277 .Ss "Interface Address Functions"
1278 Several functions exist to look up an interface address structure
1279 given an address.
1280 .Fn ifa_ifwithaddr
1281 returns an interface address with either a local address or a
1282 broadcast address precisely matching the parameter
1283 .Fa addr .
1284 .Fn ifa_ifwithdstaddr
1285 returns an interface address for a point-to-point interface whose
1286 remote
1287 .Pq Dq destination
1288 address is
1289 .Fa addr .
1290 .Pp
1291 .Fn ifa_ifwithnet
1292 returns the most specific interface address which matches the
1293 specified address,
1294 .Fa addr ,
1295 subject to its configured netmask, or a point-to-point interface
1296 address whose remote address is
1297 .Fa addr
1298 if one is found.
1299 .Pp
1300 .Fn ifaof_ifpforaddr
1301 returns the most specific address configured on interface
1302 .Fa ifp
1303 which matches address
1304 .Fa addr ,
1305 subject to its configured netmask.
1306 If the interface is
1307 point-to-point, only an interface address whose remote address is
1308 precisely
1309 .Fa addr
1310 will be returned.
1311 .Pp
1312 All of these functions return a null pointer if no such address can be
1313 found.
1314 .Ss "Interface Multicast Address Functions"
1315 The
1316 .Fn if_addmulti ,
1317 .Fn if_delmulti ,
1318 and
1319 .Fn ifmaof_ifpforaddr
1320 functions provide support for requesting and relinquishing multicast
1321 group memberships, and for querying an interface's membership list,
1322 respectively.
1323 The
1324 .Fn if_addmulti
1325 function takes a pointer to an interface,
1326 .Fa ifp ,
1327 and a generic address,
1328 .Fa sa .
1329 It also takes a pointer to a
1330 .Vt "struct ifmultiaddr *"
1331 which is filled in on successful return with the address of the
1332 group membership control block.
1333 The
1334 .Fn if_addmulti
1335 function performs the following four-step process:
1336 .Bl -enum -offset indent
1337 .It
1338 Call the interface's
1339 .Fn if_resolvemulti
1340 entry point to determine the link-layer address, if any, corresponding
1341 to this membership request, and also to give the link layer an
1342 opportunity to veto this membership request should it so desire.
1343 .It
1344 Check the interface's group membership list for a pre-existing
1345 membership for this group.
1346 If one is not found, allocate a new one;
1347 if one is, increment its reference count.
1348 .It
1349 If the
1350 .Fn if_resolvemulti
1351 routine returned a link-layer address corresponding to the group,
1352 repeat the previous step for that address as well.
1353 .It
1354 If the interface's multicast address filter needs to be changed
1355 because a new membership was added, call the interface's
1356 .Fn if_ioctl
1357 routine
1358 (with a
1359 .Fa cmd
1360 argument of
1361 .Dv SIOCADDMULTI )
1362 to request that it do so.
1363 .El
1364 .Pp
1365 The
1366 .Fn if_delmulti
1367 function, given an interface
1368 .Fa ifp
1369 and an address,
1370 .Fa sa ,
1371 reverses this process.
1372 Both functions return zero on success, or a
1373 standard error number on failure.
1374 .Pp
1375 The
1376 .Fn ifmaof_ifpforaddr
1377 function examines the membership list of interface
1378 .Fa ifp
1379 for an address matching
1380 .Fa addr ,
1381 and returns a pointer to that
1382 .Vt "struct ifmultiaddr"
1383 if one is found, else it returns a null pointer.
1384 .Sh SEE ALSO
1385 .Xr ioctl 2 ,
1386 .Xr link_addr 3 ,
1387 .Xr queue 3 ,
1388 .Xr sysctl 3 ,
1389 .Xr bpf 4 ,
1390 .Xr ifmib 4 ,
1391 .Xr lo 4 ,
1392 .Xr netintro 4 ,
1393 .Xr polling 4 ,
1394 .Xr config 8 ,
1395 .Xr ppp 8 ,
1396 .Xr mbuf 9 ,
1397 .Xr rtentry 9
1398 .Rs
1399 .%A Gary R. Wright
1400 .%A W. Richard Stevens
1401 .%B TCP/IP Illustrated
1402 .%V Vol. 2
1403 .%O Addison-Wesley, ISBN 0-201-63354-X
1404 .Re
1405 .Sh AUTHORS
1406 This manual page was written by
1407 .An Garrett A. Wollman .