Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7be0fc49 authored by Mike Yu's avatar Mike Yu
Browse files

Enable DNS probe in DoT validation by default in R

The flags are set as follows by default:
dot_validation_latency_factor = 3
dot_validation_latency_offset_ms = 100

Due to the flag default value changed, TlsServerRevalidation test
is modified.

Bug: 188153519
Test: with the two flags unset, run resolv_integration_test twice
Test: with the two flags unset, cd packages/modules/DnsResolver && atest
Test: with the two flags set to -1, run resolv_integration_test twice
Test: with the two flags set to -1, cd packages/modules/DnsResolver && atest
Change-Id: If80569a98244817b69909319f0c1a3b7523354cf
parent af130a4c
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -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);
+11 −2
Original line number Diff line number Diff line
@@ -4760,8 +4760,17 @@ TEST_F(ResolverTest, TlsServerRevalidation) {
        resetNetwork();

        // This test is sensitive to the number of queries sent in DoT validation.
        const int latencyFactor = std::stoi(GetProperty(kDotValidationLatencyFactorFlag, "-1"));
        const int latencyOffsetMs = std::stoi(GetProperty(kDotValidationLatencyOffsetMsFlag, "-1"));
        int latencyFactor;
        int latencyOffsetMs;
        if (isAtLeastR) {
            // The feature is enabled by default in R.
            latencyFactor = std::stoi(GetProperty(kDotValidationLatencyFactorFlag, "3"));
            latencyOffsetMs = std::stoi(GetProperty(kDotValidationLatencyOffsetMsFlag, "100"));
        } else {
            // The feature is disabled by default in Q.
            latencyFactor = std::stoi(GetProperty(kDotValidationLatencyFactorFlag, "-1"));
            latencyOffsetMs = std::stoi(GetProperty(kDotValidationLatencyOffsetMsFlag, "-1"));
        }
        const bool dotValidationExtraProbes = (config.dnsMode == "OPPORTUNISTIC") &&
                                              (latencyFactor >= 0 && latencyOffsetMs >= 0 &&
                                               latencyFactor + latencyOffsetMs != 0);