2 .\" Copyright 1996, 1997 Massachusetts Institute of Technology
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
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
39 .Nd kernel interfaces for manipulating network interfaces
48 .Ss "Interface Manipulation Functions"
50 .Fn if_attach "struct ifnet *ifp"
52 .Fn if_down "struct ifnet *ifp"
54 .Fn ifioctl "struct socket *so" "u_long cmd" "caddr_t data" "struct thread *td"
56 .Fn ifpromisc "struct ifnet *ifp" "int pswitch"
58 .Fn if_allmulti "struct ifnet *ifp" "int amswitch"
60 .Fn ifunit "const char *name"
62 .Fn if_up "struct ifnet *ifp"
64 .Ss "Interface Address Functions"
66 .Fn ifa_ifwithaddr "struct sockaddr *addr"
68 .Fn ifa_ifwithdstaddr "struct sockaddr *addr"
70 .Fn ifa_ifwithnet "struct sockaddr *addr"
72 .Fn ifaof_ifpforaddr "struct sockaddr *addr" "struct ifnet *ifp"
74 .Fn ifafree "struct ifaddr *ifa"
75 .Fn IFAFREE "struct ifaddr *ifa"
77 .Ss "Interface Multicast Address Functions"
79 .Fn if_addmulti "struct ifnet *ifp" "struct sockaddr *sa" "struct ifmultiaddr **ifmap"
81 .Fn if_delmulti "struct ifnet *ifp" "struct sockaddr *sa"
82 .Ft "struct ifmultiaddr *"
83 .Fn ifmaof_ifpforaddr "struct sockaddr *addr" "struct ifnet *ifp"
84 .Ss "Output queue macros"
85 .Fn IF_DEQUEUE "struct ifqueue *ifq" "struct mbuf *m"
87 .Ss "struct ifnet Member Functions"
89 .Fn \*(lp*if_input\*(rp "struct ifnet *ifp" "struct mbuf *m"
91 .Fo \*(lp*if_output\*(rp
92 .Fa "struct ifnet *ifp" "struct mbuf *m"
93 .Fa "struct sockaddr *dst" "struct rtentry *rt"
96 .Fn \*(lp*if_start\*(rp "struct ifnet *ifp"
98 .Fn \*(lp*if_done\*(rp "struct ifnet *ifp"
100 .Fn \*(lp*if_ioctl\*(rp "struct ifnet *ifp" "int cmd" "caddr_t data"
102 .Fn \*(lp*if_watchdog\*(rp "struct ifnet *ifp"
104 .Fn \*(lp*if_poll_recv\*(rp "struct ifnet *ifp" "int *quotap"
106 .Fn \*(lp*if_poll_xmit\*(rp "struct ifnet *ifp" "int *quotap"
108 .Fn \*(lp*if_poll_inttrn\*(rp "struct ifnet *ifp"
110 .Fn \*(lp*if_poll_slowinput\*(rp "struct ifnet *ifp" "struct mbuf *m"
112 .Fn \*(lp*if_init\*(rp "void *if_softc"
114 .Fo \*(lp*if_resolvemulti\*(rp
115 .Fa "struct ifnet *ifp" "struct sockaddr **retsa" "struct sockaddr *addr"
117 .Ss "struct ifaddr member function"
119 .Fo \*(lp*ifa_rtrequest\*(rp
120 .Fa "int cmd" "struct rtentry *rt" "struct sockaddr *dst"
123 .Ss "Global Variables"
124 .Vt extern struct ifnethead ifnet ;
125 .Vt extern struct ifaddr **ifnet_addrs ;
126 .Vt extern int if_index ;
127 .Vt extern int ifqmaxlen ;
129 The kernel mechanisms for handling network interfaces reside primarily
131 .Vt ifnet , if_data , ifaddr ,
138 and the functions named above and defined in
140 Those interfaces which are intended to be used by user programs
143 these include the interface flags, the
145 structure, and the structures defining the appearance of
146 interface-related messages on the
148 routing socket and in
152 defines the kernel-internal interfaces, including the
156 structures and the functions which manipulate them.
157 (A few user programs will need
159 because it is the prerequisite of some other header file like
160 .In netinet/if_ether.h .
161 Most references to those two files in particular can be replaced by
162 .In net/ethernet.h . )
164 The system keeps a linked list of interfaces using the
168 this list is headed by a
169 .Vt "struct ifnethead"
172 The elements of this list are of type
174 and most kernel routines which manipulate interface as such accept or
175 return pointers to these structures.
176 Each interface structure
179 structure, which contains statistics and identifying information used
180 by management programs, and which is exported to user programs by way
186 Each interface also has a
188 of interface addresses, described by
190 structures; the head of the queue is always an
195 describing the link layer implemented by the interface (if any).
196 (Some trivial interfaces do not provide any link layer addresses;
197 this structure, while still present, serves only to identify the
198 interface name and index.)
200 Finally, those interfaces supporting reception of multicast datagrams
203 of multicast group memberships, described by
206 These memberships are reference-counted.
208 Interfaces are also associated with an output queue, defined as a
209 .Vt "struct ifqueue" ;
210 this structure is used to hold packets while the interface is in the
211 process of sending another.
213 .Ss The Vt ifnet Ss structure
217 .Bl -tag -width ".Va if_capabilities" -offset indent
220 A pointer to the driver's private state block.
221 (Initialized by driver.)
223 .Pq Fn TAILQ_ENTRY ifnet
228 The name of the interface,
233 (Initialized by driver.)
235 .Pq Vt "const char *"
236 The name of the driver.
237 (Initialized by driver.)
240 A unique number assigned to each interface managed by a particular
242 Drivers may choose to set this to
244 if a unit number is not associated with the device.
245 (Initialized by driver.)
247 .Pq Vt "struct ifaddrhead"
251 containing the list of addresses assigned to this interface.
254 A count of promiscuous listeners on this interface, used to
259 .Pq Vt "struct bpf_if *"
260 Opaque per-interface data for the packet filter,
266 A unique number assigned to each interface in sequence as it is
268 This number can be used in a
269 .Vt "struct sockaddr_dl"
270 to refer to a particular interface by index
275 Number of seconds until the watchdog timer
277 is called, or zero if the timer is disabled.
279 decremented by generic watchdog code.)
282 Flags describing operational parameters of this interface (see below).
283 (Manipulated by both driver and generic code.)
284 .It Va if_capabilities
286 Flags describing the capabilities the interface supports (see below).
289 Flags describing the enabled capabilities of the interface (see below).
290 .\" .It Va if_ipending
291 .\" Interrupt-pending bits for polled operation:
293 .\" (transmit complete interrupt)
296 .\" (received packet ready interrupt).
300 .\" (Manipulated by driver.)
303 A pointer to an interface-specific MIB structure exported by
305 (Initialized by driver.)
308 The size of said structure.
309 (Initialized by driver.)
311 .Pq Vt "struct if_data"
312 More statistics and information; see
313 .Sx "The if_data structure" ,
315 (Initialized by driver, manipulated by both driver and generic
318 .Pq Vt "struct ifqueue"
320 (Manipulated by driver.)
321 .\".It Va if_poll_slowq
322 .\".Pq Vt "struct ifqueue *"
323 .\"A pointer to the input queue for devices which do not support polling
328 .\"(Initialized by driver.)
331 There are in addition a number of function pointers which the driver
332 must initialize to complete its interface with the generic interface
334 .Bl -ohang -offset indent
336 Pass a packet to an appropriate upper layer as determined
337 from the link-layer header of the packet.
338 This routine is to be called from an interrupt handler or
339 used to emulate reception of a packet on this interface.
340 A single function implementing
342 can be shared among multiple drivers utilizing the same link-layer
343 framing, e.g., Ethernet.
345 Output a packet on interface
347 or queue it on the output queue if the interface is already active.
349 Start queued output on an interface.
350 This function is exposed in
351 order to provide for some interface classes to share a
355 may only be called when the
360 does not literally mean that output is active, but rather that the
361 device's internal output queue is full.)
364 We are not even sure what it was ever for.
365 The prototype is faked.
367 Process interface-related
372 Preliminary processing is done by the generic routine
374 to check for appropriate privileges, locate the interface being
375 manipulated, and perform certain generic operations like twiddling
376 flags and flushing queues.
377 See the description of
379 below for more information.
381 Routine called by the generic code when the watchdog timer,
384 Usually this will reset the interface.
385 .\" .It Fn if_poll_recv
386 .\" .It Fn if_poll_xmit
387 .\" .It Fn if_poll_slowinput
388 .\" .It Fn if_poll_intren
393 Initialize and bring up the hardware,
394 e.g., reset the chip and the watchdog timer and enable the receiver unit.
395 Should mark the interface running,
397 .Dv ( IFF_RUNNING , ~IIF_OACTIVE ) .
398 .It Fn if_resolvemulti
399 Check the requested multicast group membership,
401 for validity, and if necessary compute a link-layer group which
402 corresponds to that address which is returned in
404 Returns zero on success, or an error code on failure.
406 .Ss "Interface Flags"
407 Interface flags are used for a number of different purposes.
409 flags simply indicate information about the type of interface and its
410 capabilities; others are dynamically manipulated to reflect the
411 current state of the interface.
412 Flags of the former kind are marked
414 in this table; the latter are marked
419 defines the bits which cannot be set by a user program using the
423 these are indicated by an asterisk
425 in the following listing.
427 .Bl -tag -width ".Dv IFF_POINTOPOINT" -offset indent -compact
430 The interface has been configured up by the user-level code.
433 The interface supports broadcast.
436 Used to enable/disable driver debugging code.
439 The interface is a loopback device.
440 .It Dv IFF_POINTOPOINT
442 The interface is point-to-point;
444 address is actually the address of the other end.
447 The interface has been configured and dynamic resources were
448 successfully allocated.
449 Probably only useful internal to the
453 Disable network address resolution on this interface.
456 This interface is in promiscuous mode.
459 This interface is in the permanently promiscuous mode (implies
463 This interface is in all-multicasts mode (used by multicast routers).
466 The interface's hardware output queue (if any) is full; output packets
470 The interface cannot hear its own transmissions.
475 Control flags for the link layer.
476 (Currently abused to select among
477 multiple physical layers on some devices.)
480 This interface supports multicast.
487 .Sx Interface Capabilities Flags
490 .Ss "Interface Capabilities Flags"
491 Interface capabilities are specialized features an interface may
493 These capabilities are very hardware-specific
494 and allow, when enabled,
495 to offload specific network processing to the interface
496 or to offer a particular feature for use by other kernel parts.
498 It should be stressed that a capability can be completely
499 uncontrolled (i.e., stay always enabled with no way to disable it)
500 or allow limited control over itself (e.g., depend on another
502 Such peculiarities are determined solely by the hardware and driver
503 of a particular interface.
504 Only the driver possesses
505 the knowledge on whether and how the interface capabilities
507 Consequently, capabilities flags in
509 should never be modified directly by kernel code other than
510 the interface driver.
515 is the dedicated means to attempt altering
518 Userland code shall use
521 The following capabilities are currently supported by the system:
522 .Bl -tag -width ".Dv IFCAP_VLAN_HWTAGGING" -offset indent
524 This interface can be a network console.
526 This interface supports
528 See below for details.
530 This interface can do checksum validation on receiving data.
531 Some interfaces do not have sufficient buffer storage to store frames
532 above a certain MTU-size completely.
533 The driver for the interface might disable hardware checksum validation
534 if the MTU is set above the hardcoded limit.
536 This interface can do checksum calculation on transmitting data.
539 .Pq Dv IFCAP_RXCSUM | IFCAP_TXCSUM .
540 .It Dv IFCAP_VLAN_HWTAGGING
541 This interface can do VLAN tagging on output and
542 demultiplex frames by their VLAN tag on input.
543 .It Dv IFCAP_VLAN_MTU
546 driver can operate over this interface in software tagging mode
547 without having to decrease MTU on
549 interfaces below 1500 bytes.
550 This implies the ability of this interface to cope with frames somewhat
551 longer than permitted by the Ethernet specification.
552 .It Dv IFCAP_JUMBO_MTU
553 This Ethernet interface can transmit and receive frames up to
557 The ability of advanced network interfaces to offload certain
558 computational tasks from the host CPU to the board is limited
560 Therefore a separate field associated with an interface
562 .Va ifnet.if_data.ifi_hwassist
564 keeps a detailed description of its enabled capabilities
565 specific to TCP/IP processing.
566 The TCP/IP module consults the field to see which tasks
569 packet by the interface.
570 The flags defined for that field are a superset of those for
571 .Va mbuf.m_pkthdr.csum_flags ,
573 .Bl -tag -width ".Dv CSUM_FRAGMENT" -offset indent
575 The interface will compute IP checksums.
577 The interface will compute TCP checksums.
579 The interface will compute UDP checksums.
581 The interface can compute a TCP or UDP checksum for a packet
582 fragmented by the host CPU.
583 Makes sense only along with
588 The interface will do the fragmentation of IP packets if necessary.
589 The host CPU does not need to care about MTU on this interface
590 as long as a packet to transmit through it is an IP one and it
591 does not exceed the size of the hardware buffer.
594 An interface notifies the TCP/IP module about the tasks
595 the former has performed on an
597 packet by setting the corresponding flags in the field
598 .Va mbuf.m_pkthdr.csum_flags
601 containing the packet.
606 The capability of a network interface to operate in
608 mode involves several flags in different
609 global variables and per-interface fields.
610 First, there is a system-wide
613 .Va kern.polling.enable ,
617 If that variable is set to non-zero,
619 will be used on those devices where it is enabled individually.
622 will not be used in the system.
623 Second, the capability flag
627 indicates support for
629 on the particular interface.
631 .Va if_capabilities ,
632 the same flag can be marked or cleared in the interface's
634 thus initiating switch of the interface to
638 The actual mode change will occur at an implementation-specific moment
639 in the future, e.g., during the next interrupt or
642 And finally, if the mode transition has been successful, the flag
644 is marked or cleared in the interface's
646 to indicate the current mode of the interface.
647 .Ss The Vt if_data Ss Structure
650 a subset of the interface information believed to be of interest to
651 management stations was segregated from the
653 structure and moved into its own
655 structure to facilitate its use by user programs.
656 The following elements of the
658 structure are initialized by the interface and are not expected to change
659 significantly over the course of normal operation:
660 .Bl -tag -width ".Va ifi_lastchange" -offset indent
663 The type of the interface, as defined in
665 and described below in the
666 .Sx "Interface Types"
670 Intended to represent a selection of physical layers on devices which
671 support more than one; never implemented.
674 Length of a link-layer address on this device, or zero if there are
676 Used to initialized the address length field in
678 structures referring to this interface.
681 Maximum length of any link-layer header which might be prepended by
682 the driver to a packet before transmission.
683 The generic code computes
684 the maximum over all interfaces and uses that value to influence the
687 to attempt to ensure that there is always
688 sufficient space to prepend a link-layer header without allocating an
693 .\" .It Va ifi_recvquota
695 .\" Number of packets the interface is permitted to receive at one time
696 .\" when in polled mode.
697 .\" .It Va ifi_xmitquota
699 .\" Number of packets the interface is permitted to queue for transmission
700 .\" at one time when in polled mode.
701 .\" There is some controversy over
702 .\" whether such a restriction makes any sense at all.
708 Allows some stabilization of the routing socket ABI in the face of
709 increases in the length of
713 The maximum transmission unit of the medium, exclusive of any
717 A dimensionless metric interpreted by a user-mode routing process.
720 The line rate of the interface, in bits per second.
723 A detailed interpretation of the capabilities
724 to offload computational tasks for
727 The interface driver must keep this field in accord with
732 The system uptime when interface was attached or the statistics
734 This is intended to be used to set the SNMP variable
735 .Va ifCounterDiscontinuityTime .
736 It may also be used to determine if two successive queries for an
737 interface of the same index have returned results for the same
741 The structure additionally contains generic statistics applicable to a
742 variety of different interface types (except as noted, all members are
745 .Bl -tag -width ".Va ifi_lastchange" -offset indent
746 .It Va ifi_link_state
748 The current link state of Ethernet interfaces.
750 .Sx Interface Link States
751 section for possible values.
753 Number of packets received.
755 Number of receive errors detected (e.g., FCS errors, DMA overruns,
757 More detailed breakdowns can often be had by way of a
760 Number of packets transmitted.
762 Number of output errors detected (e.g., late collisions, DMA overruns,
764 More detailed breakdowns can often be had by way of a
766 .It Va ifi_collisions
767 Total number of collisions detected on output for CSMA interfaces.
768 (This member is sometimes [ab]used by other types of interfaces for
769 other output error counts.)
771 Total traffic received, in bytes.
773 Total traffic transmitted, in bytes.
775 Number of packets received which were sent by link-layer multicast.
777 Number of packets sent by link-layer multicast.
779 Number of packets dropped on input.
782 Number of packets received for unknown network-layer protocol.
783 .\" .It Va ifi_recvtiming
784 .\" Amount of time, in microseconds, spent to receive an average packet on
789 .\" .It Va ifi_xmittiming
790 .\" Amount of time, in microseconds, spent to service a transmit-complete
791 .\" interrupt on this interface.
795 .It Va ifi_lastchange
796 .Pq Vt "struct timeval"
797 The time of the last administrative change to the interface (as required
804 defines symbolic constants for a number of different types of
808 .Bl -tag -offset indent -width ".Dv IFT_PROPVIRTUAL" -compact
810 none of the following
818 ISO 8802-5 Token Ring
824 Internet Point-to-Point Protocol
836 Asynchronous Transfer Mode
838 .Ss Interface Link States
839 The following link states are currently defined:
841 .Bl -tag -offset indent -width ".Dv LINK_STATE_UNKNOWN" -compact
842 .It Dv LINK_STATE_UNKNOWN
843 The link is in an invalid or unknown state.
844 .It Dv LINK_STATE_DOWN
849 .Ss The Vt ifaddr Ss Structure
850 Every interface is associated with a list
853 of addresses, rooted at the interface structure's
856 The first element in this list is always an
858 address representing the interface itself; multi-access network
859 drivers should complete this structure by filling in their link-layer
860 addresses after calling
862 Other members of the structure represent network-layer addresses which
863 have been configured by means of the
867 called on a socket of the appropriate protocol family.
868 The elements of this list consist of
871 Most protocols will declare their own protocol-specific
872 interface address structures, but all begin with a
874 which provides the most-commonly-needed functionality across all
876 Interface addresses are reference-counted.
881 .Bl -tag -width ".Va ifa_rtrequest" -offset indent
883 .Pq Vt "struct sockaddr *"
884 The local address of the interface.
886 .Pq Vt "struct sockaddr *"
887 The remote address of point-to-point interfaces, and the broadcast
888 address of broadcast interfaces.
893 .Pq Vt "struct sockaddr *"
894 The network mask for multi-access interfaces, and the confusion
895 generator for point-to-point interfaces.
897 .Pq Vt "struct ifnet *"
898 A link back to the interface structure.
900 .Pq Fn TAILQ_ENTRY ifaddr
902 glue for list of addresses on each interface.
907 Some of the flags which would be used for a route representing this
908 address in the route table.
914 A metric associated with this interface address, for the use of some
915 external routing protocol.
920 structures are gained manually, by incrementing the
923 References are released by calling either the
930 is a pointer to a function which receives callouts from the routing
933 to perform link-layer-specific actions upon requests to add, resolve,
937 argument indicates the request in question:
938 .Dv RTM_ADD , RTM_RESOLVE ,
943 argument is the route in question; the
945 argument is the specific destination being manipulated
948 or a null pointer otherwise.
950 The functions provided by the generic interface code can be divided
951 into two groups: those which manipulate interfaces, and those which
952 manipulate interface addresses.
953 In addition to these functions, there
954 may also be link-layer support routines which are used by a number of
955 drivers implementing a specific link layer over different hardware;
956 see the documentation for that link layer for more details.
957 .Ss The Vt ifmultiaddr Ss Structure
958 Every multicast-capable interface is associated with a list of
959 multicast group memberships, which indicate at a low level which
960 link-layer multicast addresses (if any) should be accepted, and at a
961 high level, in which network-layer multicast groups a user process has
964 The elements of the structure are as follows:
965 .Bl -tag -width ".Va ifma_refcount" -offset indent
967 .Pq Fn LIST_ENTRY ifmultiaddr
971 .Pq Vt "struct sockaddr *"
972 A pointer to the address which this record represents.
974 memberships for various address families are stored in arbitrary
977 .Pq Vt "struct sockaddr *"
978 A pointer to the link-layer multicast address, if any, to which the
979 network-layer multicast address in
981 is mapped, else a null pointer.
982 If this element is non-nil, this
983 membership also holds an invisible reference to another membership for
984 that link-layer address.
987 A reference count of requests for this particular membership.
989 .Ss Interface Manipulation Functions
990 .Bl -ohang -offset indent
992 Link the specified interface
994 into the list of network interfaces.
995 Also initialize the list of
996 addresses on that interface, and create a link-layer
998 structure to be the first element in that list.
1000 this address structure is saved in the global array
1008 flush its output queue, notify protocols of the transition,
1009 and generate a message from the
1015 as up, notify protocols of the transition,
1016 and generate a message from the
1020 Add or remove a promiscuous reference to
1024 is true, add a reference;
1025 if it is false, remove a reference.
1026 On reference count transitions
1027 from zero to one and one to zero, set the
1029 flag appropriately and call
1031 to set up the interface in the desired mode.
1035 but for the all-multicasts
1037 flag instead of the promiscuous flag.
1041 pointer for the interface named
1044 Process the ioctl request
1052 This is the main routine for handling all interface configuration
1053 requests from user mode.
1054 It is ordinarily only called from the socket-layer
1056 handler, and only for commands with class
1058 Any unrecognized commands will be passed down to socket
1061 further interpretation.
1062 The following commands are handled by
1065 .Bl -tag -width ".Dv OSIOCGIFNETMASK" -offset indent -compact
1068 Get interface configuration.
1069 (No call-down to driver.)
1072 Set the interface name.
1074 departure and arrival messages are sent so that
1075 routing code that relies on the interface name will update its interface
1077 Caller must have appropriate privilege.
1078 (No call-down to driver.)
1081 .It Dv SIOCGIFMETRIC
1084 Get interface capabilities, flags, metric, MTU, medium selection.
1085 (No call-down to driver.)
1088 Enable or disable interface capabilities.
1089 Caller must have appropriate privilege.
1090 Before a call to the driver-specific
1092 routine, the requested mask for enabled capabilities is checked
1093 against the mask of capabilities supported by the interface,
1094 .Va if_capabilities .
1095 Requesting to enable an unsupported capability is invalid.
1096 The rest is supposed to be done by the driver,
1097 which includes updating
1100 .Va if_data.ifi_hwassist
1104 Change interface flags.
1105 Caller must have appropriate privilege.
1112 is called as appropriate.
1115 are masked off, and the field
1117 in the interface structure is updated.
1120 routine is called to perform any setup
1123 .It Dv SIOCSIFMETRIC
1125 Change interface metric or medium.
1126 Caller must have appropriate privilege.
1129 Change interface MTU.
1130 Caller must have appropriate privilege.
1132 values less than 72 or greater than 65535 are considered invalid.
1135 routine is called to implement the change; it is responsible for any
1136 additional sanity checking and for actually modifying the MTU in the
1137 interface structure.
1141 Add or delete permanent multicast group memberships on the interface.
1142 Caller must have appropriate privilege.
1147 function is called to perform the operation; qq.v.
1149 .It Dv SIOCSIFDSTADDR
1151 .It Dv SIOCSIFBRDADDR
1152 .It Dv SIOCSIFNETMASK
1153 The socket's protocol control routine is called to implement the
1157 .It Dv OSIOCGIFDSTADDR
1158 .It Dv OSIOCGIFBRDADDR
1159 .It Dv OSIOCGIFNETMASK
1160 The socket's protocol control routine is called to implement the
1164 structures are converted into old-style (no
1178 .Ss "Interface Address Functions"
1179 Several functions exist to look up an interface address structure
1182 returns an interface address with either a local address or a
1183 broadcast address precisely matching the parameter
1185 .Fn ifa_ifwithdstaddr
1186 returns an interface address for a point-to-point interface whose
1193 returns the most specific interface address which matches the
1196 subject to its configured netmask, or a point-to-point interface
1197 address whose remote address is
1201 .Fn ifaof_ifpforaddr
1202 returns the most specific address configured on interface
1204 which matches address
1206 subject to its configured netmask.
1208 point-to-point, only an interface address whose remote address is
1213 All of these functions return a null pointer if no such address can be
1215 .Ss "Interface Multicast Address Functions"
1220 .Fn ifmaof_ifpforaddr
1221 functions provide support for requesting and relinquishing multicast
1222 group memberships, and for querying an interface's membership list,
1226 function takes a pointer to an interface,
1228 and a generic address,
1230 It also takes a pointer to a
1231 .Vt "struct ifmultiaddr *"
1232 which is filled in on successful return with the address of the
1233 group membership control block.
1236 function performs the following four-step process:
1237 .Bl -enum -offset indent
1239 Call the interface's
1241 entry point to determine the link-layer address, if any, corresponding
1242 to this membership request, and also to give the link layer an
1243 opportunity to veto this membership request should it so desire.
1245 Check the interface's group membership list for a pre-existing
1246 membership for this group.
1247 If one is not found, allocate a new one;
1248 if one is, increment its reference count.
1252 routine returned a link-layer address corresponding to the group,
1253 repeat the previous step for that address as well.
1255 If the interface's multicast address filter needs to be changed
1256 because a new membership was added, call the interface's
1263 to request that it do so.
1268 function, given an interface
1272 reverses this process.
1273 Both functions return zero on success, or a
1274 standard error number on failure.
1277 .Fn ifmaof_ifpforaddr
1278 function examines the membership list of interface
1280 for an address matching
1282 and returns a pointer to that
1283 .Vt "struct ifmultiaddr"
1284 if one is found, else it returns a null pointer.
1301 .%A W. Richard Stevens
1302 .%B TCP/IP Illustrated
1304 .%O Addison-Wesley, ISBN 0-201-63354-X
1307 This manual page was written by
1308 .An Garrett A. Wollman .