properly handle ipv6 addresses in net_connection_get

This commit is contained in:
Doug MacEachern 2007-04-06 15:44:12 +00:00
parent c6cad78da2
commit 8f393ee9cc
1 changed files with 13 additions and 4 deletions

View File

@ -2024,11 +2024,20 @@ static int net_connection_get(sigar_net_connection_walker_t *walker, int proto)
SIGAR_ZERO(&conn); SIGAR_ZERO(&conn);
sigar_net_address_set(conn.local_address, if (inp->inp_vflag & INP_IPV6) {
inp->inp_laddr.s_addr); sigar_net_address6_set(conn.local_address,
&inp->in6p_laddr.s6_addr);
sigar_net_address_set(conn.remote_address, sigar_net_address6_set(conn.remote_address,
inp->inp_faddr.s_addr); &inp->in6p_faddr.s6_addr);
}
else {
sigar_net_address_set(conn.local_address,
inp->inp_laddr.s_addr);
sigar_net_address_set(conn.remote_address,
inp->inp_faddr.s_addr);
}
conn.local_port = ntohs(inp->inp_lport); conn.local_port = ntohs(inp->inp_lport);
conn.remote_port = ntohs(inp->inp_fport); conn.remote_port = ntohs(inp->inp_fport);