Loading Android.bp +30 −0 Original line number Diff line number Diff line Loading @@ -147,6 +147,9 @@ cc_defaults { suffix: "64", }, }, data: [ ":resolv_test_keys", ], } cc_library { Loading Loading @@ -374,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", } 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 versionHigherThanAndroidR = 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)); 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 apex/Android.bp +4 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,10 @@ apex { // Use a custom AndroidManifest.xml used for API targeting. androidManifest: "AndroidManifest.xml", // Indicates that pre-installed version of this apex can be compressed. // Whether it actually will be compressed is controlled on per-device basis. compressible: true, // IMPORTANT: For the APEX to be installed on Android 10, // min_sdk_version should be 29. This enables the build system to make // sure the package compatible to Android 10 in two ways: Loading getaddrinfo.cpp +6 −3 Original line number Diff line number Diff line Loading @@ -1437,6 +1437,8 @@ static int dns_getaddrinfo(const char* name, const addrinfo* pai, ResState res(netcontext, event); setMdnsFlag(name, &(res._flags)); int he; if (res_searchN(name, &q, &res, &he) < 0) { // Return h_errno (he) to catch more detailed errors rather than EAI_NODATA. Loading Loading @@ -1839,8 +1841,9 @@ static int res_searchN(const char* name, res_target* target, res_state res, int* * We do at least one level of search if * - there is no dot, or * - there is at least one dot and there is no trailing dot. * - this is not a .local mDNS lookup. */ if ((!dots) || (dots && !trailing_dot)) { if ((!dots || (dots && !trailing_dot)) && !isMdnsResolution(res->_flags)) { int done = 0; /* Unfortunately we need to set stuff up before Loading Loading
Android.bp +30 −0 Original line number Diff line number Diff line Loading @@ -147,6 +147,9 @@ cc_defaults { suffix: "64", }, }, data: [ ":resolv_test_keys", ], } cc_library { Loading Loading @@ -374,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", }
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 versionHigherThanAndroidR = 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)); 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
apex/Android.bp +4 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,10 @@ apex { // Use a custom AndroidManifest.xml used for API targeting. androidManifest: "AndroidManifest.xml", // Indicates that pre-installed version of this apex can be compressed. // Whether it actually will be compressed is controlled on per-device basis. compressible: true, // IMPORTANT: For the APEX to be installed on Android 10, // min_sdk_version should be 29. This enables the build system to make // sure the package compatible to Android 10 in two ways: Loading
getaddrinfo.cpp +6 −3 Original line number Diff line number Diff line Loading @@ -1437,6 +1437,8 @@ static int dns_getaddrinfo(const char* name, const addrinfo* pai, ResState res(netcontext, event); setMdnsFlag(name, &(res._flags)); int he; if (res_searchN(name, &q, &res, &he) < 0) { // Return h_errno (he) to catch more detailed errors rather than EAI_NODATA. Loading Loading @@ -1839,8 +1841,9 @@ static int res_searchN(const char* name, res_target* target, res_state res, int* * We do at least one level of search if * - there is no dot, or * - there is at least one dot and there is no trailing dot. * - this is not a .local mDNS lookup. */ if ((!dots) || (dots && !trailing_dot)) { if ((!dots || (dots && !trailing_dot)) && !isMdnsResolution(res->_flags)) { int done = 0; /* Unfortunately we need to set stuff up before Loading