diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-06-14 14:58:33 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-06-14 14:58:33 +0200 |
commit | 7f1a29a5161b26e302185113d64d0df311b07ce1 (patch) | |
tree | 9956ec7a8b64ce1d760c8748a36d26ffcbfbee64 /src/peer_hashtable.c | |
parent | 10378374eca49543a78ec004b10f229b9e4082b3 (diff) | |
download | fastd-7f1a29a5161b26e302185113d64d0df311b07ce1.tar fastd-7f1a29a5161b26e302185113d64d0df311b07ce1.zip |
peer_hashtable: fix address hashing on systems with holes in sockaddr definitions
Diffstat (limited to 'src/peer_hashtable.c')
-rw-r--r-- | src/peer_hashtable.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/peer_hashtable.c b/src/peer_hashtable.c index b191f63..100e8a3 100644 --- a/src/peer_hashtable.c +++ b/src/peer_hashtable.c @@ -66,11 +66,15 @@ static size_t peer_address_bucket(const fastd_peer_address_t *addr) { switch(addr->sa.sa_family) { case AF_INET: - fastd_hash(&hash, &addr->in, sizeof(addr->in)); + fastd_hash(&hash, &addr->in.sin_addr.s_addr, sizeof(addr->in.sin_addr.s_addr)); + fastd_hash(&hash, &addr->in.sin_port, sizeof(addr->in.sin_port)); break; case AF_INET6: - fastd_hash(&hash, &addr->in6, sizeof(addr->in6)); + fastd_hash(&hash, &addr->in6.sin6_addr, sizeof(addr->in6.sin6_addr)); + fastd_hash(&hash, &addr->in6.sin6_port, sizeof(addr->in6.sin6_port)); + if (IN6_IS_ADDR_LINKLOCAL(&addr->in6.sin6_addr)) + fastd_hash(&hash, &addr->in6.sin6_scope_id, sizeof(addr->in6.sin6_scope_id)); break; default: |