From 7b9de1d4da67573d6bb0a6bf2fb0cdd1b7fb86a3 Mon Sep 17 00:00:00 2001 From: Alexander Akulich Date: Tue, 6 Nov 2018 16:51:31 +0300 Subject: [PATCH] QSocks5SocketEngine: Remove too optimistic check for UDP proxy setup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The engine used to send a UDP datagram to the local address to check the proxy setup, but the check fails in case of the proxy hosted in WAN and the local address hidden behind a NAT. In other words the check fails because a public proxy hosted somewhere in internet has no access to local addresses such as 192.168.1.2. Remove the check to fix the issue; we still have other means to detect network errors. Change-Id: Ib6df263c87ebd7d6e88a0b5e024e78a559995234 Reviewed-by: Thiago Macieira Reviewed-by: Edward Welbourne Reviewed-by: MÃ¥rten Nordheim --- src/network/socket/qsocks5socketengine.cpp | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp index a07ea650469..dd2bc908558 100644 --- a/src/network/socket/qsocks5socketengine.cpp +++ b/src/network/socket/qsocks5socketengine.cpp @@ -1383,23 +1383,6 @@ bool QSocks5SocketEngine::bind(const QHostAddress &addr, quint16 port) d->localAddress = QHostAddress(); d->udpData->associatePort = d->localPort; d->localPort = 0; - QUdpSocket dummy; -#ifndef QT_NO_BEARERMANAGEMENT - dummy.setProperty("_q_networksession", property("_q_networksession")); -#endif - dummy.setProxy(QNetworkProxy::NoProxy); - if (!dummy.bind() - || writeDatagram(0,0, QIpPacketHeader(d->data->controlSocket->localAddress(), dummy.localPort())) != 0 - || !dummy.waitForReadyRead(qt_subtract_from_timeout(msecs, stopWatch.elapsed())) - || dummy.readDatagram(0,0, &d->localAddress, &d->localPort) != 0) { - QSOCKS5_DEBUG << "udp actual address and port lookup failed"; - setState(QAbstractSocket::UnconnectedState); - setError(dummy.error(), dummy.errorString()); - d->data->controlSocket->close(); - //### reset and error - return false; - } - QSOCKS5_DEBUG << "udp actual address and port" << d->localAddress << ':' << d->localPort; return true; #endif // QT_NO_UDPSOCKET }