- if(!to) {
- logger(LOG_ERR, _("Got %s from %s (%s) destination %s which does not exist in our connection list"),
- "REQ_KEY", c->name, c->hostname, to_name);
- return false;
+ char pubkey[MAX_STRING_SIZE];
+
+ if(sscanf(request, "%*d %*s %*s %*d " MAX_STRING, pubkey) != 1 || !(from->ecdsa = ecdsa_set_base64_public_key(pubkey))) {
+ logger(mesh, MESHLINK_ERROR, "Got bad %s from %s: %s", "ANS_PUBKEY", from->name, "invalid pubkey");
+ return true;
+ }
+
+ logger(mesh, MESHLINK_INFO, "Learned ECDSA public key from %s", from->name);
+ from->status.dirty = true;
+
+ /* If we are trying to form an outgoing connection to this node, retry immediately */
+ for list_each(outgoing_t, outgoing, mesh->outgoings) {
+ if(outgoing->node == from && outgoing->ev.cb) {
+ outgoing->timeout = 0;
+ timeout_set(&mesh->loop, &outgoing->ev, &(struct timeval) {
+ 0, 0
+ });
+ }
+ }
+
+ /* Also reset any UTCP timers */
+ utcp_reset_timers(from->utcp);
+
+ return true;