]> gitweb.fperrin.net Git - iftop.git/blobdiff - addr_hash.c
Import iftop-1.0pre4
[iftop.git] / addr_hash.c
index 135709c268d026f12717c589777b9444b8e20580..f5c002c66bebf72644cfdbaf1b9ce1aabf684d22 100644 (file)
@@ -2,6 +2,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include "addr_hash.h"
 #include "hash.h"
 #include "iftop.h"
@@ -43,7 +44,7 @@ int hash(void* key) {
     addr_pair* ap = (addr_pair*)key;
 
     if (ap->af == AF_INET6) {
-        uint32_t* addr6 = ap->src6.s6_addr32;
+        uint32_t* addr6 = (uint32_t*)ap->src6.s6_addr;
 
         hash = ( hash_uint32(addr6[0])
                 + hash_uint32(addr6[1])
@@ -51,7 +52,7 @@ int hash(void* key) {
                 + hash_uint32(addr6[3])
                 + ap->src_port) % 0xFF;
 
-        addr6 = ap->dst6.s6_addr32;
+        addr6 = (uint32_t*)ap->dst6.s6_addr;
         hash = ( hash + hash_uint32(addr6[0])
                 + hash_uint32(addr6[1])
                 + hash_uint32(addr6[2])