Loading Android.bp +34 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,10 @@ aidl_interface { cc_defaults { name: "resolv_test_defaults", cflags: [ // networkCreatePhysical and networkCreateVpn were deprecated from netd_aidl_interface v6. "-Wno-error=deprecated-declarations", ], // Note that, static link liblog and libbase is a hard requirement for resolv related tests // because libbase is not compatible between Q and R for general platform build due // to its log revelant functions changing. And most of resolv related tests must be able to run Loading Loading @@ -143,6 +147,9 @@ cc_defaults { suffix: "64", }, }, data: [ ":resolv_test_keys", ], } cc_library { Loading Loading @@ -370,3 +377,30 @@ rust_test { ], min_sdk_version: "29", } // It's required by unit tests. rust_ffi_static { name: "libdoh_ffi_for_test", crate_name: "doh", srcs: ["doh.rs"], edition: "2018", rlibs: [ "libandroid_logger", "libanyhow", "liblazy_static", "liblibc", "liblog_rust", "libquiche_static", "libring", "libtokio", "liburl", ], prefer_rlib: true, apex_available: [ "//apex_available:platform", // Needed by doh_ffi_test "com.android.resolv" ], min_sdk_version: "29", } 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 +5 −3 Original line number Diff line number Diff line Loading @@ -301,9 +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. int latencyFactor = Experiments::getInstance()->getFlag("dot_validation_latency_factor", -1); int latencyOffsetMs = Experiments::getInstance()->getFlag("dot_validation_latency_offset_ms", -1); const bool isAtLeastR = getApiLevel() >= 30; int latencyFactor = Experiments::getInstance()->getFlag("dot_validation_latency_factor", (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 Experiments.h +1 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ class Experiments { "dot_query_timeout_ms", "dot_validation_latency_factor", "dot_validation_latency_offset_ms", "doh", }; // This value is used in updateInternal as the default value if any flags can't be found. static constexpr int kFlagIntDefault = INT_MIN; Loading Loading
Android.bp +34 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,10 @@ aidl_interface { cc_defaults { name: "resolv_test_defaults", cflags: [ // networkCreatePhysical and networkCreateVpn were deprecated from netd_aidl_interface v6. "-Wno-error=deprecated-declarations", ], // Note that, static link liblog and libbase is a hard requirement for resolv related tests // because libbase is not compatible between Q and R for general platform build due // to its log revelant functions changing. And most of resolv related tests must be able to run Loading Loading @@ -143,6 +147,9 @@ cc_defaults { suffix: "64", }, }, data: [ ":resolv_test_keys", ], } cc_library { Loading Loading @@ -370,3 +377,30 @@ rust_test { ], min_sdk_version: "29", } // It's required by unit tests. rust_ffi_static { name: "libdoh_ffi_for_test", crate_name: "doh", srcs: ["doh.rs"], edition: "2018", rlibs: [ "libandroid_logger", "libanyhow", "liblazy_static", "liblibc", "liblog_rust", "libquiche_static", "libring", "libtokio", "liburl", ], prefer_rlib: true, apex_available: [ "//apex_available:platform", // Needed by doh_ffi_test "com.android.resolv" ], min_sdk_version: "29", }
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 +5 −3 Original line number Diff line number Diff line Loading @@ -301,9 +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. int latencyFactor = Experiments::getInstance()->getFlag("dot_validation_latency_factor", -1); int latencyOffsetMs = Experiments::getInstance()->getFlag("dot_validation_latency_offset_ms", -1); const bool isAtLeastR = getApiLevel() >= 30; int latencyFactor = Experiments::getInstance()->getFlag("dot_validation_latency_factor", (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
Experiments.h +1 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ class Experiments { "dot_query_timeout_ms", "dot_validation_latency_factor", "dot_validation_latency_offset_ms", "doh", }; // This value is used in updateInternal as the default value if any flags can't be found. static constexpr int kFlagIntDefault = INT_MIN; Loading