X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fprotocol_key.c;h=67f40af45caa660c93b8a207f2c568920878a6ec;hp=8096af57fc9c8f8843812b5e094510fa015b3d61;hb=cd0c2e86a403fc9aabecdc8d51413f94491b5494;hpb=4a0b9981513059755b9fd15b38fc198f46a0d6f2 diff --git a/src/protocol_key.c b/src/protocol_key.c index 8096af57..67f40af4 100644 --- a/src/protocol_key.c +++ b/src/protocol_key.c @@ -1,7 +1,7 @@ /* protocol_key.c -- handle the meta-protocol, key exchange Copyright (C) 1999-2005 Ivo Timmermans, - 2000-2009 Guus Sliepen + 2000-2010 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,15 +36,19 @@ bool mykeyused = false; -bool send_key_changed() { - /* Only send this message if some other daemon requested our key previously. - This reduces unnecessary key_changed broadcasts. - */ +void send_key_changed() { + avl_node_t *node; + connection_t *c; - if(!mykeyused) - return true; + send_request(broadcast, "%d %x %s", KEY_CHANGED, rand(), myself->name); + + /* Immediately send new keys to directly connected nodes to keep UDP mappings alive */ - return send_request(broadcast, "%d %x %s", KEY_CHANGED, rand(), myself->name); + for(node = connection_tree->head; node; node = node->next) { + c = node->data; + if(c->status.active && c->node && c->node->status.reachable) + send_ans_key(c->node); + } } bool key_changed_h(connection_t *c) {