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

Commit a0e280c2 authored by Ken Chen's avatar Ken Chen Committed by Gerrit Code Review
Browse files

Merge "Support alternative handling on truncated DNS response"

parents c484a71a 9934488b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ aidl_interface {
    srcs: [
        "binder/android/net/IDnsResolver.aidl",
        "binder/android/net/ResolverHostsParcel.aidl",
        "binder/android/net/ResolverExperimentalOptionsParcel.aidl",
        "binder/android/net/ResolverParamsParcel.aidl",
    ],
    imports: [
+3 −1
Original line number Diff line number Diff line
@@ -232,7 +232,8 @@ int ResolverController::setResolverConfiguration(const ResolverParamsParcel& res
    res_params.retry_count = resolverParams.retryCount;

    return resolv_set_nameservers(resolverParams.netId, resolverParams.servers,
                                  resolverParams.domains, res_params, resolverParams.hosts);
                                  resolverParams.domains, res_params,
                                  resolverParams.experimentalOptions);
}

int ResolverController::getResolverInfo(int32_t netId, std::vector<std::string>* servers,
@@ -362,6 +363,7 @@ void ResolverController::dump(DumpWriter& dw, unsigned netId) {
        }
        dw.println("Concurrent DNS query timeout: %d", wait_for_pending_req_timeout_count[0]);
        resolv_stats_dump(dw, netId);
        resolv_oem_options_dump(dw, netId);
    }
    dw.decIndent();
}
+12 −0
Original line number Diff line number Diff line
@@ -170,4 +170,16 @@ interface IDnsResolver {
     *         POSIX errno.
     */
    void flushNetworkCache(int netId);

    /**
     * Values for {@code tcMode} of {@code ResolverExperimentalOptionsParcel}. It controls the way DNS
     * resolver handles truncated DNS response from UDP connection.
     *
     * TC_MODE_DEFAULT: resolver retries on TCP-only on each name server.
     * TC_MODE_UDP_TCP: resolver retries on TCP on the same server, falls back to UDP from next.
     * TC_MODE_MAX: any value smaller than TC_MODE_DEFAULT or greater than TC_MODE_MAX is invalid.
     */
    const int TC_MODE_DEFAULT = 0;
    const int TC_MODE_UDP_TCP = 1;
    const int TC_MODE_MAX = 2;
}
+46 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.net;

import android.net.ResolverHostsParcel;

/**
 * Knobs for OEM to control alternative behavior.
 *
 * {@hide}
 */
parcelable ResolverExperimentalOptionsParcel {
    /**
     * An IP/hostname mapping table for DNS local lookup customization.
     * WARNING: this is intended for local testing and other special situations.
     * Future versions of the DnsResolver module may break your assumptions.
     * Injecting static mappings for public hostnames is generally A VERY BAD IDEA,
     * since it makes it impossible for the domain owners to migrate the domain.
     * It is also not an effective domain blocking mechanism, because apps can
     * easily hardcode IPs or bypass the system DNS resolver.
     */
    ResolverHostsParcel[] hosts = {};

    /**
     * Truncated UDP DNS response handling mode. Handling of UDP responses with the TC (truncated)
     * bit set. The values are defined in {@code IDnsResolver.aidl}
     * 0: TC_MODE_DEFAULT
     * 1: TC_MODE_UDP_TCP
     * Other values are invalid.
     */
    int tcMode = 0;
}
+4 −10
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@

package android.net;

import android.net.ResolverHostsParcel;
import android.net.ResolverExperimentalOptionsParcel;

/**
 * Configuration for a resolver parameters.
@@ -101,13 +101,7 @@ parcelable ResolverParamsParcel {
    int tlsConnectTimeoutMs = 0;

    /**
     * An IP/hostname mapping table for DNS local lookup customization.
     * WARNING: this is intended for local testing and other special situations.
     * Future versions of the DnsResolver module may break your assumptions.
     * Injecting static mappings for public hostnames is generally A VERY BAD IDEA,
     * since it makes it impossible for the domain owners to migrate the domain.
     * It is also not an effective domain blocking mechanism, because apps can
     * easily hardcode IPs or bypass the system DNS resolver.
    * Knobs for OEM to control alternative behavior.
    */
    ResolverHostsParcel[] hosts = {};
    ResolverExperimentalOptionsParcel experimentalOptions;
}
Loading