Loading DnsTlsDispatcher.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -106,10 +106,10 @@ std::list<DnsTlsServer> DnsTlsDispatcher::getOrderedAndUsableServerList( } DnsTlsTransport::Response DnsTlsDispatcher::query(const std::list<DnsTlsServer>& tlsServers, res_state statp, const Slice query, ResState* statp, const Slice query, const Slice ans, int* resplen) { const std::list<DnsTlsServer> servers( getOrderedAndUsableServerList(tlsServers, statp->netid, statp->_mark)); getOrderedAndUsableServerList(tlsServers, statp->netid, statp->mark)); if (servers.empty()) LOG(WARNING) << "No usable DnsTlsServers"; Loading @@ -121,7 +121,7 @@ DnsTlsTransport::Response DnsTlsDispatcher::query(const std::list<DnsTlsServer>& bool connectTriggered = false; Stopwatch queryStopwatch; code = this->query(server, statp->netid, statp->_mark, query, ans, resplen, code = this->query(server, statp->netid, statp->mark, query, ans, resplen, &connectTriggered); dnsQueryEvent->set_latency_micros(saturate_cast<int32_t>(queryStopwatch.timeTakenUs())); Loading DnsTlsDispatcher.h +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ class DnsTlsDispatcher : public PrivateDnsValidationObserver { // The order in which servers from |tlsServers| are queried may not be the // order passed in by the caller. DnsTlsTransport::Response query(const std::list<DnsTlsServer>& tlsServers, res_state _Nonnull statp, const netdutils::Slice query, ResState* _Nonnull statp, const netdutils::Slice query, const netdutils::Slice ans, int* _Nonnull resplen); // Given a |query|, sends it to the server on the network indicated by |mark|, Loading DnsTlsTransport.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -301,11 +301,11 @@ bool DnsTlsTransport::validate(const DnsTlsServer& server, uint32_t mark) { // // For instance, with latencyFactor = 3 and latencyOffsetMs = 10, if UDP probe latency is 5 ms, // DoT probe latency must less than 25 ms. const bool versionHigherThanAndroidR = getApiLevel() >= 30; const bool isAtLeastR = getApiLevel() >= 30; int latencyFactor = Experiments::getInstance()->getFlag("dot_validation_latency_factor", (versionHigherThanAndroidR ? 3 : -1)); int latencyOffsetMs = Experiments::getInstance()->getFlag( "dot_validation_latency_offset_ms", (versionHigherThanAndroidR ? 100 : -1)); (isAtLeastR ? 3 : -1)); int latencyOffsetMs = Experiments::getInstance()->getFlag("dot_validation_latency_offset_ms", (isAtLeastR ? 100 : -1)); const bool shouldCompareUdpLatency = server.name.empty() && (latencyFactor >= 0 && latencyOffsetMs >= 0 && latencyFactor + latencyOffsetMs != 0); Loading getaddrinfo.cpp +13 −13 Original line number Diff line number Diff line Loading @@ -151,9 +151,9 @@ static bool files_getaddrinfo(const size_t netid, const char* name, const addrin addrinfo** res); static int _find_src_addr(const struct sockaddr*, struct sockaddr*, unsigned, uid_t); static int res_queryN(const char* name, res_target* target, res_state res, int* herrno); static int res_searchN(const char* name, res_target* target, res_state res, int* herrno); static int res_querydomainN(const char* name, const char* domain, res_target* target, res_state res, static int res_queryN(const char* name, res_target* target, ResState* res, int* herrno); static int res_searchN(const char* name, res_target* target, ResState* res, int* herrno); static int res_querydomainN(const char* name, const char* domain, res_target* target, ResState* res, int* herrno); const char* const ai_errlist[] = { Loading Loading @@ -1437,7 +1437,7 @@ static int dns_getaddrinfo(const char* name, const addrinfo* pai, ResState res(netcontext, event); setMdnsFlag(name, &(res._flags)); setMdnsFlag(name, &(res.flags)); int he; if (res_searchN(name, &q, &res, &he) < 0) { Loading Loading @@ -1609,7 +1609,7 @@ struct QueryResult { NetworkDnsEventReported event; }; QueryResult doQuery(const char* name, res_target* t, res_state res, QueryResult doQuery(const char* name, res_target* t, ResState* res, std::chrono::milliseconds sleepTimeMs) { HEADER* hp = (HEADER*)(void*)t->answer.data(); Loading Loading @@ -1653,7 +1653,7 @@ QueryResult doQuery(const char* name, res_target* t, res_state res, // if the query choked with EDNS0, retry without EDNS0 if ((res_temp.netcontext_flags & (NET_CONTEXT_FLAG_USE_DNS_OVER_TLS | NET_CONTEXT_FLAG_USE_EDNS)) && (res_temp._flags & RES_F_EDNS0ERR)) { (res_temp.flags & RES_F_EDNS0ERR)) { LOG(DEBUG) << __func__ << ": retry without EDNS0"; n = res_nmkquery(QUERY, name, cl, type, /*data=*/nullptr, /*datalen=*/0, buf, sizeof(buf), res_temp.netcontext_flags); Loading @@ -1674,7 +1674,7 @@ QueryResult doQuery(const char* name, res_target* t, res_state res, } // namespace static int res_queryN_parallel(const char* name, res_target* target, res_state res, int* herrno) { static int res_queryN_parallel(const char* name, res_target* target, ResState* res, int* herrno) { std::vector<std::future<QueryResult>> results; results.reserve(2); std::chrono::milliseconds sleepTimeMs{}; Loading Loading @@ -1713,7 +1713,7 @@ static int res_queryN_parallel(const char* name, res_target* target, res_state r return ancount; } static int res_queryN_wrapper(const char* name, res_target* target, res_state res, int* herrno) { static int res_queryN_wrapper(const char* name, res_target* target, ResState* res, int* herrno) { const bool parallel_lookup = android::net::Experiments::getInstance()->getFlag("parallel_lookup_release", 1); if (parallel_lookup) return res_queryN_parallel(name, target, res, herrno); Loading @@ -1731,7 +1731,7 @@ static int res_queryN_wrapper(const char* name, res_target* target, res_state re * * Caller must parse answer and determine whether it answers the question. */ static int res_queryN(const char* name, res_target* target, res_state res, int* herrno) { static int res_queryN(const char* name, res_target* target, ResState* res, int* herrno) { uint8_t buf[MAXPACKET]; int n; struct res_target* t; Loading Loading @@ -1780,7 +1780,7 @@ static int res_queryN(const char* name, res_target* target, res_state res, int* // we also has the same symptom if EDNS is enabled. if ((res->netcontext_flags & (NET_CONTEXT_FLAG_USE_DNS_OVER_TLS | NET_CONTEXT_FLAG_USE_EDNS)) && (res->_flags & RES_F_EDNS0ERR) && !retried) { (res->flags & RES_F_EDNS0ERR) && !retried) { LOG(DEBUG) << __func__ << ": retry without EDNS0"; retried = true; goto again; Loading @@ -1807,7 +1807,7 @@ static int res_queryN(const char* name, res_target* target, res_state res, int* * If enabled, implement search rules until answer or unrecoverable failure * is detected. Error code, if any, is left in *herrno. */ static int res_searchN(const char* name, res_target* target, res_state res, int* herrno) { static int res_searchN(const char* name, res_target* target, ResState* res, int* herrno) { const char* cp; HEADER* hp; uint32_t dots; Loading Loading @@ -1843,7 +1843,7 @@ static int res_searchN(const char* name, res_target* target, res_state res, int* * - there is at least one dot and there is no trailing dot. * - this is not a .local mDNS lookup. */ if ((!dots || (dots && !trailing_dot)) && !isMdnsResolution(res->_flags)) { if ((!dots || (dots && !trailing_dot)) && !isMdnsResolution(res->flags)) { int done = 0; /* Unfortunately we need to set stuff up before Loading Loading @@ -1924,7 +1924,7 @@ static int res_searchN(const char* name, res_target* target, res_state res, int* // Perform a call on res_query on the concatenation of name and domain, // removing a trailing dot from name if domain is NULL. static int res_querydomainN(const char* name, const char* domain, res_target* target, res_state res, static int res_querydomainN(const char* name, const char* domain, res_target* target, ResState* res, int* herrno) { char nbuf[MAXDNAME]; const char* longname = nbuf; Loading gethnamaddr.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -375,7 +375,7 @@ int resolv_gethostbyname(const char* name, int af, hostent* hp, char* buf, size_ getnamaddr info; ResState res(netcontext, event); setMdnsFlag(name, &(res._flags)); setMdnsFlag(name, &(res.flags)); size_t size; switch (af) { Loading Loading
DnsTlsDispatcher.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -106,10 +106,10 @@ std::list<DnsTlsServer> DnsTlsDispatcher::getOrderedAndUsableServerList( } DnsTlsTransport::Response DnsTlsDispatcher::query(const std::list<DnsTlsServer>& tlsServers, res_state statp, const Slice query, ResState* statp, const Slice query, const Slice ans, int* resplen) { const std::list<DnsTlsServer> servers( getOrderedAndUsableServerList(tlsServers, statp->netid, statp->_mark)); getOrderedAndUsableServerList(tlsServers, statp->netid, statp->mark)); if (servers.empty()) LOG(WARNING) << "No usable DnsTlsServers"; Loading @@ -121,7 +121,7 @@ DnsTlsTransport::Response DnsTlsDispatcher::query(const std::list<DnsTlsServer>& bool connectTriggered = false; Stopwatch queryStopwatch; code = this->query(server, statp->netid, statp->_mark, query, ans, resplen, code = this->query(server, statp->netid, statp->mark, query, ans, resplen, &connectTriggered); dnsQueryEvent->set_latency_micros(saturate_cast<int32_t>(queryStopwatch.timeTakenUs())); Loading
DnsTlsDispatcher.h +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ class DnsTlsDispatcher : public PrivateDnsValidationObserver { // The order in which servers from |tlsServers| are queried may not be the // order passed in by the caller. DnsTlsTransport::Response query(const std::list<DnsTlsServer>& tlsServers, res_state _Nonnull statp, const netdutils::Slice query, ResState* _Nonnull statp, const netdutils::Slice query, const netdutils::Slice ans, int* _Nonnull resplen); // Given a |query|, sends it to the server on the network indicated by |mark|, Loading
DnsTlsTransport.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -301,11 +301,11 @@ bool DnsTlsTransport::validate(const DnsTlsServer& server, uint32_t mark) { // // For instance, with latencyFactor = 3 and latencyOffsetMs = 10, if UDP probe latency is 5 ms, // DoT probe latency must less than 25 ms. const bool versionHigherThanAndroidR = getApiLevel() >= 30; const bool isAtLeastR = getApiLevel() >= 30; int latencyFactor = Experiments::getInstance()->getFlag("dot_validation_latency_factor", (versionHigherThanAndroidR ? 3 : -1)); int latencyOffsetMs = Experiments::getInstance()->getFlag( "dot_validation_latency_offset_ms", (versionHigherThanAndroidR ? 100 : -1)); (isAtLeastR ? 3 : -1)); int latencyOffsetMs = Experiments::getInstance()->getFlag("dot_validation_latency_offset_ms", (isAtLeastR ? 100 : -1)); const bool shouldCompareUdpLatency = server.name.empty() && (latencyFactor >= 0 && latencyOffsetMs >= 0 && latencyFactor + latencyOffsetMs != 0); Loading
getaddrinfo.cpp +13 −13 Original line number Diff line number Diff line Loading @@ -151,9 +151,9 @@ static bool files_getaddrinfo(const size_t netid, const char* name, const addrin addrinfo** res); static int _find_src_addr(const struct sockaddr*, struct sockaddr*, unsigned, uid_t); static int res_queryN(const char* name, res_target* target, res_state res, int* herrno); static int res_searchN(const char* name, res_target* target, res_state res, int* herrno); static int res_querydomainN(const char* name, const char* domain, res_target* target, res_state res, static int res_queryN(const char* name, res_target* target, ResState* res, int* herrno); static int res_searchN(const char* name, res_target* target, ResState* res, int* herrno); static int res_querydomainN(const char* name, const char* domain, res_target* target, ResState* res, int* herrno); const char* const ai_errlist[] = { Loading Loading @@ -1437,7 +1437,7 @@ static int dns_getaddrinfo(const char* name, const addrinfo* pai, ResState res(netcontext, event); setMdnsFlag(name, &(res._flags)); setMdnsFlag(name, &(res.flags)); int he; if (res_searchN(name, &q, &res, &he) < 0) { Loading Loading @@ -1609,7 +1609,7 @@ struct QueryResult { NetworkDnsEventReported event; }; QueryResult doQuery(const char* name, res_target* t, res_state res, QueryResult doQuery(const char* name, res_target* t, ResState* res, std::chrono::milliseconds sleepTimeMs) { HEADER* hp = (HEADER*)(void*)t->answer.data(); Loading Loading @@ -1653,7 +1653,7 @@ QueryResult doQuery(const char* name, res_target* t, res_state res, // if the query choked with EDNS0, retry without EDNS0 if ((res_temp.netcontext_flags & (NET_CONTEXT_FLAG_USE_DNS_OVER_TLS | NET_CONTEXT_FLAG_USE_EDNS)) && (res_temp._flags & RES_F_EDNS0ERR)) { (res_temp.flags & RES_F_EDNS0ERR)) { LOG(DEBUG) << __func__ << ": retry without EDNS0"; n = res_nmkquery(QUERY, name, cl, type, /*data=*/nullptr, /*datalen=*/0, buf, sizeof(buf), res_temp.netcontext_flags); Loading @@ -1674,7 +1674,7 @@ QueryResult doQuery(const char* name, res_target* t, res_state res, } // namespace static int res_queryN_parallel(const char* name, res_target* target, res_state res, int* herrno) { static int res_queryN_parallel(const char* name, res_target* target, ResState* res, int* herrno) { std::vector<std::future<QueryResult>> results; results.reserve(2); std::chrono::milliseconds sleepTimeMs{}; Loading Loading @@ -1713,7 +1713,7 @@ static int res_queryN_parallel(const char* name, res_target* target, res_state r return ancount; } static int res_queryN_wrapper(const char* name, res_target* target, res_state res, int* herrno) { static int res_queryN_wrapper(const char* name, res_target* target, ResState* res, int* herrno) { const bool parallel_lookup = android::net::Experiments::getInstance()->getFlag("parallel_lookup_release", 1); if (parallel_lookup) return res_queryN_parallel(name, target, res, herrno); Loading @@ -1731,7 +1731,7 @@ static int res_queryN_wrapper(const char* name, res_target* target, res_state re * * Caller must parse answer and determine whether it answers the question. */ static int res_queryN(const char* name, res_target* target, res_state res, int* herrno) { static int res_queryN(const char* name, res_target* target, ResState* res, int* herrno) { uint8_t buf[MAXPACKET]; int n; struct res_target* t; Loading Loading @@ -1780,7 +1780,7 @@ static int res_queryN(const char* name, res_target* target, res_state res, int* // we also has the same symptom if EDNS is enabled. if ((res->netcontext_flags & (NET_CONTEXT_FLAG_USE_DNS_OVER_TLS | NET_CONTEXT_FLAG_USE_EDNS)) && (res->_flags & RES_F_EDNS0ERR) && !retried) { (res->flags & RES_F_EDNS0ERR) && !retried) { LOG(DEBUG) << __func__ << ": retry without EDNS0"; retried = true; goto again; Loading @@ -1807,7 +1807,7 @@ static int res_queryN(const char* name, res_target* target, res_state res, int* * If enabled, implement search rules until answer or unrecoverable failure * is detected. Error code, if any, is left in *herrno. */ static int res_searchN(const char* name, res_target* target, res_state res, int* herrno) { static int res_searchN(const char* name, res_target* target, ResState* res, int* herrno) { const char* cp; HEADER* hp; uint32_t dots; Loading Loading @@ -1843,7 +1843,7 @@ static int res_searchN(const char* name, res_target* target, res_state res, int* * - there is at least one dot and there is no trailing dot. * - this is not a .local mDNS lookup. */ if ((!dots || (dots && !trailing_dot)) && !isMdnsResolution(res->_flags)) { if ((!dots || (dots && !trailing_dot)) && !isMdnsResolution(res->flags)) { int done = 0; /* Unfortunately we need to set stuff up before Loading Loading @@ -1924,7 +1924,7 @@ static int res_searchN(const char* name, res_target* target, res_state res, int* // Perform a call on res_query on the concatenation of name and domain, // removing a trailing dot from name if domain is NULL. static int res_querydomainN(const char* name, const char* domain, res_target* target, res_state res, static int res_querydomainN(const char* name, const char* domain, res_target* target, ResState* res, int* herrno) { char nbuf[MAXDNAME]; const char* longname = nbuf; Loading
gethnamaddr.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -375,7 +375,7 @@ int resolv_gethostbyname(const char* name, int af, hostent* hp, char* buf, size_ getnamaddr info; ResState res(netcontext, event); setMdnsFlag(name, &(res._flags)); setMdnsFlag(name, &(res.flags)); size_t size; switch (af) { Loading