if_tcp(7P)

NAME

DESCRIPTION

A network interface is a device for sending and receiving packets on
a network. It is usually a hardware device, although it can be implemented
in software. Network interfaces used by the Internet Protocol (IPv4 or IPv6)
must be STREAMS devices conforming to the Datalink Provider Interface (DLPI). See dlpi(7P).

APPLICATION PROGRAMMING INTERFACE

An interface becomes available
to IP when it is opened and the IP module is pushed onto the stream with the I_PUSHioctl(2)
command (see streamio(7I)),
and the SIOCSLIFNAMEioctl(2) is issued to specify the name of the
interface and whether it is IPv4 or IPv6. This may be initiated by the kernel
at boot time or by a user program after the system is running. Each interface
must be assigned an IP address with the SIOCSLIFADDRioctl() before
it can be used. On interfaces where the network-to-link layer address mapping
is static, only the network number is taken from the ioctl()
request; the remainder is found in a hardware specific manner. On interfaces
which provide dynamic network-to-link layer address mapping facilities (for
example, 10Mb/s Ethernets using arp(7P)), the entire
address specified in the ioctl() is used. A routing table
entry for destinations on the network of the interface is installed automatically
when an interface's address is set.

IOCTLS

The following ioctl() calls may be used to manipulate IP network interfaces. Unless specified otherwise,
the request takes an lifreq structure as its parameter.
This structure has the form:

Set interface address. Following the address
assignment, the “initialization” routine for the interface is
called.

SIOCGLIFADDR

Get interface address.

SIOCSLIFDSTADDR

Set point to point address for interface.

SIOCGLIFDSTADDR

Get point to point address for interface.

SIOCSLIFFLAGS

Set interface flags field. If the interface is marked
down, any processes currently routing packets through the interface are notified.

SIOCGLIFFLAGS

Get interface flags.

SIOCGLIFCONF

Get interface configuration list. This request takes
an lifconf structure (see below) as a value-result parameter.
The lifc_len field should be initially set to the size
of the buffer pointed to by lifc_buf. On return it will
contain the length, in bytes, of the configuration list. The lifc_family field should be set to AF_UNSPEC to retrieve
both AF_INET and AF_INET6 interfaces.
The lifc_flags field should be initially set to zero.

SIOCGLIFNUM

Get number of interfaces. This request returns an integer
which is the number of interface descriptions (struct lifreq)
that will be returned by the SIOCGLIFCONF ioctl; that is, it gives an indication of how large lifc_len has to be. This request takes an lifnum structure
(see below) as a value-result parameter. The lifn_family
field should be set to AF_UNSPEC to count both AF_INET and AF_INET6 interfaces. The lifn_flags field should be initially set to zero.

SIOCSLIFMTU

Set the maximum transmission unit (MTU) size for interface.
Place the result of this request in lifru_mtu field. The MTU can not exceed the physical MTU limitation (which is reported in the DLPI DL_INFO_ACK message).

SIOCGLIFMTU

Get the maximum transmission unit size for interface.
Place the result of this request in ifru_mtu field.

SIOCSLIFMETRIC

Set the metric associated with the interface. The
metric is used by routine daemons such as in.routed(1M).

SIOCGLIFMETRIC

Get the metric associated with the interface.

SIOCGLIFMUXID

Get the ip and arpmuxid associated with the interface.

SIOCSLIFMUXID

Set the ip and arpmuxid associated with the interface.

SIOCGLIFINDEX

Get the interface index associated with the interface.

SIOCSLIFINDEX

Set the interface index associated with the interface.

SIOCLIFADDIF

Add a new logical interface on a physical interface
using an unused logical unit number.

SIOCLIFREMOVEIF

Remove a logical interface by specifying its IP address or logical interface name.

SIOCSLIFTOKEN

Set the address token used to form IPv6 link-local
addresses and for stateless address autoconfiguration.

SIOCGLIFTOKEN

Get the address token used to form IPv6 link-local
addresses and for stateless address autoconfiguration.

