From 8716d916c7bfe26b5a8f65a555fb0b1ee13cf138 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Sat, 2 Oct 2004 03:39:23 +0000 Subject: [PATCH] weed out network interfaces that have no ip address --- src/sigar.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/sigar.c b/src/sigar.c index 36c17b52..fafea017 100644 --- a/src/sigar.c +++ b/src/sigar.c @@ -845,6 +845,18 @@ int sigar_net_interface_config_get(sigar_t *sigar, const char *name, # define MY_SIOCGIFCONF SIOCGIFCONF #endif +#ifdef __osf__ +static int sigar_netif_configured(sigar_t *sigar, char *name) +{ + int status; + sigar_net_interface_config_t ifconfig; + + status = sigar_net_interface_config_get(sigar, name, &ifconfig); + + return status == SIGAR_OK; +} +#endif + int sigar_net_interface_list_get(sigar_t *sigar, sigar_net_interface_list_t *iflist) { @@ -906,6 +918,13 @@ int sigar_net_interface_list_get(sigar_t *sigar, */ continue; } +# ifdef __osf__ + /* weed out "sl0", "tun0" and the like */ + /* XXX must be a better way to check this */ + if (!sigar_netif_configured(sigar, ifr->ifr_name)) { + continue; + } +# endif #endif iflist->data[iflist->number++] = strdup(ifr->ifr_name); }