summaryrefslogtreecommitdiffstats
path: root/src/peer_hashtable.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-05-29 18:54:03 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-05-29 18:54:03 +0200
commit404785fe4a7cfc1a9a6cd9d2a9885a69992ff1ce (patch)
tree0cbe87328df40615f23b72b893f3ee318f9db5cf /src/peer_hashtable.c
parent2fe678653b7dd9f61dbbcd5e7d862360882bd7e8 (diff)
downloadfastd-404785fe4a7cfc1a9a6cd9d2a9885a69992ff1ce.tar
fastd-404785fe4a7cfc1a9a6cd9d2a9885a69992ff1ce.zip
Ensure peer hashtable consistency on address resets
Diffstat (limited to 'src/peer_hashtable.c')
-rw-r--r--src/peer_hashtable.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/peer_hashtable.c b/src/peer_hashtable.c
index 475d7f9..b191f63 100644
--- a/src/peer_hashtable.c
+++ b/src/peer_hashtable.c
@@ -88,6 +88,9 @@ static size_t peer_address_bucket(const fastd_peer_address_t *addr) {
The peer address must not change while the peer is part of the table.
*/
void fastd_peer_hashtable_insert(fastd_peer_t *peer) {
+ if (!peer->address.sa.sa_family)
+ return;
+
size_t b = peer_address_bucket(&peer->address);
VECTOR_ADD(ctx.peer_addr_ht[b], peer);
}