Loading Android.bp +8 −2 Original line number Diff line number Diff line Loading @@ -10,6 +10,11 @@ cc_library_headers { export_include_dirs: ["."], } cc_library_headers { name: "dnsproxyd_protocol_headers", export_include_dirs: ["include/dnsproxyd_protocol"], } aidl_interface { name: "dnsresolver_aidl_interface", local_include_dir: "binder", Loading Loading @@ -149,7 +154,7 @@ cc_library { "libssl", ], header_libs: [ "libnetd_client_headers", "libnetdbinder_utils_headers", ], export_include_dirs: ["include"], Loading Loading @@ -257,11 +262,12 @@ cc_test { ], static_libs: [ "dnsresolver_aidl_interface-unstable-ndk_platform", "netd_aidl_interface-ndk_platform", "netd_event_listener_interface-ndk_platform", "libcutils", "libgmock", "libnetd_resolv", "libnetd_test_dnsresponder", "libnetd_test_dnsresponder_ndk", "libnetd_test_resolv_utils", "libnetdutils", "libprotobuf-cpp-lite", Loading Dns64Configuration.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ #include <netdutils/DumpWriter.h> #include <netdutils/InternetAddresses.h> #include <netdutils/ThreadUtil.h> #include <netid_client.h> #include <thread> #include <utility> Loading DnsProxyListener.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ #include <algorithm> #include <vector> #include <NetdClient.h> // NETID_USE_LOCAL_NAMESERVERS #include <android-base/stringprintf.h> #include <android/multinetwork.h> // ResNsendFlags #include <cutils/misc.h> // FIRST_APPLICATION_UID Loading @@ -53,6 +52,7 @@ #include "NetdPermissions.h" #include "PrivateDnsConfiguration.h" #include "ResolverEventReporter.h" #include "dnsproxyd_protocol/DnsProxydProtocol.h" // NETID_USE_LOCAL_NAMESERVERS #include "getaddrinfo.h" #include "gethnamaddr.h" #include "res_send.h" Loading include/dnsproxyd_protocol/DnsProxydProtocol.h 0 → 100644 +26 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 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. * */ #pragma once /* * This value should not be changed. * It's a flag used in both DnsProxyListener.cpp and NetdClient.cpp * to identify if bypassing DoT is available. * This flag must be kept in sync with the Network#getNetIdForResolv() usage. */ #define NETID_USE_LOCAL_NAMESERVERS 0x80000000 res_cache.cpp +4 −6 Original line number Diff line number Diff line Loading @@ -1190,7 +1190,9 @@ ResolvCacheStatus resolv_cache_lookup(unsigned netid, const void* query, int que // possible to cache the answer of this query. // If ANDROID_RESOLV_NO_CACHE_STORE is set, return RESOLV_CACHE_SKIP to skip possible cache // storing. if (flags & ANDROID_RESOLV_NO_CACHE_LOOKUP) { // (b/150371903): ANDROID_RESOLV_NO_CACHE_STORE should imply ANDROID_RESOLV_NO_CACHE_LOOKUP // to avoid side channel attack. if (flags & (ANDROID_RESOLV_NO_CACHE_LOOKUP | ANDROID_RESOLV_NO_CACHE_STORE)) { return flags & ANDROID_RESOLV_NO_CACHE_STORE ? RESOLV_CACHE_SKIP : RESOLV_CACHE_NOTFOUND; } Entry key; Loading Loading @@ -1221,10 +1223,6 @@ ResolvCacheStatus resolv_cache_lookup(unsigned netid, const void* query, int que if (e == NULL) { LOG(INFO) << __func__ << ": NOT IN CACHE"; // If it is no-cache-store mode, we won't wait for possible query. if (flags & ANDROID_RESOLV_NO_CACHE_STORE) { return RESOLV_CACHE_SKIP; } if (!cache_has_pending_request_locked(cache, &key, true)) { return RESOLV_CACHE_NOTFOUND; Loading Loading @@ -1264,7 +1262,7 @@ ResolvCacheStatus resolv_cache_lookup(unsigned netid, const void* query, int que LOG(INFO) << __func__ << ": NOT IN CACHE (STALE ENTRY " << *lookup << "DISCARDED)"; res_pquery(e->query, e->querylen); _cache_remove_p(cache, lookup); return (flags & ANDROID_RESOLV_NO_CACHE_STORE) ? RESOLV_CACHE_SKIP : RESOLV_CACHE_NOTFOUND; return RESOLV_CACHE_NOTFOUND; } *answerlen = e->answerlen; Loading Loading
Android.bp +8 −2 Original line number Diff line number Diff line Loading @@ -10,6 +10,11 @@ cc_library_headers { export_include_dirs: ["."], } cc_library_headers { name: "dnsproxyd_protocol_headers", export_include_dirs: ["include/dnsproxyd_protocol"], } aidl_interface { name: "dnsresolver_aidl_interface", local_include_dir: "binder", Loading Loading @@ -149,7 +154,7 @@ cc_library { "libssl", ], header_libs: [ "libnetd_client_headers", "libnetdbinder_utils_headers", ], export_include_dirs: ["include"], Loading Loading @@ -257,11 +262,12 @@ cc_test { ], static_libs: [ "dnsresolver_aidl_interface-unstable-ndk_platform", "netd_aidl_interface-ndk_platform", "netd_event_listener_interface-ndk_platform", "libcutils", "libgmock", "libnetd_resolv", "libnetd_test_dnsresponder", "libnetd_test_dnsresponder_ndk", "libnetd_test_resolv_utils", "libnetdutils", "libprotobuf-cpp-lite", Loading
Dns64Configuration.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ #include <netdutils/DumpWriter.h> #include <netdutils/InternetAddresses.h> #include <netdutils/ThreadUtil.h> #include <netid_client.h> #include <thread> #include <utility> Loading
DnsProxyListener.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ #include <algorithm> #include <vector> #include <NetdClient.h> // NETID_USE_LOCAL_NAMESERVERS #include <android-base/stringprintf.h> #include <android/multinetwork.h> // ResNsendFlags #include <cutils/misc.h> // FIRST_APPLICATION_UID Loading @@ -53,6 +52,7 @@ #include "NetdPermissions.h" #include "PrivateDnsConfiguration.h" #include "ResolverEventReporter.h" #include "dnsproxyd_protocol/DnsProxydProtocol.h" // NETID_USE_LOCAL_NAMESERVERS #include "getaddrinfo.h" #include "gethnamaddr.h" #include "res_send.h" Loading
include/dnsproxyd_protocol/DnsProxydProtocol.h 0 → 100644 +26 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 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. * */ #pragma once /* * This value should not be changed. * It's a flag used in both DnsProxyListener.cpp and NetdClient.cpp * to identify if bypassing DoT is available. * This flag must be kept in sync with the Network#getNetIdForResolv() usage. */ #define NETID_USE_LOCAL_NAMESERVERS 0x80000000
res_cache.cpp +4 −6 Original line number Diff line number Diff line Loading @@ -1190,7 +1190,9 @@ ResolvCacheStatus resolv_cache_lookup(unsigned netid, const void* query, int que // possible to cache the answer of this query. // If ANDROID_RESOLV_NO_CACHE_STORE is set, return RESOLV_CACHE_SKIP to skip possible cache // storing. if (flags & ANDROID_RESOLV_NO_CACHE_LOOKUP) { // (b/150371903): ANDROID_RESOLV_NO_CACHE_STORE should imply ANDROID_RESOLV_NO_CACHE_LOOKUP // to avoid side channel attack. if (flags & (ANDROID_RESOLV_NO_CACHE_LOOKUP | ANDROID_RESOLV_NO_CACHE_STORE)) { return flags & ANDROID_RESOLV_NO_CACHE_STORE ? RESOLV_CACHE_SKIP : RESOLV_CACHE_NOTFOUND; } Entry key; Loading Loading @@ -1221,10 +1223,6 @@ ResolvCacheStatus resolv_cache_lookup(unsigned netid, const void* query, int que if (e == NULL) { LOG(INFO) << __func__ << ": NOT IN CACHE"; // If it is no-cache-store mode, we won't wait for possible query. if (flags & ANDROID_RESOLV_NO_CACHE_STORE) { return RESOLV_CACHE_SKIP; } if (!cache_has_pending_request_locked(cache, &key, true)) { return RESOLV_CACHE_NOTFOUND; Loading Loading @@ -1264,7 +1262,7 @@ ResolvCacheStatus resolv_cache_lookup(unsigned netid, const void* query, int que LOG(INFO) << __func__ << ": NOT IN CACHE (STALE ENTRY " << *lookup << "DISCARDED)"; res_pquery(e->query, e->querylen); _cache_remove_p(cache, lookup); return (flags & ANDROID_RESOLV_NO_CACHE_STORE) ? RESOLV_CACHE_SKIP : RESOLV_CACHE_NOTFOUND; return RESOLV_CACHE_NOTFOUND; } *answerlen = e->answerlen; Loading