Manual Pages for Linux CentOS command on man netdevice
MyWebUniversity

Manual Pages for Linux CentOS command on man netdevice

NETDEVICE(7) Linux Programmer's Manual NETDEVICE(7)

NAME

netdevice - low-level access to Linux network devices SYNOPSIS

#include

#include DESCRIPTION This man page describes the sockets interface which is used to config‐ ure network devices. Linux supports some standard ioctls to configure network devices. They can be used on any socket's file descriptor regardless of the family or type. They pass an ifreq structure: struct ifreq { char ifrname[IFNAMSIZ]; /* Interface name */ union { struct sockaddr ifraddr; struct sockaddr ifrdstaddr; struct sockaddr ifrbroadaddr; struct sockaddr ifrnetmask; struct sockaddr ifrhwaddr; short ifrflags; int ifrifindex; int ifrmetric; int ifrmtu; struct ifmap ifrmap; char ifrslave[IFNAMSIZ]; char ifrnewname[IFNAMSIZ]; char *ifrdata; }; }; struct ifconf { int ifclen; /* size of buffer */ union { char *ifcbuf; /* buffer address */ struct ifreq *ifcreq; /* array of structures */ }; }; Normally, the user specifies which device to affect by setting ifrname to the name of the interface. All other members of the structure may share memory. Ioctls If an ioctl is marked as privileged then using it requires an effective user ID of 0 or the CAPNETADMIN capability. If this is not the case EPERM will be returned. SIOCGIFNAME Given the ifrifindex, return the name of the interface in ifrname. This is the only ioctl which returns its result in ifrname. SIOCGIFINDEX Retrieve the interface index of the interface into ifrifindex. SIOCGIFFLAGS, SIOCSIFFLAGS Get or set the active flag word of the device. ifrflags con‐ tains a bit mask of the following values: Device flags IFFUP Interface is running. IFFBROADCAST Valid broadcast address set. IFFDEBUG Internal debugging flag. IFFLOOPBACK Interface is a loopback interface.

IFFPOINTOPOINT Interface is a point-to-point link. IFFRUNNING Resources allocated. IFFNOARP No arp protocol, L2 destination address not set. IFFPROMISC Interface is in promiscuous mode. IFFNOTRAILERS Avoid use of trailers. IFFALLMULTI Receive all multicast packets. IFFMASTER Master of a load balancing bundle. IFFSLAVE Slave of a load balancing bundle. IFFMULTICAST Supports multicast IFFPORTSEL Is able to select media type via ifmap. IFFAUTOMEDIA Auto media selection active. IFFDYNAMIC The addresses are lost when the interface goes down. IFFLOWERUP Driver signals L1 up (since Linux 2.6.17) IFFDORMANT Driver signals dormant (since Linux 2.6.17) IFFECHO Echo sent packets (since Linux 2.6.25) Setting the active flag word is a privileged operation, but any process may read it. SIOCGIFPFLAGS, SIOCSIFPFLAGS Get or set extended (private) flags for the device. ifrflags contains a bit mask of the following values: Private flags IFF8021QVLAN Interface is 802.1Q VLAN device. IFFEBRIDGE Interface is Ethernet bridging device. IFFSLAVEINACTIVE Interface is inactive bonding slave. IFFMASTER8023AD Interface is 802.3ad bonding master.

IFFMASTERALB Interface is balanced-alb bonding master. IFFBONDING Interface is a bonding master or slave. IFFSLAVENEEDARP Interface needs ARPs for validation. IFFISATAP Interface is RFC4214 ISATAP interface. Setting the extended (private) interface flags is a privileged operation. SIOCGIFADDR, SIOCSIFADDR Get or set the address of the device using ifraddr. Setting the interface address is a privileged operation. For compati‐ bility, only AFINET addresses are accepted or returned. SIOCGIFDSTADDR, SIOCSIFDSTADDR

