add support for IFF_SLAVE flag (used by vmnic)
This commit is contained in:
parent
583922f3d0
commit
bb478479b2
|
@ -67,6 +67,8 @@ public class NetFlags {
|
||||||
*/
|
*/
|
||||||
public final static int IFF_MULTICAST = 0x800;
|
public final static int IFF_MULTICAST = 0x800;
|
||||||
|
|
||||||
|
public final static int IFF_SLAVE = 0x1000;
|
||||||
|
|
||||||
public static final int RTF_UP = 0x1;
|
public static final int RTF_UP = 0x1;
|
||||||
|
|
||||||
public static final int RTF_GATEWAY = 0x2;
|
public static final int RTF_GATEWAY = 0x2;
|
||||||
|
@ -150,6 +152,8 @@ public class NetFlags {
|
||||||
retval += "PROMISC ";
|
retval += "PROMISC ";
|
||||||
if ((flags & IFF_ALLMULTI) > 0)
|
if ((flags & IFF_ALLMULTI) > 0)
|
||||||
retval += "ALLMULTI ";
|
retval += "ALLMULTI ";
|
||||||
|
if ((flags & IFF_SLAVE) > 0)
|
||||||
|
retval += "SLAVE ";
|
||||||
if ((flags & IFF_MULTICAST) > 0)
|
if ((flags & IFF_MULTICAST) > 0)
|
||||||
retval += "MULTICAST ";
|
retval += "MULTICAST ";
|
||||||
|
|
||||||
|
|
|
@ -448,6 +448,7 @@ SIGAR_DECLARE(int) sigar_net_route_list_destroy(sigar_t *sigar,
|
||||||
#define SIGAR_IFF_PROMISC 0x100
|
#define SIGAR_IFF_PROMISC 0x100
|
||||||
#define SIGAR_IFF_ALLMULTI 0x200
|
#define SIGAR_IFF_ALLMULTI 0x200
|
||||||
#define SIGAR_IFF_MULTICAST 0x800
|
#define SIGAR_IFF_MULTICAST 0x800
|
||||||
|
#define SIGAR_IFF_SLAVE 0x1000
|
||||||
|
|
||||||
#define SIGAR_NULL_HWADDR "00:00:00:00:00:00"
|
#define SIGAR_NULL_HWADDR "00:00:00:00:00:00"
|
||||||
|
|
||||||
|
|
15
src/sigar.c
15
src/sigar.c
|
@ -1212,8 +1212,10 @@ int sigar_net_interface_config_get(sigar_t *sigar, const char *name,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ioctl(sock, SIOCGIFFLAGS, &ifr)) {
|
if (!ioctl(sock, SIOCGIFFLAGS, &ifr)) {
|
||||||
ifconfig->flags = ifr.ifr_flags;
|
sigar_uint64_t flags = ifr.ifr_flags;
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
int is_mcast = flags & IFF_MULTICAST;
|
||||||
|
int is_slave = flags & IFF_SLAVE;
|
||||||
/*
|
/*
|
||||||
* XXX: should just define SIGAR_IFF_*
|
* XXX: should just define SIGAR_IFF_*
|
||||||
* and test IFF_* bits on given platform.
|
* and test IFF_* bits on given platform.
|
||||||
|
@ -1221,14 +1223,15 @@ int sigar_net_interface_config_get(sigar_t *sigar, const char *name,
|
||||||
* for the flags we care about.
|
* for the flags we care about.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (ifconfig->flags & IFF_MULTICAST) {
|
flags &= ~(IFF_MULTICAST|IFF_SLAVE);
|
||||||
ifconfig->flags |= SIGAR_IFF_MULTICAST;
|
if (is_mcast) {
|
||||||
|
flags |= SIGAR_IFF_MULTICAST;
|
||||||
}
|
}
|
||||||
else {
|
if (is_slave) {
|
||||||
/* 0x800 == IFF_SLAVE on linux */
|
flags |= SIGAR_IFF_SLAVE;
|
||||||
ifconfig->flags &= ~SIGAR_IFF_MULTICAST;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
ifconfig->flags = flags;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* should always be able to get flags for existing device */
|
/* should always be able to get flags for existing device */
|
||||||
|
|
Loading…
Reference in New Issue