From: Guus Sliepen Date: Sat, 17 Apr 2010 10:33:15 +0000 (+0200) Subject: Fix merge of commit 4a0b9981513059755b9fd15b38fc198f46a0d6f2. X-Git-Tag: import-tinc-1.1~549 X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=2911af6e23d0dba6d771fcd590551a84bd9dc932;p=meshlink Fix merge of commit 4a0b9981513059755b9fd15b38fc198f46a0d6f2. --- diff --git a/src/protocol_key.c b/src/protocol_key.c index 3baa580d..4187538b 100644 --- a/src/protocol_key.c +++ b/src/protocol_key.c @@ -175,7 +175,7 @@ bool ans_key_h(connection_t *c, char *request) { int cipher, digest, maclength, compression, keylen; node_t *from, *to; - if(sscanf(request, "%*d "MAX_STRING" "MAX_STRING" "MAX_STRING" %d %d %d %d", + if(sscanf(request, "%*d "MAX_STRING" "MAX_STRING" "MAX_STRING" %d %d %d %d "MAX_STRING" "MAX_STRING, from_name, to_name, key, &cipher, &digest, &maclength, &compression, address, port) < 7) { logger(LOG_ERR, "Got bad %s from %s (%s)", "ANS_KEY", c->name, @@ -216,6 +216,16 @@ bool ans_key_h(connection_t *c, char *request) { return true; } + if(!*address) { + char *address, *port; + ifdebug(PROTOCOL) logger(LOG_DEBUG, "Appending reflexive UDP address to ANS_KEY from %s to %s", from->name, to->name); + sockaddr2str(&from->address, &address, &port); + send_request(to->nexthop->connection, "%s %s %s", request, address, port); + free(address); + free(port); + return true; + } + return send_request(to->nexthop->connection, "%s", request); }