Loading DnsTlsDispatcher.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ std::list<DnsTlsServer> DnsTlsDispatcher::getOrderedAndUsableServerList( if (!xport->usable()) { // Don't use this xport. It will be removed after timeout // (IDLE_TIMEOUT minutes). LOG(DEBUG) << "Skip using DoT server " << tlsServer.toIpString() << " on " LOG(DEBUG) << "Skip using DoT server " << tlsServer.toString() << " on " << netId; continue; } Loading Loading @@ -231,7 +231,7 @@ DnsTlsTransport::Response DnsTlsDispatcher::query(const DnsTlsServer& server, un // a new xport will be created. const auto result = PrivateDnsConfiguration::getInstance().requestDotValidation( netId, PrivateDnsConfiguration::ServerIdentity{server}, mark); LOG(WARNING) << "Requested validation for " << server.toIpString() << " with mark 0x" LOG(WARNING) << "Requested validation for " << server.toString() << " with mark 0x" << std::hex << mark << ", " << (result.ok() ? "succeeded" : "failed: " + result.error().message()); } Loading Loading @@ -327,7 +327,7 @@ DnsTlsDispatcher::Transport* DnsTlsDispatcher::addTransport(const DnsTlsServer& ret = new Transport(server, mark, netId, mFactory.get(), triggerThr, unusableThr, queryTimeout); LOG(INFO) << "Transport is initialized with { " << triggerThr << ", " << unusableThr << ", " << queryTimeout << "ms }" << " for server { " << server.toIpString() << "/" << server.name << " }"; << " for server " << server.toString(); mStore[key].reset(ret); Loading DnsTlsServer.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include <algorithm> #include <android-base/format.h> #include <netdutils/InternetAddresses.h> namespace { Loading Loading @@ -130,5 +131,9 @@ std::string DnsTlsServer::toIpString() const { return netdutils::IPSockAddr::toIPSockAddr(ss).ip().toString(); } std::string DnsTlsServer::toString() const { return fmt::format("{{{}/{}}}", toIpString(), name); } } // namespace net } // namespace android DnsTlsServer.h +1 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ struct DnsTlsServer { bool wasExplicitlyConfigured() const; std::string toIpString() const; std::string toString() const; std::string provider() const { return name; } netdutils::IPSockAddr addr() const { return netdutils::IPSockAddr::toIPSockAddr(ss); } Loading DnsTlsSocket.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ int waitForWriting(int fd, int timeoutMs = -1) { Status DnsTlsSocket::tcpConnect() { if (mServer.protocol != IPPROTO_TCP) return Status(EPROTONOSUPPORT); LOG(DEBUG) << mMark << " connecting TCP socket"; LOG(INFO) << fmt::format("Connecting to {} with mark 0x{:x}", mServer.toString(), mMark); mSslFd.reset(socket(mServer.ss.ss_family, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0)); if (mSslFd.get() == -1) { Loading Loading @@ -270,7 +270,7 @@ bssl::UniquePtr<SSL> DnsTlsSocket::sslConnect(int fd) { for (;;) { LOG(DEBUG) << " Calling SSL_connect with mark 0x" << std::hex << mMark; int ret = SSL_connect(ssl.get()); LOG(DEBUG) << " SSL_connect returned " << ret << " with mark 0x" << std::hex << mMark; LOG(INFO) << " 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 Loading @@ -315,7 +315,7 @@ bssl::UniquePtr<SSL> DnsTlsSocket::sslConnectV2(int fd) { for (;;) { LOG(DEBUG) << " Calling SSL_connect with mark 0x" << std::hex << mMark; int ret = SSL_connect(ssl.get()); LOG(DEBUG) << " SSL_connect returned " << ret << " with mark 0x" << std::hex << mMark; LOG(INFO) << " SSL_connect returned " << ret << " with mark 0x" << std::hex << mMark; if (ret == 1) break; // SSL handshake complete; enum { SSLFD = 0, EVENTFD = 1 }; Loading Loading @@ -445,7 +445,7 @@ void DnsTlsSocket::loop() { break; } if (s < 0) { PLOG(DEBUG) << "Poll failed"; PLOG(WARNING) << "Poll failed"; break; } if (fds[SSLFD].revents & (POLLIN | POLLERR | POLLHUP)) { Loading @@ -457,7 +457,7 @@ void DnsTlsSocket::loop() { // refactoring it to not get blocked in any case. do { if (!readResponse()) { LOG(DEBUG) << "SSL remote close or read error."; LOG(INFO) << "SSL remote close or read error."; readFailed = true; } } while (SSL_pending(mSsl.get()) > 0 && !readFailed); Loading Loading @@ -496,7 +496,7 @@ void DnsTlsSocket::loop() { q.pop_front(); } } LOG(DEBUG) << "Disconnecting"; LOG(INFO) << fmt::format("Disconnecting {}, mark 0x{:x}", mServer.toString(), mMark); sslDisconnect(); LOG(DEBUG) << "Calling onClosed"; mObserver->onClosed(); Loading PrivateDnsConfiguration.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -365,11 +365,11 @@ void PrivateDnsConfiguration::startDotValidation(const ServerIdentity& identity, while (true) { // ::validate() is a blocking call that performs network operations. // It can take milliseconds to minutes, up to the SYN retry limit. LOG(WARNING) << "Validating DnsTlsServer " << server.toIpString() << " with mark 0x" LOG(WARNING) << "Validating DnsTlsServer " << server.toString() << " with mark 0x" << std::hex << server.validationMark(); const bool success = DnsTlsTransport::validate(server, server.validationMark()); LOG(WARNING) << "validateDnsTlsServer returned " << success << " for " << server.toIpString(); << server.toString(); const bool needs_reeval = this->recordDotValidation(identity, netId, success, isRevalidation); Loading Loading
DnsTlsDispatcher.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ std::list<DnsTlsServer> DnsTlsDispatcher::getOrderedAndUsableServerList( if (!xport->usable()) { // Don't use this xport. It will be removed after timeout // (IDLE_TIMEOUT minutes). LOG(DEBUG) << "Skip using DoT server " << tlsServer.toIpString() << " on " LOG(DEBUG) << "Skip using DoT server " << tlsServer.toString() << " on " << netId; continue; } Loading Loading @@ -231,7 +231,7 @@ DnsTlsTransport::Response DnsTlsDispatcher::query(const DnsTlsServer& server, un // a new xport will be created. const auto result = PrivateDnsConfiguration::getInstance().requestDotValidation( netId, PrivateDnsConfiguration::ServerIdentity{server}, mark); LOG(WARNING) << "Requested validation for " << server.toIpString() << " with mark 0x" LOG(WARNING) << "Requested validation for " << server.toString() << " with mark 0x" << std::hex << mark << ", " << (result.ok() ? "succeeded" : "failed: " + result.error().message()); } Loading Loading @@ -327,7 +327,7 @@ DnsTlsDispatcher::Transport* DnsTlsDispatcher::addTransport(const DnsTlsServer& ret = new Transport(server, mark, netId, mFactory.get(), triggerThr, unusableThr, queryTimeout); LOG(INFO) << "Transport is initialized with { " << triggerThr << ", " << unusableThr << ", " << queryTimeout << "ms }" << " for server { " << server.toIpString() << "/" << server.name << " }"; << " for server " << server.toString(); mStore[key].reset(ret); Loading
DnsTlsServer.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include <algorithm> #include <android-base/format.h> #include <netdutils/InternetAddresses.h> namespace { Loading Loading @@ -130,5 +131,9 @@ std::string DnsTlsServer::toIpString() const { return netdutils::IPSockAddr::toIPSockAddr(ss).ip().toString(); } std::string DnsTlsServer::toString() const { return fmt::format("{{{}/{}}}", toIpString(), name); } } // namespace net } // namespace android
DnsTlsServer.h +1 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ struct DnsTlsServer { bool wasExplicitlyConfigured() const; std::string toIpString() const; std::string toString() const; std::string provider() const { return name; } netdutils::IPSockAddr addr() const { return netdutils::IPSockAddr::toIPSockAddr(ss); } Loading
DnsTlsSocket.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ int waitForWriting(int fd, int timeoutMs = -1) { Status DnsTlsSocket::tcpConnect() { if (mServer.protocol != IPPROTO_TCP) return Status(EPROTONOSUPPORT); LOG(DEBUG) << mMark << " connecting TCP socket"; LOG(INFO) << fmt::format("Connecting to {} with mark 0x{:x}", mServer.toString(), mMark); mSslFd.reset(socket(mServer.ss.ss_family, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0)); if (mSslFd.get() == -1) { Loading Loading @@ -270,7 +270,7 @@ bssl::UniquePtr<SSL> DnsTlsSocket::sslConnect(int fd) { for (;;) { LOG(DEBUG) << " Calling SSL_connect with mark 0x" << std::hex << mMark; int ret = SSL_connect(ssl.get()); LOG(DEBUG) << " SSL_connect returned " << ret << " with mark 0x" << std::hex << mMark; LOG(INFO) << " 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 Loading @@ -315,7 +315,7 @@ bssl::UniquePtr<SSL> DnsTlsSocket::sslConnectV2(int fd) { for (;;) { LOG(DEBUG) << " Calling SSL_connect with mark 0x" << std::hex << mMark; int ret = SSL_connect(ssl.get()); LOG(DEBUG) << " SSL_connect returned " << ret << " with mark 0x" << std::hex << mMark; LOG(INFO) << " SSL_connect returned " << ret << " with mark 0x" << std::hex << mMark; if (ret == 1) break; // SSL handshake complete; enum { SSLFD = 0, EVENTFD = 1 }; Loading Loading @@ -445,7 +445,7 @@ void DnsTlsSocket::loop() { break; } if (s < 0) { PLOG(DEBUG) << "Poll failed"; PLOG(WARNING) << "Poll failed"; break; } if (fds[SSLFD].revents & (POLLIN | POLLERR | POLLHUP)) { Loading @@ -457,7 +457,7 @@ void DnsTlsSocket::loop() { // refactoring it to not get blocked in any case. do { if (!readResponse()) { LOG(DEBUG) << "SSL remote close or read error."; LOG(INFO) << "SSL remote close or read error."; readFailed = true; } } while (SSL_pending(mSsl.get()) > 0 && !readFailed); Loading Loading @@ -496,7 +496,7 @@ void DnsTlsSocket::loop() { q.pop_front(); } } LOG(DEBUG) << "Disconnecting"; LOG(INFO) << fmt::format("Disconnecting {}, mark 0x{:x}", mServer.toString(), mMark); sslDisconnect(); LOG(DEBUG) << "Calling onClosed"; mObserver->onClosed(); Loading
PrivateDnsConfiguration.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -365,11 +365,11 @@ void PrivateDnsConfiguration::startDotValidation(const ServerIdentity& identity, while (true) { // ::validate() is a blocking call that performs network operations. // It can take milliseconds to minutes, up to the SYN retry limit. LOG(WARNING) << "Validating DnsTlsServer " << server.toIpString() << " with mark 0x" LOG(WARNING) << "Validating DnsTlsServer " << server.toString() << " with mark 0x" << std::hex << server.validationMark(); const bool success = DnsTlsTransport::validate(server, server.validationMark()); LOG(WARNING) << "validateDnsTlsServer returned " << success << " for " << server.toIpString(); << server.toString(); const bool needs_reeval = this->recordDotValidation(identity, netId, success, isRevalidation); Loading