From 47de98b27b28e049c47ce29a056d245fb14a2576 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sun, 11 May 2014 23:33:11 +0200 Subject: [PATCH] Make sure the SPTSP connection get set up properly during a join. --- src/meshlink.c | 2 ++ src/protocol_auth.c | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) 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); } -- 2.39.2