netdevice(7) - Linux man page
时间:2009-04-30 来源:lxcrist
netdevice(7) - Linux man page
Name
netdevice - Low level access to Linux network devices
Synopsis
#include <sys/ioctl.h>
#include <net/if.h>
Description
This man page describes the sockets interface which is used to configure 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 ifr_name[IFNAMSIZ]; /* Interface name */
union {
struct sockaddr ifr_addr;
struct sockaddr ifr_dstaddr;
struct sockaddr ifr_broadaddr;
struct sockaddr ifr_netmask;
struct sockaddr ifr_hwaddr;
short ifr_flags;
int ifr_ifindex;
int ifr_metric;
int ifr_mtu;
struct ifmap ifr_map;
char ifr_slave[IFNAMSIZ];
char ifr_newname[IFNAMSIZ];
char * ifr_data;
};
};
struct ifconf {
int ifc_len; /* size of buffer */
union {
char * ifc_buf; /* buffer address */
struct ifreq * ifc_req; /* array of structures */
};
};
Normally, the user specifies which device to affect by setting ifr_name to the name of the interface. All other members of the structure may share memory.