change sigar_net_interface_config_get to return sigar_net_interface_config_primary_get if name == NULL

This commit is contained in:
Doug MacEachern 2007-04-05 15:41:43 +00:00
parent 0e48e92124
commit 5ec635a1b4
4 changed files with 16 additions and 0 deletions

View File

@ -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;

View File

@ -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.
*/

View File

@ -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;

View File

@ -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) {