X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fprotocol_key.c;h=3cf4ab11a0bd121fb976e2e25dfade630e966f40;hb=08aabbf9317806bc50a9a6693ca866c8936ce26b;hp=52666d998698d2d1f6d89f01f67836bf067aa51a;hpb=046158a216e78a0412186ec8463157f6bce45d5d;p=tinc diff --git a/src/protocol_key.c b/src/protocol_key.c index 52666d99..3cf4ab11 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-2006 Guus Sliepen + 2000-2009 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 @@ -122,12 +122,18 @@ bool req_key_h(connection_t *c, char *request) { if(to == myself) { /* Yes, send our own key back */ mykeyused = true; from->received_seqno = 0; - memset(from->late, 0, sizeof(from->late)); + memset(from->late, 0, sizeof from->late); send_ans_key(c, myself, from); } else { if(tunnelserver) return false; + if(!to->status.reachable) { + logger(LOG_WARNING, _("Got %s from %s (%s) destination %s which is not reachable"), + "REQ_KEY", c->name, c->hostname, to_name); + return true; + } + send_req_key(to->nexthop->connection, from, to); } @@ -190,6 +196,12 @@ bool ans_key_h(connection_t *c, char *request) { if(tunnelserver) return false; + if(!to->status.reachable) { + logger(LOG_WARNING, _("Got %s from %s (%s) destination %s which is not reachable"), + "ANS_KEY", c->name, c->hostname, to_name); + return true; + } + return send_request(to->nexthop->connection, "%s", request); } @@ -236,7 +248,5 @@ bool ans_key_h(connection_t *c, char *request) { if(from->options & OPTION_PMTU_DISCOVERY && !from->mtuprobes) send_mtu_probe(from); - flush_queue(from); - return true; }