Loading DnsTlsSocket.cpp +8 −16 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ #include "DnsTlsSessionCache.h" #include "IDnsTlsSocketObserver.h" #include <Fwmark.h> #include <android-base/logging.h> #include <android-base/stringprintf.h> #include <netdutils/SocketOption.h> Loading Loading @@ -72,13 +71,6 @@ int waitForWriting(int fd, int timeoutMs = -1) { return TEMP_FAILURE_RETRY(poll(&fds, 1, timeoutMs)); } std::string markToFwmarkString(unsigned mMark) { Fwmark mark; mark.intValue = mMark; return android::base::StringPrintf("%d, %d, %d, %d, %d", mark.netId, mark.explicitlySelected, mark.protectedFromVpn, mark.permission, mark.uidBillingDone); } } // namespace Status DnsTlsSocket::tcpConnect() { Loading Loading @@ -245,9 +237,9 @@ bssl::UniquePtr<SSL> DnsTlsSocket::sslConnect(int fd) { } for (;;) { LOG(DEBUG) << " Calling SSL_connect with " << markToFwmarkString(mMark); LOG(DEBUG) << " Calling SSL_connect with mark 0x" << std::hex << mMark; int ret = SSL_connect(ssl.get()); LOG(DEBUG) << " SSL_connect returned " << ret << " with " << markToFwmarkString(mMark); LOG(DEBUG) << " SSL_connect returned " << ret << " with mark 0x" << std::hex << mMark; if (ret == 1) break; // SSL handshake complete; const int ssl_err = SSL_get_error(ssl.get(), ret); Loading @@ -257,8 +249,8 @@ bssl::UniquePtr<SSL> DnsTlsSocket::sslConnect(int fd) { // the TCP connection handshake, the device is waiting for the SSL handshake reply // from the server. if (int err = waitForReading(fd, mServer.connectTimeout.count()); err <= 0) { PLOG(WARNING) << "SSL_connect read error " << err << ", " << markToFwmarkString(mMark); PLOG(WARNING) << "SSL_connect read error " << err << ", mark 0x" << std::hex << mMark; return nullptr; } break; Loading @@ -266,14 +258,14 @@ bssl::UniquePtr<SSL> DnsTlsSocket::sslConnect(int fd) { // If no application data is sent during the TCP connection handshake, the // device is waiting for the connection established to perform SSL handshake. if (int err = waitForWriting(fd, mServer.connectTimeout.count()); err <= 0) { PLOG(WARNING) << "SSL_connect write error " << err << ", " << markToFwmarkString(mMark); PLOG(WARNING) << "SSL_connect write error " << err << ", mark 0x" << std::hex << mMark; return nullptr; } break; default: PLOG(WARNING) << "SSL_connect ssl error =" << ssl_err << ", " << markToFwmarkString(mMark); PLOG(WARNING) << "SSL_connect ssl error =" << ssl_err << ", mark 0x" << std::hex << mMark; return nullptr; } } Loading Loading
DnsTlsSocket.cpp +8 −16 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ #include "DnsTlsSessionCache.h" #include "IDnsTlsSocketObserver.h" #include <Fwmark.h> #include <android-base/logging.h> #include <android-base/stringprintf.h> #include <netdutils/SocketOption.h> Loading Loading @@ -72,13 +71,6 @@ int waitForWriting(int fd, int timeoutMs = -1) { return TEMP_FAILURE_RETRY(poll(&fds, 1, timeoutMs)); } std::string markToFwmarkString(unsigned mMark) { Fwmark mark; mark.intValue = mMark; return android::base::StringPrintf("%d, %d, %d, %d, %d", mark.netId, mark.explicitlySelected, mark.protectedFromVpn, mark.permission, mark.uidBillingDone); } } // namespace Status DnsTlsSocket::tcpConnect() { Loading Loading @@ -245,9 +237,9 @@ bssl::UniquePtr<SSL> DnsTlsSocket::sslConnect(int fd) { } for (;;) { LOG(DEBUG) << " Calling SSL_connect with " << markToFwmarkString(mMark); LOG(DEBUG) << " Calling SSL_connect with mark 0x" << std::hex << mMark; int ret = SSL_connect(ssl.get()); LOG(DEBUG) << " SSL_connect returned " << ret << " with " << markToFwmarkString(mMark); LOG(DEBUG) << " SSL_connect returned " << ret << " with mark 0x" << std::hex << mMark; if (ret == 1) break; // SSL handshake complete; const int ssl_err = SSL_get_error(ssl.get(), ret); Loading @@ -257,8 +249,8 @@ bssl::UniquePtr<SSL> DnsTlsSocket::sslConnect(int fd) { // the TCP connection handshake, the device is waiting for the SSL handshake reply // from the server. if (int err = waitForReading(fd, mServer.connectTimeout.count()); err <= 0) { PLOG(WARNING) << "SSL_connect read error " << err << ", " << markToFwmarkString(mMark); PLOG(WARNING) << "SSL_connect read error " << err << ", mark 0x" << std::hex << mMark; return nullptr; } break; Loading @@ -266,14 +258,14 @@ bssl::UniquePtr<SSL> DnsTlsSocket::sslConnect(int fd) { // If no application data is sent during the TCP connection handshake, the // device is waiting for the connection established to perform SSL handshake. if (int err = waitForWriting(fd, mServer.connectTimeout.count()); err <= 0) { PLOG(WARNING) << "SSL_connect write error " << err << ", " << markToFwmarkString(mMark); PLOG(WARNING) << "SSL_connect write error " << err << ", mark 0x" << std::hex << mMark; return nullptr; } break; default: PLOG(WARNING) << "SSL_connect ssl error =" << ssl_err << ", " << markToFwmarkString(mMark); PLOG(WARNING) << "SSL_connect ssl error =" << ssl_err << ", mark 0x" << std::hex << mMark; return nullptr; } } Loading