339 |
|
for(net_stats+=start; start<end; start++){ |
340 |
|
net_stats->interface_name=NULL; |
341 |
|
net_stats->speed=0; |
342 |
< |
net_stats->dup=NO_DUPLEX; |
342 |
> |
net_stats->dup=UNKNOWN_DUPLEX; |
343 |
|
net_stats++; |
344 |
|
} |
345 |
|
} |
450 |
|
case(IFM_1000_SX): |
451 |
|
case(IFM_1000_LX): |
452 |
|
case(IFM_1000_CX): |
453 |
+ |
#if defined(FREEBSD) && !defined(FREEBSD5) |
454 |
|
case(IFM_1000_TX): |
455 |
+ |
case(IFM_1000_FX): |
456 |
+ |
#else |
457 |
+ |
case(IFM_1000_T): |
458 |
+ |
#endif |
459 |
|
network_iface_stat_ptr->speed = 1000; |
460 |
|
break; |
461 |
|
/* We don't know what it is */ |
469 |
|
}else if( (ifmed.ifm_active | IFM_HDX) == ifmed.ifm_active ){ |
470 |
|
network_iface_stat_ptr->dup = HALF_DUPLEX; |
471 |
|
}else{ |
472 |
< |
network_iface_stat_ptr->dup = NO_DUPLEX; |
472 |
> |
network_iface_stat_ptr->dup = UNKNOWN_DUPLEX; |
473 |
|
} |
474 |
|
ifaces++; |
475 |
|
} |
476 |
|
freeifaddrs(net); |
477 |
+ |
close(s); |
478 |
|
#endif |
479 |
|
|
480 |
|
#ifdef SOLARIS |
533 |
|
if(eth_tool_cmd_buf == NULL) return NULL; |
534 |
|
|
535 |
|
/* Ignore first 2 lines.. Just headings */ |
536 |
< |
fgets(line, sizeof(line), f); |
537 |
< |
fgets(line, sizeof(line), f); |
536 |
> |
if((fgets(line, sizeof(line), f)) == NULL) return NULL; |
537 |
> |
if((fgets(line, sizeof(line), f)) == NULL) return NULL; |
538 |
|
|
539 |
|
while((fgets(line, sizeof(line), f)) != NULL){ |
540 |
|
char *name, *ptr; |
556 |
|
ifr.ifr_data = (caddr_t) eth_tool_cmd_buf; |
557 |
|
strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); |
558 |
|
|
559 |
< |
ethcmd = (struct ethtool_cmd *)(&ifr)->ifr_data; |
559 |
> |
ethcmd = (struct ethtool_cmd *) ifr.ifr_data; |
560 |
|
ethcmd->cmd = ETHTOOL_GSET; |
561 |
|
|
562 |
|
err = ioctl(sock, SIOCETHTOOL, &ifr); |
575 |
|
network_iface_stat_ptr = network_iface_stats + ifaces; |
576 |
|
network_iface_stat_ptr->interface_name = strdup(name); |
577 |
|
network_iface_stat_ptr->speed = ethcmd->speed; |
578 |
< |
network_iface_stat_ptr->dup = NO_DUPLEX; |
578 |
> |
network_iface_stat_ptr->dup = UNKNOWN_DUPEX; |
579 |
|
if(ethcmd->duplex == 0x00){ |
580 |
|
network_iface_stat_ptr->dup = FULL_DUPLEX; |
581 |
|
} |
584 |
|
} |
585 |
|
ifaces++; |
586 |
|
} |
587 |
< |
|
587 |
> |
close(sock); |
588 |
|
free(eth_tool_cmd_buf); |
589 |
|
#endif |
590 |
|
*entries = ifaces; |