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

Commit ddaaf82e authored by Ken Chen's avatar Ken Chen
Browse files

[Test] Skip MdnsIPv6LinkLocalWithDefaultRoute on Kernel 4.4

The test failed on kernel 4.4 since the kernel does not provide an IPv6
link-local address when an interface is added to a network. The IPv6
link-local address is a prerequisite for this test. Considering 4.4 is
outdated and EOL'ed, skip the test directly.

[Kernel 4.4]
netd    : networkCreatePhysical(10000, 0) <0.58ms>
netd    : networkAddInterface(10000, "testtun10000") <2.79ms>

$ adb shell ifconfig
testtun10000 Link encap:UNSPEC
    UP POINTOPOINT RUNNING  MTU:1500  Metric:1
    ...

-----------------------------------------------------

[Kernel 4.9+]
netd    : networkCreatePhysical(10000, 0) <0.24ms>
netd    : networkAddInterface(10000, "testtun10000") <3.22ms>

$ adb shell ifconfig
testtun10000 Link encap:UNSPEC
    inet6 addr: fe80::c1b1:ba3c:d875:9bc/64 Scope: Link
    UP POINTOPOINT RUNNING  MTU:1500  Metric:1
    ...

Bug: 247693272
Test: atest ResolverMultinetworkTest
Change-Id: I13961d824045a1ebcce7fc513fdbfcd547d341ed
parent c0b025cf
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -154,6 +154,12 @@ struct NameserverStats {

const bool isAtLeastR = (getApiLevel() >= 30);

#define SKIP_IF_KERNEL_VERSION_LOWER_THAN(major, minor, sub)                                  \
    do {                                                                                      \
        if (!android::bpf::isAtLeastKernelVersion(major, minor, sub))                         \
            GTEST_SKIP() << "Required kernel: " << (major) << "." << (minor) << "." << (sub); \
    } while (0)

}  // namespace

class ResolverTest : public NetNativeTestBase {
@@ -7513,6 +7519,10 @@ TEST_F(ResolverMultinetworkTest, IPv6LinkLocalWithDefaultRoute) {

// 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
    // 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 v6addr[] = "::127.0.0.3";
    constexpr char v4addr[] = "127.0.0.3";
    constexpr char host_name[] = "hello.local.";