SIOCSLIFSUBNET

Set the subnet prefix associated with the interface.

SIOCGLIFSUBNET

Get the subnet prefix associated with the interface.

SIOCSLIFLNKINFO

Set link specific parameters for the interface.

SIOCGLIFLNKINFO

Get link specific parameters for the interface.

SIOCLIFDELND

Delete a neighbor cache entry for IPv6.

SIOCLIFGETND

Get a neighbor cache entry for IPv6.

SIOCLIFSETND

Set a neighbor cache entry for IPv6.

SIOCTMYADDR

Test if the address is assigned to this node. This
request takes an sioc_addrreq structure (see below) as
a value-result parameter. The sa_addr field should be set
to the address to test. The sa_res field will contain a
non-zero value if the address is assigned to this node.

SIOCTONLINK

Test if the address is directly reachable, for example,
that it can be reached without going through a router. This request takes
an sioc_addrreq structure (see below) as a value-result
parameter. The sa_addr field should be set to the address
to test. The sa_res field will contain a non-zero value
if the address is onlink.

SIOCTMYSITE

Test if the address is part of the same site as this
node. This request takes an sioc_addrreq structure (see
below) as a value-result parameter. The sa_addr field should
be set to the address to test. The sa_res field will contain
a non-zero value if the address is in the same site.

The following ioctl() calls are maintained for compatibility
but only apply to IPv4 network interfaces, since the data structures are to
small to hold an IPv6 address. Unless specified otherwise, the request takes
an ifreq structure as its parameter. This structure
has the form:

Set interface address. Following the address
assignment, the “initialization” routine for the interface is
called.

SIOCGIFADDR

Get interface address.

SIOCSIFDSTADDR

Set point to point address for interface.

SIOCGIFDSTADDR

Get point to point address for interface.

SIOCSIFFLAGS

Set interface flags field. If the interface is marked
down, any processes currently routing packets through the interface are notified.

SIOCGIFFLAGS

Get interface flags.

SIOCGIFCONF

Get interface configuration list. This request takes
an ifconf structure (see below) as a value-result
parameter. The ifc_len field should be initially set to
the size of the buffer pointed to by ifc_buf. On return
it will contain the length, in bytes, of the configuration list.

SIOCGIFNUM

Get number of interfaces. This request returns an integer
which is the number of interface descriptions (struct ifreq)
that will be returned by the SIOCGIFCONF
ioctl; that is, it gives an indication of how large ifc_len
has to be.

SIOCSIFMTU

Set the maximum transmission unit (MTU)
size for interface. Place the result of this request in ifru_metric field. The MTU has to be smaller
than physical MTU limitation (which is reported
in the DLPI DL_INFO_ACK message).

SIOCGIFMTU

Get the maximum transmission unit size for interface.
Place the result of this request in ifru_metric field.

SIOCSIFMETRIC

Set the metric associated with the interface. The
metric is used by routine daemons such as in.routed(1M).

ERRORS

EPERM

The effective user id of the calling process in not superuser.

ENXIO

The lifr_name member of the lifreq structure contains an invalid value.

EBADADDR

Wrong address family or malformed address.

EBUSY

For SIOCSLIFFLAGS, this error is returned when the
order of bringing the primary/physical interface (for example, le0) and a secondary/logical interface associated with the same
physical interface (for example, le0:1) up or down is violated.
The physical interface must be configured up first and cannot be configured
down until all the corresponding logical interfaces have been configured
down.

EINVAL

For SIOCGLIFCONF, this error is returned when the
size of the buffer pointed to by the lifc_buf member of
the lifconf structure is too small.

For SIOCSLIFMTU, this error is returned when the
requested MTU size is invalid. This error
indicates the MTU size is greater than the MTU size supported by the DLPI provider or less than 68 (for IPv4 ) or
less than 1200 (for IPv6 ).

EEXIST

For SIOCLIFADDIF, this error is returned if the lifr_name member in the lifreq structure has
a logical interface name and the specified logical interface already exists.