]> git.meshlink.io Git - meshlink/blobdiff - src/protocol_auth.c
Never automatically try to bind to ports >= 32768.
[meshlink] / src / protocol_auth.c
index a0d350d5b9ff83700439b02802ad5882c739b668..0a107e4c2820f19caa88dea3c6e5f41cab3f99c9 100644 (file)
@@ -44,7 +44,7 @@
 extern bool node_write_devclass(meshlink_handle_t *mesh, node_t *n);
 
 bool send_id(meshlink_handle_t *mesh, connection_t *c) {
-       return send_request(mesh, c, NULL, "%d %s %d.%d %s", ID, mesh->self->name, PROT_MAJOR, PROT_MINOR, mesh->appname);
+       return send_request(mesh, c, NULL, "%d %s %d.%d %s %u", ID, mesh->self->name, PROT_MAJOR, PROT_MINOR, mesh->appname, 0);
 }
 
 static bool commit_invitation(meshlink_handle_t *mesh, connection_t *c, const void *data) {
@@ -188,7 +188,7 @@ bool id_h(meshlink_handle_t *mesh, connection_t *c, const char *request) {
 
        char name[MAX_STRING_SIZE];
 
-       if(sscanf(request, "%*d " MAX_STRING " %d.%d", name, &c->protocol_major, &c->protocol_minor) < 2) {
+       if(sscanf(request, "%*d " MAX_STRING " %d.%d %*s %u", name, &c->protocol_major, &c->protocol_minor, &c->flags) < 2) {
                logger(mesh, MESHLINK_ERROR, "Got bad %s from %s", "ID", c->name);
                return false;
        }
@@ -380,6 +380,7 @@ bool ack_h(meshlink_handle_t *mesh, connection_t *c, const char *request) {
 
        n->devclass = devclass;
        n->status.dirty = true;
+       n->status.tiny = c->flags & PROTOCOL_TINY;
 
        n->last_successfull_connection = mesh->loop.now.tv_sec;
 
@@ -420,7 +421,9 @@ bool ack_h(meshlink_handle_t *mesh, connection_t *c, const char *request) {
 
        /* Send him everything we know */
 
-       send_everything(mesh, c);
+       if(!(c->flags & PROTOCOL_TINY)) {
+               send_everything(mesh, c);
+       }
 
        /* Create an edge_t for this connection */