fix net_route_list for solaris 10

This commit is contained in:
Doug MacEachern 2005-12-03 01:31:54 +00:00
parent dde5c40a6f
commit fc24578d83
1 changed files with 9 additions and 1 deletions

View File

@ -1512,6 +1512,13 @@ int sigar_net_route_list_get(sigar_t *sigar,
char *data; char *data;
int len, rc; int len, rc;
struct opthdr *op; struct opthdr *op;
size_t nread=0, size=sizeof(mib2_ipRouteEntry_t);
if (sigar->solaris_version >= 10) {
size += /* bincompat for new solaris 10 fields */
sizeof(DeviceName) +
sizeof(IpAddress);
}
sigar_net_route_list_create(routelist); sigar_net_route_list_create(routelist);
@ -1524,7 +1531,8 @@ int sigar_net_route_list_get(sigar_t *sigar,
} }
for (entry = (mib2_ipRouteEntry_t *)data, end = data + len; for (entry = (mib2_ipRouteEntry_t *)data, end = data + len;
(char *)entry < end; entry++) (char *)entry < end;
entry = (mib2_ipRouteEntry_t *)((char *)data+nread), nread+=size)
{ {
sigar_net_route_t *route; sigar_net_route_t *route;
int type = entry->ipRouteInfo.re_ire_type; int type = entry->ipRouteInfo.re_ire_type;