diff --git a/src/os/darwin/darwin_sigar.c b/src/os/darwin/darwin_sigar.c index 2ef2bbf1..7f99d3de 100644 --- a/src/os/darwin/darwin_sigar.c +++ b/src/os/darwin/darwin_sigar.c @@ -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; diff --git a/src/os/netware/netware_sigar.c b/src/os/netware/netware_sigar.c index 1f70f2a1..479f7f36 100644 --- a/src/os/netware/netware_sigar.c +++ b/src/os/netware/netware_sigar.c @@ -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. */ diff --git a/src/os/win32/win32_sigar.c b/src/os/win32/win32_sigar.c index 8c40d14c..d7050c87 100644 --- a/src/os/win32/win32_sigar.c +++ b/src/os/win32/win32_sigar.c @@ -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; diff --git a/src/sigar.c b/src/sigar.c index e261349f..c68c5a40 100644 --- a/src/sigar.c +++ b/src/sigar.c @@ -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) {