From: Guus Sliepen Date: Sun, 11 May 2014 21:33:11 +0000 (+0200) Subject: Make sure the SPTSP connection get set up properly during a join. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=47de98b27b28e049c47ce29a056d245fb14a2576;p=meshlink Make sure the SPTSP connection get set up properly during a join. --- diff --git a/src/meshlink.c b/src/meshlink.c index 5a171d2b..718b07a1 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -1181,6 +1181,8 @@ bool meshlink_join(meshlink_handle_t *mesh, const char *invitation) { // Tell him we have an invitation, and give him our throw-away key. + mesh->blen = 0; + if(!sendline(mesh->sock, "0 ?%s %d.%d", b64key, PROT_MAJOR, 1)) { fprintf(stderr, "Error sending request to %s port %s: %s\n", address, port, strerror(errno)); closesocket(mesh->sock); diff --git a/src/protocol_auth.c b/src/protocol_auth.c index be4d2ea0..4910a930 100644 --- a/src/protocol_auth.c +++ b/src/protocol_auth.c @@ -281,8 +281,9 @@ bool id_h(meshlink_handle_t *mesh, connection_t *c, const char *request) { 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 */ @@ -341,9 +342,9 @@ bool id_h(meshlink_handle_t *mesh, connection_t *c, const char *request) { 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); }