Merge branch 'sigar-1.6'

This commit is contained in:
Doug MacEachern 2009-09-15 14:54:00 -07:00
commit 52101bd408
1 changed files with 26 additions and 8 deletions

View File

@ -1850,13 +1850,8 @@ 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); size_t nread=0, size=0;
const char *size_from;
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);
@ -1864,10 +1859,33 @@ int sigar_net_route_list_get(sigar_t *sigar,
mib2_ipRouteEntry_t *entry; mib2_ipRouteEntry_t *entry;
char *end; char *end;
if (!((op->level == MIB2_IP) && (op->name == MIB2_IP_21))) { if (op->level != MIB2_IP) {
continue; continue;
} }
if (op->name == 0) {
/* we want to use this size for bincompat */
size = ((mib2_ip_t *)data)->ipRouteEntrySize;
continue;
}
else if (op->name != MIB2_IP_21) {
continue;
}
if (size == 0) {
size_from = "sizeof";
size = sizeof(*entry);
}
else {
size_from = "mib2_ip";
}
if (SIGAR_LOG_IS_DEBUG(sigar)) {
sigar_log_printf(sigar, SIGAR_LOG_DEBUG,
"[route_list] ipRouteEntrySize=%d (from %s)",
size, size_from);
}
for (entry = (mib2_ipRouteEntry_t *)data, end = data + len; for (entry = (mib2_ipRouteEntry_t *)data, end = data + len;
(char *)entry < end; (char *)entry < end;
entry = (mib2_ipRouteEntry_t *)((char *)data+nread), nread+=size) entry = (mib2_ipRouteEntry_t *)((char *)data+nread), nread+=size)