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

Commit ea124320 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 7607159 from c7ea829f to tm-d1-release

Change-Id: I1d65dec7c175cc374eea3a4c4894a44b12bb6f22
parents 30ff7a21 c7ea829f
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include <android-base/format.h>
#include <android-base/logging.h>
#include <android-base/stringprintf.h>
#include <android/binder_ibinder.h>
#include <netdutils/Slice.h>
#include <netdutils/ThreadUtil.h>
#include <sys/socket.h>
@@ -444,6 +445,9 @@ int PrivateDnsConfiguration::setDoh(int32_t netId, uint32_t mark,
        const auto& doh = entry.getDohIdentity(sortedServers, name);
        if (!doh.ok()) continue;

        // The internal tests are supposed to have root permission.
        if (entry.forTesting && AIBinder_getCallingUid() != AID_ROOT) continue;

        auto it = mDohTracker.find(netId);
        // Skip if the same server already exists and its status == success.
        if (it != mDohTracker.end() && it->second == doh.value() &&
+13 −3
Original line number Diff line number Diff line
@@ -200,6 +200,7 @@ class PrivateDnsConfiguration {
        std::set<std::string> ips;
        std::string host;
        std::string httpsTemplate;
        bool forTesting;
        base::Result<DohIdentity> getDohIdentity(const std::vector<std::string>& ips,
                                                 const std::string& host) const {
            if (!host.empty() && this->host != host) return Errorf("host {} not matched", host);
@@ -215,15 +216,24 @@ class PrivateDnsConfiguration {

    // TODO: Move below DoH relevant stuff into Rust implementation.
    std::map<unsigned, DohIdentity> mDohTracker GUARDED_BY(mPrivateDnsLock);
    std::array<DohProviderEntry, 2> mAvailableDoHProviders = {{
    std::array<DohProviderEntry, 3> mAvailableDoHProviders = {{
            {"Google",
             {"2001:4860:4860::8888", "2001:4860:4860::8844", "8.8.8.8", "8.8.4.4"},
             "dns.google",
             "https://dns.google/dns-query"},
             "https://dns.google/dns-query",
             false},
            {"Cloudflare",
             {"2606:4700::6810:f8f9", "2606:4700::6810:f9f9", "104.16.248.249", "104.16.249.249"},
             "cloudflare-dns.com",
             "https://cloudflare-dns.com/dns-query"},
             "https://cloudflare-dns.com/dns-query",
             false},

            // The DoH provider for testing.
            {"ResolverTestProvider",
             {"127.0.0.3", "::1"},
             "example.com",
             "https://example.com/dns-query",
             true},
    }};

    struct RecordEntry {
+3 −0
Original line number Diff line number Diff line
@@ -160,7 +160,9 @@ cc_test {
    srcs: [
        "dns_responder/dns_responder.cpp",
        "dnsresolver_binder_test.cpp",
        "doh_frontend.cpp",
        "resolv_integration_test.cpp",
        "resolv_private_dns_test.cpp",
        "tun_forwarder.cpp",
    ],
    header_libs: [
@@ -188,6 +190,7 @@ cc_test {
        "netd_event_listener_interface-lateststable-ndk_platform",
        "libipchecksum",
        "resolv_unsolicited_listener",
        "libdoh_frontend_ffi",
    ],
    // This test talks to the DnsResolver module over a binary protocol on a socket, so keep it as
    // multilib setting is worth because we might be able to get some coverage for the case where
+9 −0
Original line number Diff line number Diff line
package {
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "packages_modules_DnsResolver_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-Apache-2.0
    default_applicable_licenses: ["packages_modules_DnsResolver_license"],
}

rust_ffi_static {
    name: "libdoh_frontend_ffi",
    crate_name: "doh_frontend_ffi",
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ bool DohFrontend::stopServer() {

int DohFrontend::queries() const {
    std::lock_guard guard(mMutex);
    if (!mRustDoh) return -1;
    if (!mRustDoh) return 0;

    rust::Stats stats;
    rust::frontend_stats(mRustDoh, &stats);
Loading