Revert the IPv6 code, as we did with the IPv4 code, and use INET6 as an
[obnox/wireshark/wip.git] / pcap-util.c
index 2f3e80e6cd2cb9ec5ad603655dd4e214f2c18dcb..cca74e22ab34b5cd7544d5111d705ca740ca8df0 100644 (file)
@@ -199,6 +199,9 @@ if_info_add_address(if_info_t *if_info, struct sockaddr *addr)
 {
        if_addr_t *ip_addr;
        struct sockaddr_in *ai;
+#ifdef INET6
+       struct sockaddr_in6 *ai6;
+#endif
 
        switch (addr->sa_family) {
 
@@ -211,12 +214,14 @@ if_info_add_address(if_info_t *if_info, struct sockaddr *addr)
                if_info->ip_addr = g_slist_append(if_info->ip_addr, ip_addr);
                break;
 
-#ifdef AF_INET6
+#ifdef INET6
        case AF_INET6:
+               ai6 = (struct sockaddr_in6 *)addr;
                ip_addr = g_malloc(sizeof(*ip_addr));
                ip_addr->family = FAM_IPv6;
                memcpy((void *)&ip_addr->ip_addr.ip6_addr,
-                   (void *)&addr->sa_data, 16);
+                   (void *)&ai6->sin6_addr.s6_addr,
+                   sizeof ip_addr->ip_addr.ip6_addr);
                if_info->ip_addr = g_slist_append(if_info->ip_addr, ip_addr);
                break;
 #endif