diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-05-17 11:55:22 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-05-17 11:55:22 +0200 |
commit | f863ed2c2d9000d95aad7f2a0a27212acf86c692 (patch) | |
tree | 8ab7fdc047f13f36566d35d0be50f943eaf8374d /src | |
parent | e9536fe57e7857d100574164ff189684855942b0 (diff) | |
download | fastd-f863ed2c2d9000d95aad7f2a0a27212acf86c692.tar fastd-f863ed2c2d9000d95aad7f2a0a27212acf86c692.zip |
Fix handling of unsuccessful resolve
Diffstat (limited to 'src')
-rw-r--r-- | src/peer.c | 32 |
1 files changed, 17 insertions, 15 deletions
@@ -269,21 +269,23 @@ bool fastd_peer_address_equal(const fastd_peer_address *addr1, const fastd_peer_ } bool fastd_peer_claim_address(fastd_context *ctx, fastd_peer *new_peer, const fastd_peer_address *addr) { - fastd_peer *peer; - for (peer = ctx->peers; peer; peer = peer->next) { - if (fastd_peer_address_equal(&peer->address, addr)) { - if (peer == new_peer) - break; - - if (fastd_peer_is_floating(peer) || fastd_peer_is_dynamic(peer)) { - if (fastd_peer_is_established(peer)) - fastd_peer_reset(ctx, peer); - - memset(&peer->address, 0, sizeof(fastd_peer_address)); - break; - } - else { - return false; + if (addr->sa.sa_family != AF_UNSPEC) { + fastd_peer *peer; + for (peer = ctx->peers; peer; peer = peer->next) { + if (fastd_peer_address_equal(&peer->address, addr)) { + if (peer == new_peer) + break; + + if (fastd_peer_is_floating(peer) || fastd_peer_is_dynamic(peer)) { + if (fastd_peer_is_established(peer)) + fastd_peer_reset(ctx, peer); + + memset(&peer->address, 0, sizeof(fastd_peer_address)); + break; + } + else { + return false; + } } } } |