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

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

Snap for 8570526 from 1fdf44f9 to mainline-networking-release

Change-Id: I138fb8b4f9940ed47f126bfc574355b2da2aca3f
parents 92f78c72 1fdf44f9
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -727,9 +727,9 @@ void DnsProxyListener::GetAddrInfoHandler::doDns64Synthesis(int32_t* rv, addrinf
}

void DnsProxyListener::GetAddrInfoHandler::run() {
    LOG(DEBUG) << "GetAddrInfoHandler::run: {" << mNetContext.app_netid << " "
               << mNetContext.app_mark << " " << mNetContext.dns_netid << " "
               << mNetContext.dns_mark << " " << mNetContext.uid << " " << mNetContext.flags << "}";
    LOG(INFO) << "GetAddrInfoHandler::run: {" << mNetContext.app_netid << " "
              << mNetContext.app_mark << " " << mNetContext.dns_netid << " " << mNetContext.dns_mark
              << " " << mNetContext.uid << " " << mNetContext.flags << "}";

    addrinfo* result = nullptr;
    Stopwatch s;
@@ -902,9 +902,9 @@ DnsProxyListener::ResNSendHandler::ResNSendHandler(SocketClient* c, std::string
    : Handler(c), mMsg(std::move(msg)), mFlags(flags), mNetContext(netcontext) {}

void DnsProxyListener::ResNSendHandler::run() {
    LOG(DEBUG) << "ResNSendHandler::run: " << mFlags << " / {" << mNetContext.app_netid << " "
               << mNetContext.app_mark << " " << mNetContext.dns_netid << " "
               << mNetContext.dns_mark << " " << mNetContext.uid << " " << mNetContext.flags << "}";
    LOG(INFO) << "ResNSendHandler::run: " << mFlags << " / {" << mNetContext.app_netid << " "
              << mNetContext.app_mark << " " << mNetContext.dns_netid << " " << mNetContext.dns_mark
              << " " << mNetContext.uid << " " << mNetContext.flags << "}";

    Stopwatch s;
    maybeFixupNetContext(&mNetContext, mClient->getPid());
+3 −2
Original line number Diff line number Diff line
@@ -31,8 +31,9 @@
bool resolv_init(const ResolverNetdCallbacks* callbacks) {
    android::base::InitLogging(/*argv=*/nullptr);
    LOG(INFO) << __func__ << ": Initializing resolver";
    resolv_set_log_severity(android::base::WARNING);
    doh_init_logger(DOH_LOG_LEVEL_WARN);
    const bool isDebug = isUserDebugBuild();
    resolv_set_log_severity(isDebug ? android::base::INFO : android::base::WARNING);
    doh_init_logger(isDebug ? DOH_LOG_LEVEL_INFO : DOH_LOG_LEVEL_WARN);
    using android::net::gApiLevel;
    gApiLevel = getApiLevel();
    using android::net::gResNetdCallbacks;
+1 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ class Experiments {
            "doh_idle_timeout_ms",
            "doh_session_resumption",
            "mdns_resolution",
            "max_queries_global",
    };
    // This value is used in updateInternal as the default value if any flags can't be found.
    static constexpr int kFlagIntDefault = INT_MIN;
+12 −7
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@
#include <android-base/logging.h>
#include <android-base/thread_annotations.h>

#include "Experiments.h"

namespace android {
namespace netdutils {

@@ -43,8 +45,7 @@ namespace netdutils {
template <typename KeyType>
class OperationLimiter {
  public:
    OperationLimiter(int limitPerKey, int globalLimit = INT_MAX)
        : mLimitPerKey(limitPerKey), mGlobalLimit(globalLimit) {}
    OperationLimiter(int limitPerKey) : mLimitPerKey(limitPerKey) {}

    ~OperationLimiter() {
        DCHECK(mCounters.empty()) << "Destroying OperationLimiter with active operations";
@@ -57,15 +58,22 @@ class OperationLimiter {
    // finish(key).
    bool start(KeyType key) EXCLUDES(mMutex) {
        std::lock_guard lock(mMutex);

        if (mGlobalCounter >= mGlobalLimit) {
        int globalLimit =
                android::net::Experiments::getInstance()->getFlag("max_queries_global", INT_MAX);
        if (globalLimit < mLimitPerKey) {
            LOG(ERROR) << "Misconfiguration on max_queries_global " << globalLimit;
            globalLimit = INT_MAX;
        }
        if (mGlobalCounter >= globalLimit) {
            // Oh, no!
            LOG(ERROR) << "Query from " << key << " denied due to global limit: " << globalLimit;
            return false;
        }

        auto& cnt = mCounters[key];  // operator[] creates new entries as needed.
        if (cnt >= mLimitPerKey) {
            // Oh, no!
            LOG(ERROR) << "Query from " << key << " denied due to limit: " << mLimitPerKey;
            return false;
        }

@@ -109,9 +117,6 @@ class OperationLimiter {

    // Maximum number of outstanding queries from a single key.
    const int mLimitPerKey;

    // Maximum number of outstanding queries, globally.
    const int mGlobalLimit;
};

}  // namespace netdutils
+1 −1
Original line number Diff line number Diff line
{
  "name": "com.android.resolv",
  "version": 319999900
  "version": 330000000
}
Loading