X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet_packet.c;h=0021aabb691bf26bed1d1a6e5ee1f2788c86057d;hb=545ecb339654573b3ee91bffb45c8282154885c6;hp=f219287a07d7534028d1c83c8e7cb0a50d7215c4;hpb=c26bb47af130d48d003afd29af4d7ea6ad0538c5;p=tinc diff --git a/src/net_packet.c b/src/net_packet.c index f219287a..0021aabb 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -97,10 +97,16 @@ static void udp_probe_timeout_handler(void *data) { static void udp_probe_h(node_t *n, vpn_packet_t *packet, length_t len) { if(!DATA(packet)[0]) { - logger(DEBUG_TRAFFIC, LOG_INFO, "Got UDP probe request %d from %s (%s)", packet->len, n->name, n->hostname); - /* It's a probe request, send back a reply */ + if(!n->status.sptps && !n->status.validkey) { + // But not if we don't have his key. + logger(DEBUG_TRAFFIC, LOG_INFO, "Got UDP probe request from %s (%s) but we don't have his key yet", n->name, n->hostname); + return; + } + + logger(DEBUG_TRAFFIC, LOG_INFO, "Got UDP probe request %d from %s (%s)", packet->len, n->name, n->hostname); + /* Type 2 probe replies were introduced in protocol 17.3 */ if ((n->options >> 24) >= 3) { uint8_t *data = DATA(packet); @@ -1111,6 +1117,11 @@ static void try_tx_sptps(node_t *n) { } static void try_tx_legacy(node_t *n) { + /* Does he have our key? If not, send one. */ + + if(!n->status.validkey_in) + send_ans_key(n); + /* Check if we already have a key, or request one. */ if(!n->status.validkey) {