From: Guus Sliepen Date: Sat, 17 Nov 2012 21:14:52 +0000 (+0100) Subject: Choose a suitable socket when updating a node's UDP address. X-Git-Tag: release-1.1pre4~18 X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=30404650b28bf72d0b05b55393f2dd492434f9f3;p=tinc Choose a suitable socket when updating a node's UDP address. --- diff --git a/src/node.c b/src/node.c index e67b9b97..5dc3119f 100644 --- a/src/node.c +++ b/src/node.c @@ -129,6 +129,13 @@ void update_node_udp(node_t *n, const sockaddr_t *sa) { if(sa) { n->address = *sa; + n->sock = 0; + for(int i = 0; i < listen_sockets; i++) { + if(listen_socket[i].sa.sa.sa_family == sa->sa.sa_family) { + n->sock = i; + break; + } + } hash_insert(node_udp_cache, sa, n); free(n->hostname); n->hostname = sockaddr2hostname(&n->address);