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

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

Snap for 12888383 from 618d23e1 to 25Q2-release

Change-Id: I8fd06541def1ca7b9394587577c7a081212e23ee
parents 9faf865f 618d23e1
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -160,8 +160,8 @@ bool Dns64Configuration::doRfc7050PrefixDiscovery(const android_net_context& net
    // handling and the resolver event logging.
    struct addrinfo* res = nullptr;
    NetworkDnsEventReported event;
    const int status =
            resolv_getaddrinfo(kIPv4OnlyHost, nullptr, &hints, &netcontext, &res, &event);
    const int status = resolv_getaddrinfo(kIPv4OnlyHost, nullptr, &hints, &netcontext,
                                          APP_SOCKET_NONE, &res, &event);
    ScopedAddrinfo result(res);
    if (status != 0) {
        LOG(WARNING) << "(" << cfg->netId << ", " << cfg->discoveryId << ") plat_prefix/dns("
+14 −9
Original line number Diff line number Diff line
@@ -886,7 +886,8 @@ void DnsProxyListener::GetAddrInfoHandler::doDns64Synthesis(int32_t* rv, addrinf
        mHints->ai_family = AF_INET;
        // Don't need to do freeaddrinfo(res) before starting new DNS lookup because previous
        // DNS lookup is failed with error EAI_NODATA.
        *rv = resolv_getaddrinfo(host, service, mHints.get(), &mNetContext, res, event);
        *rv = resolv_getaddrinfo(host, service, mHints.get(), &mNetContext, mClient->getSocket(),
                                 res, event);
        if (*rv) {
            *rv = EAI_NODATA;  // return original error code
            return;
@@ -924,7 +925,8 @@ void DnsProxyListener::GetAddrInfoHandler::run() {
        const char* host = mHost.starts_with('^') ? nullptr : mHost.c_str();
        const char* service = mService.starts_with('^') ? nullptr : mService.c_str();
        if (evaluate_domain_name(mNetContext, host)) {
            rv = resolv_getaddrinfo(host, service, mHints.get(), &mNetContext, &result, &event);
            rv = resolv_getaddrinfo(host, service, mHints.get(), &mNetContext, mClient->getSocket(),
                                    &result, &event);
            doDns64Synthesis(&rv, &result, &event);
        } else {
            rv = EAI_SYSTEM;
@@ -1135,7 +1137,8 @@ void DnsProxyListener::ResNSendHandler::run() {
        ansLen = -ECONNREFUSED;
    } else if (startQueryLimiter(uid)) {
        if (evaluate_domain_name(mNetContext, rr_name.c_str())) {
            ansLen = resolv_res_nsend(&mNetContext, std::span(msg.data(), msgLen), ansBuf, &rcode,
            ansLen = resolv_res_nsend(&mNetContext, mClient->getSocket(),
                                      std::span(msg.data(), msgLen), ansBuf, &rcode,
                                      static_cast<ResNsendFlags>(mFlags), &event);
        } else {
            // TODO(b/307048182): It should return -errno.
@@ -1310,7 +1313,8 @@ void DnsProxyListener::GetHostByNameHandler::doDns64Synthesis(int32_t* rv, hoste

    // If caller wants IPv6 answers but no data, try to query IPv4 answers for synthesis
    const char* name = mName.starts_with('^') ? nullptr : mName.c_str();
    *rv = resolv_gethostbyname(name, AF_INET, hbuf, buf, buflen, &mNetContext, hpp, event);
    *rv = resolv_gethostbyname(name, AF_INET, hbuf, buf, buflen, &mNetContext, mClient->getSocket(),
                               hpp, event);
    if (*rv) {
        *rv = EAI_NODATA;  // return original error code
        return;
@@ -1341,8 +1345,8 @@ void DnsProxyListener::GetHostByNameHandler::run() {
    } else if (startQueryLimiter(uid)) {
        const char* name = mName.starts_with('^') ? nullptr : mName.c_str();
        if (evaluate_domain_name(mNetContext, name)) {
            rv = resolv_gethostbyname(name, mAf, &hbuf, tmpbuf, sizeof tmpbuf, &mNetContext, &hp,
                                      &event);
            rv = resolv_gethostbyname(name, mAf, &hbuf, tmpbuf, sizeof tmpbuf, &mNetContext,
                                      mClient->getSocket(), &hp, &event);
            doDns64Synthesis(&rv, &hbuf, tmpbuf, sizeof tmpbuf, &hp, &event);
        } else {
            rv = EAI_SYSTEM;
@@ -1470,8 +1474,8 @@ void DnsProxyListener::GetHostByAddrHandler::doDns64ReverseLookup(hostent* hbuf,

    // Remove NAT64 prefix and do reverse DNS query
    struct in_addr v4addr = {.s_addr = v6addr.s6_addr32[3]};
    resolv_gethostbyaddr(&v4addr, sizeof(v4addr), AF_INET, hbuf, buf, buflen, &mNetContext, hpp,
                         event);
    resolv_gethostbyaddr(&v4addr, sizeof(v4addr), AF_INET, hbuf, buf, buflen, &mNetContext,
                         mClient->getSocket(), hpp, event);
    if (*hpp && (*hpp)->h_addr_list[0]) {
        // Replace IPv4 address with original queried IPv6 address in place. The space has
        // reserved by dns_gethtbyaddr() and netbsd_gethostent_r() in
@@ -1513,7 +1517,8 @@ void DnsProxyListener::GetHostByAddrHandler::run() {
            rv = EAI_SYSTEM;
        } else {
            rv = resolv_gethostbyaddr(&mAddress, mAddressLen, mAddressFamily, &hbuf, tmpbuf,
                                      sizeof tmpbuf, &mNetContext, &hp, &event);
                                      sizeof tmpbuf, &mNetContext, mClient->getSocket(), &hp,
                                      &event);
            doDns64ReverseLookup(&hbuf, tmpbuf, sizeof tmpbuf, &hp, &event);
        }
        endQueryLimiter(uid);
+1 −0
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ class Experiments {
            "max_cache_entries",
            "max_queries_global",
            "mdns_resolution",
            "no_retry_after_cancel",
            "parallel_lookup_sleep_time",
            "retransmission_time_interval",
            "retry_count",
+15 −11
Original line number Diff line number Diff line
@@ -124,7 +124,8 @@ struct res_target {
};

static int explore_fqdn(const struct addrinfo*, const char*, const char*, struct addrinfo**,
                        const struct android_net_context*, NetworkDnsEventReported* event);
                        const struct android_net_context*, std::optional<int> app_socket,
                        NetworkDnsEventReported* event);
static int explore_null(const struct addrinfo*, const char*, struct addrinfo**);
static int explore_numeric(const struct addrinfo*, const char*, const char*, struct addrinfo**,
                           const char*);
@@ -140,8 +141,8 @@ static int ip6_str2scopeid(const char*, struct sockaddr_in6*, uint32_t*);
static struct addrinfo* getanswer(const std::vector<uint8_t>&, int, const char*, int,
                                  const struct addrinfo*, int* herrno);
static int dns_getaddrinfo(const char* name, const addrinfo* pai,
                           const android_net_context* netcontext, addrinfo** rv,
                           NetworkDnsEventReported* event);
                           const android_net_context* netcontext, std::optional<int> app_socket,
                           addrinfo** rv, NetworkDnsEventReported* event);
static void _sethtent(FILE**);
static void _endhtent(FILE**);
static struct addrinfo* _gethtent(FILE**, const char*, const struct addrinfo*);
@@ -381,7 +382,8 @@ int android_getaddrinfofornetcontext(const char* hostname, const char* servname,
            break;
        }

        return resolv_getaddrinfo(hostname, servname, hints, netcontext, res, event);
        return resolv_getaddrinfo(hostname, servname, hints, netcontext, APP_SOCKET_NONE, res,
                                  event);
    } while (0);

    if (error) {
@@ -394,7 +396,8 @@ int android_getaddrinfofornetcontext(const char* hostname, const char* servname,
}

int resolv_getaddrinfo(const char* _Nonnull hostname, const char* servname, const addrinfo* hints,
                       const android_net_context* _Nonnull netcontext, addrinfo** _Nonnull res,
                       const android_net_context* _Nonnull netcontext,
                       std::optional<int> app_socket, addrinfo** _Nonnull res,
                       NetworkDnsEventReported* _Nonnull event) {
    if (hostname == nullptr && servname == nullptr) return EAI_NONAME;
    if (hostname == nullptr) return EAI_NODATA;
@@ -430,7 +433,8 @@ int resolv_getaddrinfo(const char* _Nonnull hostname, const char* servname, cons

        LOG(DEBUG) << __func__ << ": explore_fqdn(): ai_family=" << tmp.ai_family
                   << " ai_socktype=" << tmp.ai_socktype << " ai_protocol=" << tmp.ai_protocol;
        error = explore_fqdn(&tmp, hostname, servname, &cur->ai_next, netcontext, event);
        error = explore_fqdn(&tmp, hostname, servname, &cur->ai_next, netcontext, app_socket,
                             event);

        while (cur->ai_next) cur = cur->ai_next;
    }
@@ -447,7 +451,7 @@ int resolv_getaddrinfo(const char* _Nonnull hostname, const char* servname, cons
// FQDN hostname, DNS lookup
static int explore_fqdn(const addrinfo* pai, const char* hostname, const char* servname,
                        addrinfo** res, const android_net_context* netcontext,
                        NetworkDnsEventReported* event) {
                        std::optional<int> app_socket, NetworkDnsEventReported* event) {
    assert(pai != nullptr);
    // hostname may be nullptr
    // servname may be nullptr
@@ -460,7 +464,7 @@ static int explore_fqdn(const addrinfo* pai, const char* hostname, const char* s
    if ((error = get_portmatch(pai, servname))) return error;

    if (!files_getaddrinfo(netcontext->dns_netid, hostname, pai, &result)) {
        error = dns_getaddrinfo(hostname, pai, netcontext, &result, event);
        error = dns_getaddrinfo(hostname, pai, netcontext, app_socket, &result, event);
    }
    if (error) {
        freeaddrinfo(result);
@@ -1384,11 +1388,11 @@ error:
}

static int dns_getaddrinfo(const char* name, const addrinfo* pai,
                           const android_net_context* netcontext, addrinfo** rv,
                           NetworkDnsEventReported* event) {
                           const android_net_context* netcontext, std::optional<int> app_socket,
                           addrinfo** rv, NetworkDnsEventReported* event) {
    res_target q = {};
    res_target q2 = {};
    ResState res(netcontext, event);
    ResState res(netcontext, app_socket, event);
    setMdnsFlag(name, res.netid, &(res.flags));

    switch (pai->ai_family) {
+2 −2
Original line number Diff line number Diff line
@@ -27,8 +27,8 @@ int android_getaddrinfofornetcontext(const char* hostname, const char* servname,

// This is the DNS proxy entry point for getaddrinfo().
int resolv_getaddrinfo(const char* hostname, const char* servname, const addrinfo* hints,
                       const android_net_context* netcontext, addrinfo** res,
                       android::net::NetworkDnsEventReported*);
                       const android_net_context* netcontext, std::optional<int> app_socket,
                       addrinfo** res, android::net::NetworkDnsEventReported*);

// Sort the linked list starting at sentinel->ai_next in RFC6724 order.
void resolv_rfc6724_sort(struct addrinfo* list_sentinel, unsigned mark, uid_t uid);
Loading