Get or set the destination address of a point-to-point device using ifrdstaddr. For compatibility, only AFINET addresses are accepted or returned. Setting the destination address is a privileged operation. SIOCGIFBRDADDR, SIOCSIFBRDADDR Get or set the broadcast address for a device using ifrbrdaddr. For compatibility, only AFINET addresses are accepted or returned. Setting the broadcast address is a privileged opera‐ tion. SIOCGIFNETMASK, SIOCSIFNETMASK Get or set the network mask for a device using ifrnetmask. For compatibility, only AFINET addresses are accepted or returned. Setting the network mask is a privileged operation. SIOCGIFMETRIC, SIOCSIFMETRIC Get or set the metric of the device using ifrmetric. This is currently not implemented; it sets ifrmetric to 0 if you attempt to read it and returns EOPNOTSUPP if you attempt to set it. SIOCGIFMTU, SIOCSIFMTU Get or set the MTU (Maximum Transfer Unit) of a device using ifrmtu. Setting the MTU is a privileged operation. Setting the MTU to too small values may cause kernel crashes. SIOCGIFHWADDR, SIOCSIFHWADDR Get or set the hardware address of a device using ifrhwaddr. The hardware address is specified in a struct sockaddr. safam‐ ily contains the ARPHRD* device type, sadata the L2 hardware address starting from byte 0. Setting the hardware address is a privileged operation. SIOCSIFHWBROADCAST Set the hardware broadcast address of a device from ifrhwaddr. This is a privileged operation. SIOCGIFMAP, SIOCSIFMAP Get or set the interface's hardware parameters using ifrmap. Setting the parameters is a privileged operation. struct ifmap { unsigned long memstart; unsigned long memend; unsigned short baseaddr; unsigned char irq; unsigned char dma; unsigned char port; }; The interpretation of the ifmap structure depends on the device driver and the architecture. SIOCADDMULTI, SIOCDELMULTI Add an address to or delete an address from the device's link layer multicast filters using ifrhwaddr. These are privileged operations. See also packet(7) for an alternative. SIOCGIFTXQLEN, SIOCSIFTXQLEN Get or set the transmit queue length of a device using ifrqlen. Setting the transmit queue length is a privileged operation. SIOCSIFNAME Changes the name of the interface specified in ifrname to ifrnewname. This is a privileged operation. It is allowed only when the interface is not up. SIOCGIFCONF Return a list of interface (transport layer) addresses. This currently means only addresses of the AFINET (IPv4) family for compatibility. The user passes a ifconf structure as argument to the ioctl. It contains a pointer to an array of ifreq struc‐ tures in ifcreq and its length in bytes in ifclen. The kernel fills the ifreqs with all current L3 interface addresses that are running: ifrname contains the interface name (eth0:1 etc.), ifraddr the address. The kernel returns with the actual length in ifclen. If ifclen is equal to the original length the buf‐ fer probably has overflowed and you should retry with a bigger buffer to get all addresses. When no error occurs the ioctl

returns 0; otherwise -1. Overflow is not an error.

Most protocols support their own ioctls to configure protocol-specific interface options. See the protocol man pages for a description. For configuring IP addresses see ip(7). In addition some devices support private ioctls. These are not described here. NOTES Strictly speaking, SIOCGIFCONF and the other ioctls that accept or return only AFINET socket addresses, are IP specific and belong in ip(7). The names of interfaces with no addresses or that don't have the IFFRUNNING flag set can be found via /proc/net/dev. Local IPv6 IP addresses can be found via /proc/net or via rtnetlink(7). BUGS glibc 2.1 is missing the ifrnewname macro in . Add the fol‐ lowing to your program as a workaround:

#ifndef ifrnewname

#define ifrnewname ifrifru.ifruslave

#endif SEE ALSO proc(5), capabilities(7), ip(7), rtnetlink(7) COLOPHON

This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can

be found at http://www.kernel.org/doc/man-pages/.

Linux 2012-04-26 NETDEVICE(7)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™