Delay sending the real ID request until after a proxy request is granted.
[oweals/tinc.git] / src / proxy.c
index 227be4a5e1cc6882021272f26785730a2842ba8a..32cb7973ffcb51e9a928b7f20d62e5d9c44722cb 100644 (file)
@@ -194,6 +194,8 @@ int receive_proxy_meta(connection_t *c, int start, int lenin) {
 
                        ifdebug(CONNECTIONS) logger(LOG_DEBUG, "Proxy request granted");
                        c->allow_request = ID;
 
                        ifdebug(CONNECTIONS) logger(LOG_DEBUG, "Proxy request granted");
                        c->allow_request = ID;
+                       c->status.proxy_passed = true;
+                       send_id(c);
                        return 8;
                } else {
                        logger(LOG_ERR, "Proxy request rejected");
                        return 8;
                } else {
                        logger(LOG_ERR, "Proxy request rejected");
@@ -249,6 +251,8 @@ int receive_proxy_meta(connection_t *c, int start, int lenin) {
                } else {
                        ifdebug(CONNECTIONS) logger(LOG_DEBUG, "Proxy request granted");
                        c->allow_request = ID;
                } else {
                        ifdebug(CONNECTIONS) logger(LOG_DEBUG, "Proxy request granted");
                        c->allow_request = ID;
+                       c->status.proxy_passed = true;
+                       send_id(c);
                        return replen;
                }
 
                        return replen;
                }
 
@@ -275,6 +279,8 @@ int receive_proxy_meta(connection_t *c, int start, int lenin) {
                                logger(LOG_DEBUG, "Proxy request granted");
                                replen = p  + 1 - c->buffer;
                                c->allow_request = ID;
                                logger(LOG_DEBUG, "Proxy request granted");
                                replen = p  + 1 - c->buffer;
                                c->allow_request = ID;
+                               c->status.proxy_passed = true;
+                               send_id(c);
                                return replen;
                        } else {
                                p = memchr(c->buffer, '\n', c->buflen);
                                return replen;
                        } else {
                                p = memchr(c->buffer, '\n', c->buflen);