diff --git a/src/os/hpux/hpux_sigar.c b/src/os/hpux/hpux_sigar.c index f72a9463..ecf3678e 100644 --- a/src/os/hpux/hpux_sigar.c +++ b/src/os/hpux/hpux_sigar.c @@ -768,6 +768,32 @@ static int sigar_get_physical_stat(sigar_t *sigar, int *count) } } +#define SIGAR_IF_NAMESIZE 16 +/* hpux if_indextoname() does not work as advertised in 11.11 */ +static int sigar_if_indextoname(sigar_t *sigar, + char *name, + int index) +{ + int i, status, count; + nmapi_phystat *stat; + + if ((status = sigar_get_physical_stat(sigar, &count) != SIGAR_OK)) { + return status; + } + + for (i=0, stat = (nmapi_phystat *)sigar->ifconf_buf; + iif_entry.ifIndex == index) { + strncpy(name, stat->nm_device, SIGAR_IF_NAMESIZE); + return SIGAR_OK; + } + } + + return ENXIO; +} + int sigar_net_route_list_get(sigar_t *sigar, sigar_net_route_list_t *routelist) { @@ -819,6 +845,8 @@ int sigar_net_route_list_get(sigar_t *sigar, sigar_net_address_set(route->gateway, ent->NextHop); + sigar_if_indextoname(sigar, route->ifname, ent->IfIndex); + route->flags = SIGAR_RTF_UP; if ((ent->Dest == 0) && (ent->Mask == 0))