Make datagram SPTPS key exchange more robust.
[tinc] / src / protocol_key.c
index 802f7ca..3e8d29a 100644 (file)
@@ -116,6 +116,8 @@ bool send_req_key(node_t *to) {
                snprintf(label, sizeof label, "tinc UDP key expansion %s %s", myself->name, to->name);
                sptps_stop(&to->sptps);
                to->status.validkey = false;
+               to->status.waitingforkey = true;
+               to->last_req_key = time(NULL);
                to->incompression = myself->incompression;
                return sptps_start(&to->sptps, to, true, true, myself->connection->ecdsa, to->ecdsa, label, sizeof label, send_initial_sptps_data, receive_sptps_record); 
        }
@@ -172,6 +174,8 @@ static bool req_key_ext_h(connection_t *c, const char *request, node_t *from, in
                        snprintf(label, sizeof label, "tinc UDP key expansion %s %s", from->name, myself->name);
                        sptps_stop(&from->sptps);
                        from->status.validkey = false;
+                       from->status.waitingforkey = true;
+                       from->last_req_key = time(NULL);
                        sptps_start(&from->sptps, from, false, true, myself->connection->ecdsa, from->ecdsa, label, sizeof label, send_sptps_data, receive_sptps_record); 
                        sptps_receive_data(&from->sptps, buf, len);
                        return true;