diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-07-24 19:13:24 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-07-24 19:13:24 +0200 |
commit | 95491f3b7e800b3b0e58ea4eaf35e8270b46470f (patch) | |
tree | 74b1b749171e1e0de69925c3020a83d67a7c6be2 /src/peer.c | |
parent | 69659bce9718d27a379e60bad2979ec94340b707 (diff) | |
download | fastd-95491f3b7e800b3b0e58ea4eaf35e8270b46470f.tar fastd-95491f3b7e800b3b0e58ea4eaf35e8270b46470f.zip |
Fix fastd_peer_claim_address for peers with different addresses
Diffstat (limited to 'src/peer.c')
-rw-r--r-- | src/peer.c | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -363,19 +363,21 @@ bool fastd_peer_claim_address(fastd_context_t *ctx, fastd_peer_t *new_peer, fast else { fastd_peer_t *peer; for (peer = ctx->peers; peer; peer = peer->next) { - if (!fastd_peer_address_equal(&peer->address, remote_addr)) - continue; - if (peer == new_peer) - break; + continue; - if (!fastd_peer_is_floating(peer)) { + if (fastd_peer_owns_address(ctx, peer, remote_addr)) { reset_peer_address(ctx, new_peer); return false; } - reset_peer_address(ctx, peer); - break; + if (fastd_peer_address_equal(&peer->address, remote_addr)) { + if (fastd_peer_is_established(peer)) + return false; + + reset_peer_address(ctx, peer); + break; + } } } |