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