Performs network-related control operations.
The socket ioctl commands does various network-related control. The fd argument is a socket descriptor. For non-socket descriptors, the functions that are performed by this call are unspecified.
The cmd argument and an optional third argument (with varying type) are passed to and interpreted by the socket ioctl function to perform an appropriate control operation that is specified by the user.
Item | Description |
---|---|
fd | Open file descriptor that refers to a socket created by using socket or accept calls. |
cmd | Selects the control function to be performed. |
.../* arg */ | Represents information that is required for the requested function. The type of arg depends on the particular control request, but it is either an integer or a pointer to a socket-specific data structure. |
ioctl command | Description |
---|---|
SIOCATMARK | Determines whether the read pointer is pointing
to the logical mark in the DataStream. The logical mark indicates
the point at which the out-of-band data is sent.
If atmark is
set to 1 on return, the read pointer points to the
mark and the next read returns data after the mark. If atmark is
set to 0 on return (assuming out-of-band data is
present on the DataStream), the next read returns data that is sent
before the out-of-band mark. Note: The out-of-band data is a logically
independent data channel that is delivered to the user independently
of normal data; in addition, a signal is also sent because of the
immediate attention required. Ctrl-C characters are an example.
|
SIOCSPGRP SIOCGPGRP |
SIOCSPGRP sets the process group information
for a socket. SIOCGPGRP gets the process group ID associated with
a socket.
|
ioctl command | Description |
---|---|
SIOCADDRT SIOCDELRT |
SIOCADDRT adds a route entry in the routing
table. SIOCDELRT deletes a route entry from the routing table.
|
SIOUPDROUTE | Updates the routing table by using the information
that is passed in the ifreq structure.
Note: SIOUPDROUTE
is available beginning with AIX® 5100-002
(maintenance level 2) and later.
|
ioctl command | Description |
---|---|
SIOCSARP SIOCDARP SIOCGARP |
SIOCSARP adds or modifies an ARP entry in the
ARP table. SIOCDARP deletes an ARP entry from the ARP table. SIOCGARP
gets an ARP entry from the ARP table.
|
ioctl command | Description |
---|---|
SIOCSNETOPT SIOCGNETOPT SIOCDNETOPT SIOCGNETOPT1 |
SIOCSNETOPT sets the value of a network option.
SIOCGNETOPT gets the value of a network option. SIOCDNETOPT sets the
default values of a network option.
SIOCGNETOPT1
gets the current value, default value, and the range of a network
option.
The network
option information is stored in the optreq1 structure
upon return The optreq and optreq1 structures
are defined in net/netopt.h. Note: SIOCGNETOPT1
is available beginning with AIX 5.2 and
later.
|
SIOCGNMTUS SIOCGETMTUS SIOCADDMTU SIOCDELMTU |
SIOCGNMTUS gets the number of MTUs maintained
in the list of common MTUs. SIOCADDMTU adds an MTU in the list of
common MTUs. SIOCDELMTU deletes an MTU from the list of common MTUs.
SIOCGETMTUS gets the MTUs maintained in the list
of common MTUs.
The get_mtus structure
is defined in netinet/in.h. |
ioctl command | Description |
---|---|
SIOCSIFADDR SIOCAIFADDR SIOCDIFADDR SIOCGIFADDR |
SIOCSIFADDR sets an interface address. SIOCAIFADDR
adds or changes an interface address. SIOCDIFADDR deletes an interface
address. The interface address is specified in the ifr.ifr_addr field.
SIOCGIFADDR gets an interface address. The address is returned in
the ifr.ifr_addr field.
|
SIOCGIFADDRS | Gets the list of addresses that are associated
with an interface.
The
interface name is passed in the ifaddrsp->ifr_name
field. The addresses that are associated with the interface
are stored in ifaddrsp->ifrasu array on return. Note: The ifreqaddrs structure
contains space for storing only one sockaddr_in/sockaddr_in6 structure
(array of one sockaddr_in/sockaddr_in6 element).
To get n addresses associated with an interface,
the caller of the ioctl command must allocate space for {sizeof
(struct ifreqaddrs) + (n * sizeof (struct sockaddr_in)} bytes.
Note: SIOCGIFADDRS
is available beginning with AIX 5.3 and
later.
|
SIOCSIFDSTADDR SIOCGIFDSTADDR |
SIOCSIFDSTADDR sets the point-to-point address
for an interface that is specified in the ifr.ifr_dstaddr field.
SIOCGIFDSTADDR gets the point-to-point address that is associated
with an interface. The address is stored in the ifr.ifr_dstaddr field
on return.
|
SIOCSIFNETMASK SIOCGIFNETMASK |
SIOCSIFNETMASK sets the interface netmask that
is specified in the ifr.ifr_addr field.
SIOCGIFNETMASK gets the interface netmask.
|
SIOCSIFBRDADDR SIOCGIFBRDADDR |
SIOCSIFBRDADDR sets the interface broadcast
address that is specified in the ifr.ifr_broadaddr field.
SIOCGIFBRDADDR gets the interface broadcast address. The broadcast
address is placed in the ifr.ifr_broadaddr field.
|
SIOCGSIZIFCONF | Gets the size of memory that is required to
get configuration information for all interfaces returned by SIOCGIFCONF.
|
SIOCGIFCONF | Returns configuration information for all the
interfaces that are configured on the system.
The configuration
information is returned in a list of ifreq structures
pointed to by the ifc.ifc_req field, with
one ifreq structure per interface. Note: The
caller of the ioctl command must allocate sufficient space to store
the configuration information, returned as a list of ifreq structures
for all of the interfaces that are configured on the system. For example,
if n interfaces are configured on the system, ifc.ifc_req must
point to {n * sizeof (struct ifreq)} bytes
of space allocated.
Note: Alternatively, the SIOCGSIZIFCONF
ioctl command can be used for this purpose.
|
SIOCSIFFLAGS SIOCGIFFLAGS |
SIOCSIFFLAGS sets the interface flags. SIOCGIFFLAGS
gets the interface flags.
Refer to /usr/include/net/if.h for
the interface flags, denoted by IFF_xxx. Note: The IFF_BROADCAST, IFF_POINTTOPOINT, IFF_SIMPLEX, IFF_RUNNING, IFF_OACTIVE,
and IFF_MULTICAST flags cannot be changed
by using ioctl.
|
SIOCSIFMETRIC SIOCGIFMETRIC |
SIOCSIFMETRIC sets the interface metric that
is specified in the ifr.ifr_metric field.
SIOCGIFMETRIC gets the interface metric. The interface metric is placed
in the ifr.ifr_metric field on return.
|
SIOCSIFSUBCHAN SIOCGIFSUBCHAN |
SIOCSIFSUBCHAN sets the subchannel address that
is specified in the ifr.ifr_flags field.
SIOCGIFSUBCHAN gets the subchannel address in the ifr.ifr_flags field.
|
SIOCSIFOPTIONS SIOCGIFOPTIONS |
SIOCSIFOPTIONS sets the interface options. SIOCGIFOPTIONS
gets the interface options.
The interface
options are stored in the ifr_flags field
of the ifreq structure. Refer to /usr/include/net/if.h file
for the list of interface options that are denoted by IFO_xxx. |
ioctl command | Description |
---|---|
SIOCADDMULTI SIOCDELMULTI |
SIOCADDMULTI adds an address to the list of
multicast addresses for an interface. SIOCDELMULTI deletes a multicast
address from the list of multicast addresses for an interface.
|
SIOCGETVIFCNT | Gets the packet count information for a virtual
interface. The information is specified in the sioc_vif_req structure.
|
SIOCGETSGCNT | Gets the packet count information for the source
group specified. The information is stored in the sioc_sg_req structure
on return.
|
SIOCSIFMTU SIOCGIFMTU |
SIOCSIFMTU sets the interface maximum transmission
unit (MTU). SIOCGIFMTU gets the interface MTU.
The MTU value
is stored in ifr.ifr_mtu field. Note: The
range of valid values for MTU varies for an interface and is dependent
on the interface type.
|
SIOCIFATTACH SIOCIFDETACH |
SIOCIFATTACH attaches an interface. This initializes
and adds an interface in the network interface list. SIOCIFDETACH
detaches an interface broadcast address. This removes the interface
from the network interface list. The interface name is specified in
the ifr.ifr_name field.
|
SIOCSIFGIDLIST SIOCGIFGIDLIST |
SIOCSIFGIDLIST adds or deletes the list of group
IDs specified in the ifrg.ifrg_gidlist field
to the gidlist interface. The interface
name is specified in the ifrg.ifrg_name field.
An operation code, ADD_GRP/DEL_GRP, specified in
the ifrg.ifrg_gidlist field indicates whether
the specified list of group IDs must be added to or deleted from the gidlist interface.
SIOCGIFGIDLIST gets the list of group IDs associated with an interface.
The group IDs are placed in the ifrg.ifrg_gidlist field
on return.
|
SIOCIF_ATM_UBR SIOCIF_ATM_SNMPARP SIOCIF_ATM_DUMPARP SIOCIF_ATM_IDLE SIOCIF_ATM_SVC SIOCIF_ATM_DARP SIOCIF_ATM_GARP SIOCIF_ATM_SARP |
SIOCIF_ATM_UBR sets the UBR rate for an ATM interface. SIOCIF_ATM_SNMPARP gets the SNMP ATM ARP entries. SIOCIF_ATM_DUMPARP gets the specified number of ATM ARP entries. SIOCIF_ATM_DARP deletes an ATM ARP entry from the ARP table. SIOCIF_ATM_GARP gets an ATM ARP entry to the ARP table. SIOCIF_ATM_SARP adds an ATM ARP entry. The ARP information is specified in the atm_arpreq structure. SIOCIF_ATM_SVC specifies whether this interface supports Permanent Virtual Circuit (PVC) and Switched Virtual Circuit (SVC) types of virtual connections. It also specifies whether this interface is an ARP client or an ARP server for this Logical IP Subnetwork (LIS) based on the flag that is set in the ifatm_svc_arg structure. SIOCIF_ATM_IDLE specifies the idle time limit on the interface. |
SIOCSISNO SIOCGISNO |
SIOCSISNO sets interface specific network options
for an interface. SIOCGISNO gets interface specific network options
that are associated with an interface.
|
SIOCGIFBAUDRATE | Gets the value of the interface baud rate in
the ifr_baudrate field.
The baud rate
is stored in the ifr.ifr_baudrate field. |
SIOCADDIFVIPA SIOCDELIFVIPA SIOCLISTIFVIPA |
SIOCADDIFVIPA associates the specified list
of interfaces pointed to by ifrv.ifrv_ifname with
the virtual interface specified by ifrv.ifrv_name.
This operation causes the source address for all outgoing packets
on these interfaces to be set to the virtual interface address. SIOCDELIFVIPA
removes the list of specified interfaces that are pointed by ifrv.ifrv_ifname and
associated with the virtual interface specified by ifrv.ifrv_name,
by using SIOCADDIFVIPA. SIOCLISTIFVIPA lists all the interfaces that
are associated with the virtual interface specified by ifrv.ifrv_name.
The virtual
interface information is stored in the ifvireq structure.
Note: These flags operate on a virtual interface only. Also, these
flags are available beginning with AIX 5.2 and later.
|
SIOCSIFADDR6 | Set or Add an IPv6 address.
|
SIOCGIFADDR6 | Gets an IPv6 address.
|
SIOCSIFDSTADDR6 | Set the destination (point-to-point) address
for a IPv6 address.
|
SIOCGIFDSTADDR6 | Get the destination (point-to-point) address
for a IPv6 address.
|
SIOCSIFNETMASK6 | Set the netmask for an IPv6 address.
|
SIOCGIFNETMASK6 | Get the netmask for an IPv6 address.
|
SIOCDIFADDR6 | Delete an IPv6 address.
|
SIOCFIFADDR6 | Put an IPv6 address at the beginning of the
address list.
|
SIOCAIFADDR6 | Add or change an IPv6 alias address.
|
SIOCADDANY6 | Add an IPv6 anycast address.
|
SIOCDELANY6 | Delete an IPv6 anycast address.
|
SIOCSIFZONE6 | Set the IPv6 zone ID of an interface at a particular
address scope.
|
SIOCGIFZONE6 | Get the IPv6 scope zone IDs of an interface.
|
SIOCSIFADDRORI6 | Set the configuration origin for an IPv6 address.
|
SIOCAIFADDR6T | Add or change an IPv6 alias address and type.
|
SIOCGIFADDR6T | Get the type of an IPv6 address.
|
SIOCSIFADDRSTATE6 | Change the state of an IPv6 address.
|
SIOCGIFADDRSTATE6 | Get the state of an IPv6 address.
|
SIOCGSRCFILTER6 | Get the IPv6 multicast group source filter for
an interface.
|
SIOCACLADDR6 | Add an IPv6 cluster alias address.
|
SIOCDCLADDR6 | Delete an IPv6 cluster address.
|
SIOCSIFADDRFLAG6 | Set address source flag for an IPv6 address.
|
SIOCGIFADDRFLAG6 | Get address source flag for an IPv6 address.
|
Upon successful completion, ioctl returns 0. Otherwise, it returns -1 and sets errno to indicate the error.
Item | Description |
---|---|
EBADF | The file descriptor fd is not a valid open socket file descriptor. |
EINTR | A signal was caught during ioctl operation. |
EINVAL | An invalid command or argument was specified. |
Item | Description |
---|---|
EACCES | Permission that is denied for the specified operation. |
EADDRNOTAVAIL | Specified address not available for interface. |
EAFNOSUPPORT | Operation that is not supported on sockets. |
EBUSY | Resource is busy. |
EEXIST | An entry or file exists. |
EFAULT | Argument references an inaccessible memory area. |
EIO | Input/Output error. |
ENETUNREACH | Gateway unreachable. |
ENOBUFS | Routing table overflow. |
ENOCONNECT | No connection. |
ENOMEM | Not enough memory available. |
ENOTCONN | The operation is only defined on a connected socket, but the socket was not connected. |
ENXIO | Device does not exist. |
ESRCH | No such process. |