[SIGAR-5] Fix netinfo default gateway

This commit is contained in:
Doug MacEachern 2006-06-09 17:42:46 +00:00
parent ec58e28f34
commit 071ca22aba
2 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2006-06-09 Doug MacEachern <dougm@hyperic.com>
* [SIGAR-5] Fix netinfo default gateway where the first gateway in the routing table
had been selected without checking for the default destination == 0.0.0.0
2006-05-30 Doug MacEachern <dougm@hyperic.com> 2006-05-30 Doug MacEachern <dougm@hyperic.com>
* Prevent possible integer overflow in filesystem_usage * Prevent possible integer overflow in filesystem_usage

View File

@ -927,7 +927,9 @@ static int sigar_get_default_gateway(sigar_t *sigar,
} }
for (i=0; i<routelist.number; i++) { for (i=0; i<routelist.number; i++) {
if (routelist.data[i].flags & SIGAR_RTF_GATEWAY) { if ((routelist.data[i].flags & SIGAR_RTF_GATEWAY) &&
(routelist.data[i].destination == 0))
{
sigar_inet_ntoa(sigar, sigar_inet_ntoa(sigar,
routelist.data[i].gateway, gateway); routelist.data[i].gateway, gateway);
break; break;