summaryrefslogtreecommitdiffstats
path: root/src/peer.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-12-08 12:54:41 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-12-08 12:54:41 +0100
commit6330d8abe044c26ca8d0c0246f9d075c53779782 (patch)
tree0cbad3b895a1504ef96fa4af66a1d7f5135196da /src/peer.c
parent64754a379d5379ea9004c9b6b58f7a71b4b4092e (diff)
downloadfastd-6330d8abe044c26ca8d0c0246f9d075c53779782.tar
fastd-6330d8abe044c26ca8d0c0246f9d075c53779782.zip
Fix crash occuring under certain circumstances on resolve failure
When a dynamic peer is in handshake state and a previous resolve has returned an address, the peer must be reset on a resolve failure even when there is no established session to avoid aborting on the next handshake.
Diffstat (limited to 'src/peer.c')
-rw-r--r--src/peer.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/peer.c b/src/peer.c
index e2ddf22..3d574c5 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -366,7 +366,7 @@ 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, fastd_socket *sock, const fastd_peer_address *addr) {
if (addr->sa.sa_family == AF_UNSPEC) {
- if (fastd_peer_is_established(new_peer))
+ if (new_peer->address.sa.sa_family != AF_UNSPEC)
fastd_peer_reset(ctx, new_peer);
}
else {
@@ -379,14 +379,14 @@ bool fastd_peer_claim_address(fastd_context *ctx, fastd_peer *new_peer, fastd_so
break;
if (!fastd_peer_is_floating(peer)) {
- if (fastd_peer_is_established(new_peer))
+ if (new_peer->address.sa.sa_family != AF_UNSPEC)
fastd_peer_reset(ctx, new_peer);
memset(&new_peer->address, 0, sizeof(fastd_peer_address));
return false;
}
- if (fastd_peer_is_established(peer))
+ if (peer->address.sa.sa_family != AF_UNSPEC)
fastd_peer_reset(ctx, peer);
memset(&peer->address, 0, sizeof(fastd_peer_address));