summaryrefslogtreecommitdiffstats
path: root/src/peer.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-04-25 00:56:07 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-04-25 00:56:07 +0200
commit482ddc46a62b9a6b8bd615fd35b2bac6d3b7d841 (patch)
treec96ed40c8c3c962fd17235809fb49b2b23e93dbc /src/peer.c
parent1bb1eb5a334e919d0f57ffa2746c64394b47d1e9 (diff)
downloadfastd-482ddc46a62b9a6b8bd615fd35b2bac6d3b7d841.tar
fastd-482ddc46a62b9a6b8bd615fd35b2bac6d3b7d841.zip
fastd_peer_claim_address: add parameter to allow claiming addresses of established peers
Diffstat (limited to 'src/peer.c')
-rw-r--r--src/peer.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/peer.c b/src/peer.c
index feacc73..2d4b8bf 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -447,7 +447,7 @@ bool fastd_peer_matches_address(const fastd_peer_t *peer, const fastd_peer_addre
return false;
}
-bool fastd_peer_claim_address(fastd_peer_t *new_peer, fastd_socket_t *sock, const fastd_peer_address_t *local_addr, const fastd_peer_address_t *remote_addr) {
+bool fastd_peer_claim_address(fastd_peer_t *new_peer, fastd_socket_t *sock, const fastd_peer_address_t *local_addr, const fastd_peer_address_t *remote_addr, bool force) {
if (remote_addr->sa.sa_family == AF_UNSPEC) {
if (fastd_peer_is_established(new_peer))
fastd_peer_reset(new_peer);
@@ -466,6 +466,11 @@ bool fastd_peer_claim_address(fastd_peer_t *new_peer, fastd_socket_t *sock, cons
}
if (fastd_peer_address_equal(&peer->address, remote_addr)) {
+ if (!force && fastd_peer_is_established(peer)) {
+ reset_peer_address(new_peer);
+ return false;
+ }
+
reset_peer_address(peer);
break;
}