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