101 |
#include "libbb.h" |
#include "libbb.h" |
102 |
|
|
103 |
/* #include <net/if.h> - no. linux/if_bonding.h pulls in linux/if.h */ |
/* #include <net/if.h> - no. linux/if_bonding.h pulls in linux/if.h */ |
104 |
|
#include <linux/if.h> |
105 |
#include <net/if_arp.h> |
#include <net/if_arp.h> |
106 |
#include <linux/if_bonding.h> |
#include <linux/if_bonding.h> |
107 |
#include <linux/sockios.h> |
#include <linux/sockios.h> |
108 |
|
#include "fix_u32.h" /* hack, so we may include kernel's ethtool.h */ |
109 |
|
#include <linux/ethtool.h> |
110 |
|
#ifndef BOND_ABI_VERSION |
111 |
|
# define BOND_ABI_VERSION 2 |
112 |
|
#endif |
113 |
#ifndef IFNAMSIZ |
#ifndef IFNAMSIZ |
114 |
#define IFNAMSIZ 16 |
# define IFNAMSIZ 16 |
115 |
#endif |
#endif |
116 |
|
|
|
typedef uint64_t u64; /* hack, so we may include kernel's ethtool.h */ |
|
|
typedef uint32_t u32; /* ditto */ |
|
|
typedef uint16_t u16; /* ditto */ |
|
|
typedef uint8_t u8; /* ditto */ |
|
|
#include <linux/ethtool.h> |
|
|
|
|
117 |
|
|
118 |
struct dev_data { |
struct dev_data { |
119 |
struct ifreq mtu, flags, hwaddr; |
struct ifreq mtu, flags, hwaddr; |
139 |
|
|
140 |
/* NOINLINEs are placed where it results in smaller code (gcc 4.3.1) */ |
/* NOINLINEs are placed where it results in smaller code (gcc 4.3.1) */ |
141 |
|
|
|
static void strncpy_IFNAMSIZ(char *dst, const char *src) |
|
|
{ |
|
|
strncpy(dst, src, IFNAMSIZ); |
|
|
} |
|
|
|
|
142 |
static int ioctl_on_skfd(unsigned request, struct ifreq *ifr) |
static int ioctl_on_skfd(unsigned request, struct ifreq *ifr) |
143 |
{ |
{ |
144 |
return ioctl(skfd, request, ifr); |
return ioctl(skfd, request, ifr); |
456 |
OPT_d = (1 << 1), |
OPT_d = (1 << 1), |
457 |
OPT_f = (1 << 2), |
OPT_f = (1 << 2), |
458 |
}; |
}; |
459 |
#if ENABLE_GETOPT_LONG |
#if ENABLE_LONG_OPTS |
460 |
static const char ifenslave_longopts[] ALIGN1 = |
static const char ifenslave_longopts[] ALIGN1 = |
461 |
"change-active\0" No_argument "c" |
"change-active\0" No_argument "c" |
462 |
"detach\0" No_argument "d" |
"detach\0" No_argument "d" |