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

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

Snap for 11059422 from 1af2a050 to 24D1-release

Change-Id: I014994f17e837611d5c943a7ce23958262afc2cc
parents e95275cc 1af2a050
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -69,7 +69,6 @@ class Experiments {
            "parallel_lookup_sleep_time",
            "retransmission_time_interval",
            "retry_count",
            "skip_4a_query_on_v6_linklocal_addr",
            "sort_nameservers",
    };
    // This value is used in updateInternal as the default value if any flags can't be found.
+1 −0
Original line number Diff line number Diff line
# Bug component: 31808
set noparent
file:platform/packages/modules/Connectivity:main:/OWNERS_core_networking
+1 −2
Original line number Diff line number Diff line
@@ -1310,8 +1310,7 @@ static int _find_src_addr(const struct sockaddr* addr, struct sockaddr* src_addr
        return -1;
    }

    if (Experiments::getInstance()->getFlag("skip_4a_query_on_v6_linklocal_addr", 1) &&
        src_addr->sa_family == AF_INET6) {
    if (src_addr->sa_family == AF_INET6) {
        sockaddr_in6* sin6 = reinterpret_cast<sockaddr_in6*>(src_addr);
        if (!allow_v6_linklocal && IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
            // There is no point in sending an AAAA query because the device does not have a global
+1 −0
Original line number Diff line number Diff line
@@ -201,6 +201,7 @@ cc_test {
        "libnetd_test_resolv_utils",
        "libnetdutils",
        "libssl",
        "libc++fs",
        "libcutils",
        "netd_aidl_interface-lateststable-ndk",
        "netd_event_listener_interface-lateststable-ndk",
+4 −51
Original line number Diff line number Diff line
@@ -127,6 +127,8 @@ using android::netdutils::ScopedAddrinfo;
using android::netdutils::Stopwatch;
using android::netdutils::toHex;

namespace fs = std::filesystem;

namespace {

std::pair<ScopedAddrinfo, int> safe_getaddrinfo_time_taken(const char* node, const char* service,
@@ -4505,9 +4507,9 @@ TEST_F(ResolverTest, GetAddrinfo_BlockDnsQueryWithUidRule) {
        const char* hname;
        const int expectedErrorCode;
    } kTestData[] = {
            {host_name, isAtLeastT() ? EAI_FAIL : EAI_NODATA},
            {host_name, (isAtLeastT() && fs::exists(DNS_HELPER)) ? EAI_FAIL : EAI_NODATA},
            // To test the query with search domain.
            {"howdy", isAtLeastT() ? EAI_FAIL : EAI_AGAIN},
            {"howdy", (isAtLeastT() && fs::exists(DNS_HELPER)) ? EAI_FAIL : EAI_AGAIN},
    };

    INetd* netdService = mDnsClient.netdService();
@@ -7811,55 +7813,6 @@ TEST_F(ResolverMultinetworkTest, IPv6LinkLocalWithDefaultRoute) {
    EXPECT_EQ(GetNumQueriesForType(*dnsPair->dnsServer, ns_type::ns_t_aaaa, host_name), 1U);
}

// Test if the "do not send AAAA query when IPv6 address is link-local with a default route" feature
// can be toggled by flag.
TEST_F(ResolverMultinetworkTest, IPv6LinkLocalWithDefaultRouteFlag) {
    // Kernel 4.4 does not provide an IPv6 link-local address when an interface is added to a
    // network. Skip it because v6 link-local address is a prerequisite for this test.
    SKIP_IF_KERNEL_VERSION_LOWER_THAN(4, 9, 0);

    constexpr char host_name[] = "ohayou.example.com.";
    const struct TestConfig {
        std::string flagValue;
        std::vector<std::string> ips;
        unsigned numOfQuadAQuery;
    } TestConfigs[]{{"0", {"192.0.2.0", "2001:db8:cafe:d00d::31"}, 1U}, {"1", {"192.0.2.0"}, 0U}};

    for (const auto& config : TestConfigs) {
        SCOPED_TRACE(fmt::format("flagValue = {}, numOfQuadAQuery = {}", config.flagValue,
                                 config.numOfQuadAQuery));

        ScopedSystemProperties sp1(kSkip4aQueryOnV6LinklocalAddrFlag, config.flagValue);
        ScopedPhysicalNetwork network = CreateScopedPhysicalNetwork(ConnectivityType::V4);
        ASSERT_RESULT_OK(network.init());

        // Add IPv6 default route
        ASSERT_TRUE(mDnsClient.netdService()
                            ->networkAddRoute(network.netId(), network.ifname(), "::/0", "")
                            .isOk());

        // Ensuring that routing is applied. This is required for mainline test (b/257404586).
        usleep(1000 * 1000);

        const Result<DnsServerPair> dnsPair = network.addIpv4Dns();
        ASSERT_RESULT_OK(dnsPair);
        StartDns(*dnsPair->dnsServer, {{host_name, ns_type::ns_t_a, "192.0.2.0"},
                                       {host_name, ns_type::ns_t_aaaa, "2001:db8:cafe:d00d::31"}});

        ASSERT_TRUE(network.setDnsConfiguration());
        ASSERT_TRUE(network.startTunForwarder());

        auto result = android_getaddrinfofornet_wrapper(host_name, network.netId());
        ASSERT_RESULT_OK(result);
        ScopedAddrinfo ai_results(std::move(result.value()));
        std::vector<std::string> result_strs = ToStrings(ai_results);
        EXPECT_THAT(result_strs, testing::UnorderedElementsAreArray(config.ips));
        EXPECT_EQ(GetNumQueriesForType(*dnsPair->dnsServer, ns_type::ns_t_a, host_name), 1U);
        EXPECT_EQ(GetNumQueriesForType(*dnsPair->dnsServer, ns_type::ns_t_aaaa, host_name),
                  config.numOfQuadAQuery);
    }
}

// v6 mdns is expected to be sent when the IPv6 address is a link-local with a default route.
TEST_F(ResolverMultinetworkTest, MdnsIPv6LinkLocalWithDefaultRoute) {
    // Kernel 4.4 does not provide an IPv6 link-local address when an interface is added to a
Loading