4
#include <sys/utsname.h>
10
const char *name; /* Device name */
11
unsigned int ifindex; /* interface index */
12
unsigned int hwtype; /* ARPHRD_xxx */
13
unsigned int hwlen; /* HW address length */
14
__u8 hwaddr[16]; /* HW address */
15
__u8 hwbrd[16]; /* Broadcast HW address */
16
unsigned int mtu; /* Device mtu */
17
unsigned int caps; /* Capabilities */
20
struct { /* BOOTP/DHCP info */
23
__u32 gateway; /* BOOTP/DHCP gateway */
26
struct { /* RARP information */
30
__u32 ip_addr; /* my address */
31
__u32 ip_broadcast; /* broadcast address */
32
__u32 ip_server; /* server address */
33
__u32 ip_netmask; /* my subnet mask */
34
__u32 ip_gateway; /* my gateway */
35
__u32 ip_nameserver[2]; /* two nameservers */
36
__u32 serverid; /* dhcp serverid */
37
char hostname[SYS_NMLN]; /* hostname */
38
char dnsdomainname[SYS_NMLN];/* dns domain name */
39
char nisdomainname[SYS_NMLN];/* nis domain name */
40
char bootpath[BPLEN]; /* boot path */
41
struct netdev *next; /* next configured i/f */
47
#define CAP_BOOTP (1<<0)
48
#define CAP_DHCP (1<<1)
49
#define CAP_RARP (1<<2)
56
#define DEVST_DHCPDISC 2
57
#define DEVST_DHCPREQ 3
58
#define DEVST_COMPLETE 4
61
int netdev_getflags(struct netdev *dev, short *flags);
62
int netdev_setaddress(struct netdev *dev);
63
int netdev_setdefaultroute(struct netdev *dev);
64
int netdev_up(struct netdev *dev);
65
int netdev_down(struct netdev *dev);
66
int netdev_init_if(struct netdev *dev);
67
int netdev_setmtu(struct netdev *dev);
69
static inline int netdev_running(struct netdev *dev)
72
int ret = netdev_getflags(dev, &flags);
74
return ret ? 0 : !!(flags & IFF_RUNNING);