QSocks5SocketEngine: Remove too optimistic check for UDP proxy setup

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 <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Alexander Akulich 2018-11-06 16:51:31 +03:00 committed by Alexandr Akulich
parent a545b85bdd
commit 7b9de1d4da

View File

@ -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
}