2 .\" Don't change the first line, it tells man that tbl is needed.
3 .\" This man page is Copyright (C) 1999 Andi Kleen <ak@muc.de>.
4 .\" Permission is granted to distribute possibly modified copies
5 .\" of this page provided the header is included verbatim,
6 .\" and in case of nontrivial modification author and date
7 .\" of the modification is added to the header.
8 .\" $Id: netdevice.7,v 1.10 2000/08/17 10:09:54 ak Exp $
10 .\" Modified, 2004-11-25, mtk, formatting and a few wording fixes
12 .TH NETDEVICE 7 1999-05-02 "Linux Man Page" "Linux Programmer's Manual"
14 netdevice \- Low level access to Linux network devices
16 .B "#include <sys/ioctl.h>"
18 .B "#include <net/if.h>"
20 This man page describes the sockets interface which is used to configure
23 Linux supports some standard ioctls to configure network devices.
24 They can be used on any socket's file descriptor regardless of the
32 char ifr_name[IFNAMSIZ]; /* Interface name */
34 struct sockaddr ifr_addr;
35 struct sockaddr ifr_dstaddr;
36 struct sockaddr ifr_broadaddr;
37 struct sockaddr ifr_netmask;
38 struct sockaddr ifr_hwaddr;
44 char ifr_slave[IFNAMSIZ];
45 char ifr_newname[IFNAMSIZ];
51 int ifc_len; /* size of buffer */
53 char * ifc_buf; /* buffer address */
54 struct ifreq * ifc_req; /* array of structures */
59 Normally, the user specifies which device to affect by setting
61 to the name of the interface.
62 All other members of the structure may
65 If an ioctl is marked as privileged then using it requires an effective
69 If this is not the case
76 return the name of the interface in
78 This is the only ioctl which returns its result in
82 Retrieve the interface index of the interface into
85 .BR SIOCGIFFLAGS ", " SIOCSIFFLAGS
86 Get or set the active flag word of the device.
88 contains a bitmask of the following values:
94 IFF_UP:Interface is running.
95 IFF_BROADCAST:Valid broadcast address set.
96 IFF_DEBUG:Internal debugging flag.
97 IFF_LOOPBACK:Interface is a loopback interface.
98 IFF_POINTOPOINT:Interface is a point-to-point link.
99 IFF_RUNNING:Resources allocated.
100 IFF_NOARP:No arp protocol, L2 destination address not set.
101 IFF_PROMISC:Interface is in promiscuous mode.
102 IFF_NOTRAILERS:Avoid use of trailers.
103 IFF_ALLMULTI:Receive all multicast packets.
104 IFF_MASTER:Master of a load balancing bundle.
105 IFF_SLAVE:Slave of a load balancing bundle.
106 IFF_MULTICAST:Supports multicast
107 IFF_PORTSEL:Is able to select media type via ifmap.
108 IFF_AUTOMEDIA:Auto media selection active.
110 The addresses are lost when the interface goes down.
113 Setting the active flag word is a privileged operation, but any
116 .BR SIOCGIFMETRIC ", " SIOCSIFMETRIC
117 Get or set the metric of the device using
119 This is currently not implemented; it sets
121 to 0 if you attempt to read it and returns
123 if you attempt to set it.
125 .BR SIOCGIFMTU ", " SIOCSIFMTU
126 Get or set the MTU (Maximum Transfer Unit) of a device using
128 Setting the MTU is a privileged operation.
130 too small values may cause kernel crashes.
132 .BR SIOCGIFHWADDR ", " SIOCSIFHWADDR
133 Get or set the hardware address of a device using
135 The hardware address is specified in a struct
138 contains the ARPHRD_* device type,
140 the L2 hardware address starting from byte 0.
141 Setting the hardware address is a privileged operation.
143 .B SIOCSIFHWBROADCAST
144 Set the hardware broadcast address of a device from
146 This is a privileged operation.
148 .BR SIOCGIFMAP ", " SIOCSIFMAP
149 Get or set the interface's hardware parameters using
151 Setting the parameters is a privileged operation.
155 unsigned long mem_start;
156 unsigned long mem_end;
157 unsigned short base_addr;
164 The interpretation of the ifmap structure depends on the device driver
165 and the architecture.
167 .BR SIOCADDMULTI ", " SIOCDELMULTI
168 Add an address to or delete an address from the device's link layer
169 multicast filters using
171 These are privileged operations.
176 .BR SIOCGIFTXQLEN ", " SIOCSIFTXQLEN
177 Get or set the transmit queue length of a device using
179 Setting the transmit queue length is a privileged operation.
182 Changes the name of the interface specified in
186 This is a privileged operation.
187 It is only allowed when the interface
191 Return a list of interface (transport layer) addresses.
193 means only addresses of the AF_INET (IPv4) family for compatibility.
196 structure as argument to the ioctl.
197 It contains a pointer to an array of
201 and its length in bytes in
203 The kernel fills the ifreqs with all current L3 interface addresses that
206 contains the interface name (eth0:1 etc.),
209 The kernel returns with the actual length in
213 is equal to the original length the buffer probably has overflowed
214 and you should retry with a bigger buffer to get all addresses.
215 When no error occurs the ioctl returns 0;
217 Overflow is not an error.
218 .\" FIXME Slaving isn't supported in 2.2
221 .\" .BR SIOCGIFSLAVE ", " SIOCSIFSLAVE
222 .\" Get or set the slave device using
224 .\" Setting the slave device is a privileged operation.
226 .\" FIXME add amateur radio stuff.
228 Most protocols support their own ioctls to configure protocol specific
230 See the protocol man pages for a description.
231 For configuring IP addresses see
234 In addition some devices support private ioctls.
235 These are not described here.
239 is IP specific and belongs in
242 The names of interfaces with no addresses or that don't have the
244 flag set can be found via
247 Local IPv6 IP addresses can be found via /proc/net or via
250 glibc 2.1 is missing the
253 Add the following to your program as a workaround:
258 #define ifr_newname ifr_ifru.ifru_slave
263 .BR capabilities (7),