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 sockaddr_dl *sdl;
struct ifreq ifr; struct ifreq ifr;
if (!name) {
return sigar_net_interface_config_primary_get(sigar, ifconfig);
}
if (sigar->ifconf_len == 0) { if (sigar->ifconf_len == 0) {
if ((status = sigar_ifmsg_init(sigar)) != SIGAR_OK) { if ((status = sigar_ifmsg_init(sigar)) != SIGAR_OK) {
return status; return status;

View File

@ -542,6 +542,10 @@ sigar_net_interface_config_get(sigar_t *sigar,
INTERFACE_INFO *if_info = NULL; INTERFACE_INFO *if_info = NULL;
u_long flags; u_long flags;
if (!name) {
return sigar_net_interface_config_primary_get(sigar, ifconfig);
}
/* win32 lacks socket ioctls to query given interface. /* win32 lacks socket ioctls to query given interface.
* so we loop through the list to find our made up ifname. * 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; MIB_IPADDRROW *ipaddr;
int status; int status;
if (!name) {
return sigar_net_interface_config_primary_get(sigar, ifconfig);
}
status = get_mib_ifrow(sigar, name, &ifr); status = get_mib_ifrow(sigar, name, &ifr);
if (status != SIGAR_OK) { if (status != SIGAR_OK) {
return status; return status;

View File

@ -1468,6 +1468,10 @@ int sigar_net_interface_config_get(sigar_t *sigar, const char *name,
int sock; int sock;
struct ifreq ifr; struct ifreq ifr;
if (!name) {
return sigar_net_interface_config_primary_get(sigar, ifconfig);
}
SIGAR_ZERO(ifconfig); SIGAR_ZERO(ifconfig);
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {