change sigar_net_interface_config_get to return sigar_net_interface_config_primary_get if name == NULL
This commit is contained in:
parent
0e48e92124
commit
5ec635a1b4
|
@ -1824,6 +1824,10 @@ int sigar_net_interface_config_get(sigar_t *sigar, const char *name,
|
|||
struct sockaddr_dl *sdl;
|
||||
struct ifreq ifr;
|
||||
|
||||
if (!name) {
|
||||
return sigar_net_interface_config_primary_get(sigar, ifconfig);
|
||||
}
|
||||
|
||||
if (sigar->ifconf_len == 0) {
|
||||
if ((status = sigar_ifmsg_init(sigar)) != SIGAR_OK) {
|
||||
return status;
|
||||
|
|
|
@ -542,6 +542,10 @@ sigar_net_interface_config_get(sigar_t *sigar,
|
|||
INTERFACE_INFO *if_info = NULL;
|
||||
u_long flags;
|
||||
|
||||
if (!name) {
|
||||
return sigar_net_interface_config_primary_get(sigar, ifconfig);
|
||||
}
|
||||
|
||||
/* win32 lacks socket ioctls to query given interface.
|
||||
* so we loop through the list to find our made up ifname.
|
||||
*/
|
||||
|
|
|
@ -2446,6 +2446,10 @@ sigar_net_interface_config_get(sigar_t *sigar,
|
|||
MIB_IPADDRROW *ipaddr;
|
||||
int status;
|
||||
|
||||
if (!name) {
|
||||
return sigar_net_interface_config_primary_get(sigar, ifconfig);
|
||||
}
|
||||
|
||||
status = get_mib_ifrow(sigar, name, &ifr);
|
||||
if (status != SIGAR_OK) {
|
||||
return status;
|
||||
|
|
|
@ -1468,6 +1468,10 @@ int sigar_net_interface_config_get(sigar_t *sigar, const char *name,
|
|||
int sock;
|
||||
struct ifreq ifr;
|
||||
|
||||
if (!name) {
|
||||
return sigar_net_interface_config_primary_get(sigar, ifconfig);
|
||||
}
|
||||
|
||||
SIGAR_ZERO(ifconfig);
|
||||
|
||||
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
|
||||
|
|
Loading…
Reference in New Issue