return send_request(mesh, c, "%d %s %d.%d", ID, mesh->self->connection->name, mesh->self->connection->protocol_major, minor);
}
-static bool finalize_invitation(meshlink_handle_t *mesh, connection_t *c, const char *data, uint16_t len) {
+static bool finalize_invitation(meshlink_handle_t *mesh, connection_t *c, const void *data, uint16_t len) {
if(strchr(data, '\n')) {
logger(DEBUG_ALWAYS, LOG_ERR, "Received invalid key from invited node %s (%s)!\n", c->name, c->hostname);
return false;
return false;
}
- fprintf(f, "ECDSAPublicKey = %s\n", data);
+ fprintf(f, "ECDSAPublicKey = %s\n", (const char *)data);
fclose(f);
logger(DEBUG_CONNECTIONS, LOG_INFO, "Key succesfully received from %s (%s)", c->name, c->hostname);
//TODO: callback to application to inform of an accepted invitation
sptps_send_record(&c->sptps, 2, data, 0);
+
+ load_all_nodes(mesh);
+
return true;
}
-static bool receive_invitation_sptps(void *handle, uint8_t type, const char *data, uint16_t len) {
+static bool receive_invitation_sptps(void *handle, uint8_t type, const void *data, uint16_t len) {
connection_t *c = handle;
meshlink_handle_t *mesh = c->mesh;
free(mykey);
c->protocol_minor = 2;
+ c->allow_request = 1;
- return sptps_start(&c->sptps, c, false, false, mesh->invitation_key, c->ecdsa, "tinc invitation", 15, send_meta_sptps, receive_invitation_sptps);
+ return sptps_start(&c->sptps, c, false, false, mesh->invitation_key, c->ecdsa, "meshlink invitation", 15, send_meta_sptps, receive_invitation_sptps);
}
/* Check if identity is a valid name */
char label[25 + strlen(mesh->self->name) + strlen(c->name)];
if(c->outgoing)
- snprintf(label, sizeof label, "tinc TCP key expansion %s %s", mesh->self->name, c->name);
+ snprintf(label, sizeof label, "meshlink TCP key expansion %s %s", mesh->self->name, c->name);
else
- snprintf(label, sizeof label, "tinc TCP key expansion %s %s", c->name, mesh->self->name);
+ snprintf(label, sizeof label, "meshlink TCP key expansion %s %s", c->name, mesh->self->name);
return sptps_start(&c->sptps, c, c->outgoing, false, mesh->self->connection->ecdsa, c->ecdsa, label, sizeof label, send_meta_sptps, receive_meta_sptps);
}
to create node_t and edge_t structures. */
struct timeval now;
- bool choice;
/* Estimate weight */
bool ack_h(meshlink_handle_t *mesh, connection_t *c, const char *request) {
char hisport[MAX_STRING_SIZE];
char *hisaddress;
- int weight, mtu;
+ int weight;
uint32_t options;
node_t *n;
- bool choice;
if(sscanf(request, "%*d " MAX_STRING " %d %x", hisport, &weight, &options) != 3) {
logger(DEBUG_ALWAYS, LOG_ERR, "Got bad %s from %s (%s)", "ACK", c->name,