--- projects/libstatgrab/src/libstatgrab/network_stats.c 2004/02/13 15:40:13 1.34 +++ projects/libstatgrab/src/libstatgrab/network_stats.c 2004/02/13 18:45:43 1.35 @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA * - * $Id: network_stats.c,v 1.34 2004/02/13 15:40:13 tdb Exp $ + * $Id: network_stats.c,v 1.35 2004/02/13 18:45:43 pajs Exp $ */ #ifdef HAVE_CONFIG_H @@ -465,6 +465,12 @@ network_iface_stat_t *get_network_iface_stats(int *ent break; } + if((ifmr.ifm_status & IFM_ACTIVE)){ + network_iface_stat_ptr->up = 1; + }else{ + network_iface_stat_ptr->up = 0; + } + if( (ifmed.ifm_active | IFM_FDX) == ifmed.ifm_active ){ network_iface_stat_ptr->dup = FULL_DUPLEX; }else if( (ifmed.ifm_active | IFM_HDX) == ifmed.ifm_active ){ @@ -497,6 +503,13 @@ network_iface_stat_t *get_network_iface_stats(int *ent network_iface_stat_ptr = network_iface_stats + ifaces; network_iface_stat_ptr->speed = knp->value.ui64 / (1000*1000); + if((knp=kstat_data_lookup(ksp, "link_up"))==NULL){ + /* Not a network interface, so skip to the next entry */ + continue; + } + /* Solaris has 1 for up, and 0 for not. As we do too */ + network_iface_stat_ptr->up = value.ui32; + if((knp=kstat_data_lookup(ksp, "link_duplex"))==NULL){ /* Not a network interface, so skip to the next entry */ continue; @@ -578,6 +591,12 @@ network_iface_stat_t *get_network_iface_stats(int *ent network_iface_stat_ptr = network_iface_stats + ifaces; network_iface_stat_ptr->interface_name = strdup(name); network_iface_stat_ptr->speed = ethcmd->speed; + if((ifr.ifr_flags & IFF_UP) != 0){ + network_iface_stat_ptr->up = 1; + }else{ + network_iface_stat_ptr->up = 0; + } + network_iface_stat_ptr->dup = UNKNOWN_DUPLEX; if(ethcmd->duplex == 0x00){ network_iface_stat_ptr->dup = FULL_DUPLEX;