From e2c74bb6161f34dfd113d341f37b4c3351b67dbb Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Thu, 30 Jul 2009 08:27:06 -0700 Subject: [PATCH] hpux net_interface_ipv6_config impl --- src/os/hpux/hpux_sigar.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/os/hpux/hpux_sigar.c b/src/os/hpux/hpux_sigar.c index db1c0c5b..5d7601fd 100644 --- a/src/os/hpux/hpux_sigar.c +++ b/src/os/hpux/hpux_sigar.c @@ -21,10 +21,12 @@ #include "sigar_util.h" #include "sigar_os.h" +#include #include #ifndef __ia64__ #include #endif +#include #include #include @@ -875,7 +877,29 @@ int sigar_net_interface_stat_get(sigar_t *sigar, const char *name, int sigar_net_interface_ipv6_config_get(sigar_t *sigar, const char *name, sigar_net_interface_config_t *ifconfig) { - return SIGAR_ENOTIMPL; + int sock; + struct if_laddrreq iflr; + + if ((sock = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { + return errno; + } + + SIGAR_SSTRCPY(iflr.iflr_name, name); + + if (ioctl(sock, SIOCGLIFADDR, &iflr) == 0) { + struct in6_addr *addr = SIGAR_SIN6_ADDR(&iflr.iflr_addr); + + sigar_net_address6_set(ifconfig->address6, addr); + sigar_net_interface_scope6_set(ifconfig, addr); + + if (ioctl(sock, SIOCGLIFNETMASK, &iflr) == 0) { + addr = SIGAR_SIN6_ADDR(&iflr.iflr_addr); + ifconfig->prefix6_length = 10; /*XXX*/ + } + } + + close(sock); + return SIGAR_OK; } static int net_conn_get_udp_listen(sigar_net_connection_walker_t *walker)