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

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

Snap for 7620868 from 0b61f467 to mainline-media-release

Change-Id: I4aa722cc8892ee5d8cc755befcb15c1de18d0dad
parents 7a255716 0b61f467
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -53,12 +53,12 @@ cc_library_headers {
    ],
}

dnsresolver_aidl_interface_lateststable_version = "V8"
dnsresolver_aidl_interface_lateststable_version = "V9"

cc_library_static {
    name: "dnsresolver_aidl_interface-lateststable-ndk_platform",
    name: "dnsresolver_aidl_interface-lateststable-ndk",
    whole_static_libs: [
        "dnsresolver_aidl_interface-" + dnsresolver_aidl_interface_lateststable_version + "-ndk_platform",
        "dnsresolver_aidl_interface-" + dnsresolver_aidl_interface_lateststable_version + "-ndk",
    ],
    apex_available: [
        "com.android.resolv",
@@ -106,6 +106,7 @@ aidl_interface {
        "6",
        "7",
        "8",
        "9",
    ],
    dumpapi: {
        no_license: true,
@@ -191,7 +192,7 @@ cc_library {
    // Link most things statically to minimize our dependence on system ABIs.
    stl: "libc++_static",
    static_libs: [
        "dnsresolver_aidl_interface-lateststable-ndk_platform",
        "dnsresolver_aidl_interface-lateststable-ndk",
        "libbase",
        "libcutils",
        "libnetdutils",
@@ -200,7 +201,7 @@ cc_library {
        "libstatslog_resolv",
        "libstatspush_compat",
        "libsysutils",
        "netd_event_listener_interface-lateststable-ndk_platform",
        "netd_event_listener_interface-lateststable-ndk",
        "server_configurable_flags",
        "stats_proto",
    ],
+9 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@
#include "ResolverEventReporter.h"
#include "resolv_cache.h"

using aidl::android::net::ResolverOptionsParcel;
using aidl::android::net::ResolverParamsParcel;
using android::base::Join;
using android::base::StringPrintf;
@@ -307,5 +308,13 @@ binder_status_t DnsResolverService::dump(int fd, const char** args, uint32_t num
    return statusFromErrcode(res);
}

::ndk::ScopedAStatus DnsResolverService::setResolverOptions(int32_t netId,
                                                            const ResolverOptionsParcel& options) {
    // Locking happens in res_cache.cpp functions.
    ENFORCE_NETWORK_STACK_PERMISSIONS();

    return statusFromErrcode(resolv_set_options(netId, options));
}

}  // namespace net
}  // namespace android
+2 −0
Original line number Diff line number Diff line
@@ -55,6 +55,8 @@ class DnsResolverService : public aidl::android::net::BnDnsResolver {
    ::ndk::ScopedAStatus destroyNetworkCache(int32_t netId) override;
    ::ndk::ScopedAStatus createNetworkCache(int32_t netId) override;
    ::ndk::ScopedAStatus flushNetworkCache(int32_t netId) override;
    ::ndk::ScopedAStatus setResolverOptions(
            int32_t netId, const aidl::android::net::ResolverOptionsParcel& options) override;

    // DNS64-related commands
    ::ndk::ScopedAStatus startPrefix64Discovery(int32_t netId) override;
+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 {
Loading