]> git.meshlink.io Git - meshlink/commitdiff
Don't send proxy requests for incoming connections.
authorGuus Sliepen <guus@tinc-vpn.org>
Thu, 7 Feb 2013 13:22:28 +0000 (14:22 +0100)
committerGuus Sliepen <guus@tinc-vpn.org>
Thu, 7 Feb 2013 13:22:28 +0000 (14:22 +0100)
src/meta.c
src/net_socket.c
src/protocol.c
src/protocol_auth.c

index 28c85cf0e6b9615866771857e8a201b6fccadb8b..3bf28093f33b25629e858999d9065c492b905f96 100644 (file)
@@ -189,14 +189,14 @@ bool receive_meta(connection_t *c) {
                                        break;
 
                                if(!c->node) {
-                                       if(proxytype == PROXY_SOCKS4 && c->allow_request == ID) {
+                                       if(c->outgoing && proxytype == PROXY_SOCKS4 && c->allow_request == ID) {
                                                if(tcpbuffer[0] == 0 && tcpbuffer[1] == 0x5a) {
                                                        logger(DEBUG_CONNECTIONS, LOG_DEBUG, "Proxy request granted");
                                                } else {
                                                        logger(DEBUG_CONNECTIONS, LOG_ERR, "Proxy request rejected");
                                                        return false;
                                                }
-                                       } else if(proxytype == PROXY_SOCKS5 && c->allow_request == ID) {
+                                       } else if(c->outgoing && proxytype == PROXY_SOCKS5 && c->allow_request == ID) {
                                                if(tcpbuffer[0] != 5) {
                                                        logger(DEBUG_CONNECTIONS, LOG_ERR, "Invalid response from proxy server");
                                                        return false;
index 0ba2bf312757031970098b04efaacac02fa6028d..cb2a6dfea699cc3b1ea487847445fce0d3131fc0 100644 (file)
@@ -294,9 +294,6 @@ void retry_outgoing(outgoing_t *outgoing) {
 void finish_connecting(connection_t *c) {
        logger(DEBUG_CONNECTIONS, LOG_INFO, "Connected to %s (%s)", c->name, c->hostname);
 
-       if(proxytype != PROXY_EXEC)
-               configure_tcp(c);
-
        c->last_ping_time = time(NULL);
        c->status.connecting = false;
 
@@ -459,6 +456,7 @@ begin:
                }
                logger(DEBUG_CONNECTIONS, LOG_INFO, "Using proxy at %s port %s", proxyhost, proxyport);
                c->socket = socket(proxyai->ai_family, SOCK_STREAM, IPPROTO_TCP);
+               configure_tcp(c);
        }
 
        if(c->socket == -1) {
index bdc0378bf29c8e6429c4f17197d4f169a604df93..fc16ffe7c08b66166e114094daab6dd814e78a29 100644 (file)
@@ -111,7 +111,7 @@ void forward_request(connection_t *from, const char *request) {
 }
 
 bool receive_request(connection_t *c, const char *request) {
-       if(proxytype == PROXY_HTTP && c->allow_request == ID) {
+       if(c->outgoing && proxytype == PROXY_HTTP && c->allow_request == ID) {
                if(!request[0] || request[0] == '\r')
                        return true;
                if(!strncasecmp(request, "HTTP/1.1 ", 9)) {
index 1b061b397f9740b804be33c991b68c94409f05cb..f4a30a412071854530df028aad559d632171d568 100644 (file)
@@ -139,7 +139,7 @@ bool send_id(connection_t *c) {
                        minor = myself->connection->protocol_minor;
        }
 
-       if(proxytype)
+       if(proxytype && c->outgoing)
                if(!send_proxyrequest(c))
                        return false;