diff options
| author | chiachangwang <chiachangwang@google.com> | 2022-09-13 11:40:32 +0000 |
|---|---|---|
| committer | Cherrypicker Worker <android-build-cherrypicker-worker@google.com> | 2022-09-20 03:11:32 +0000 |
| commit | e5f14245d90e34a2c9e945a6af5a243db9718859 (patch) | |
| tree | 781228044c762c25a41c768d5e4049a7e0cb3aa7 | |
| parent | 7b0b38848e4724df45d2f3cb2fd3e6fd33c78763 (diff) | |
Fix NDC fail in presubmit with cf_x86 device
NDC test failed in presubmit because of configuring IPv6 routes
failed with EACCESS. Couple designs are involved in this issue:
1. The test interface(e.g. sTun) are shared between each test
to reduce the initial time of test interfaces. The
configuration of the test interface will be kept if it
is not correctly reset.
2. In general, IPv6 abilities should be enabled by default.
InterfaceSetMtu test configures the MTU of sTun to 1200.
The size is lower than the minimum MTU of IPv6. The IPv6 will
be disabled when the MTU size lower than the minimum MTU in
the kernel.
3. TetherInterfaceAddRemoveList test tether interface add and
remove with the same sTun interface. When the tether
interface is removed, TetherController will change IPv6
configurations for client. It results in the IPv6 being disabled
in sTun.
Thus, restore the MTU at the end of the test that change the MTU
and re-init the interface to restore the IPv6 related
configurations.
Bug: 245238258
Test: atest NetdBinderTest
Change-Id: I5b8a8384d6c1e5fbe84249dcdac419d2cb832434
(cherry picked from commit f281d2ac55da9ea00837d78a32c6de87dbac8b3e)
Merged-In: I5b8a8384d6c1e5fbe84249dcdac419d2cb832434
| -rw-r--r-- | tests/binder_test.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/binder_test.cpp b/tests/binder_test.cpp index bc1e7393..364c10ce 100644 --- a/tests/binder_test.cpp +++ b/tests/binder_test.cpp @@ -2460,6 +2460,13 @@ TEST_F(NetdBinderTest, TetherInterfaceAddRemoveList) { status = mNetd->tetherInterfaceList(&ifList); EXPECT_TRUE(status.isOk()) << status.exceptionMessage(); expectTetherInterfaceNotExists(ifList, sTun.name()); + + // Disable IPv6 tethering will disable IPv6 abilities by changing IPv6 settings(accept_ra, + // dad_transmits, accept_dad, disable_ipv6). See tetherInterfaceRemove in details. + // Re-init sTun to reset the interface to prevent affecting other test that requires IPv6 with + // the same interface. + sTun.destroy(); + sTun.init(); } TEST_F(NetdBinderTest, TetherDnsSetList) { @@ -3042,6 +3049,7 @@ TEST_F(NetdBinderTest, InterfaceSetEnableIPv6) { } TEST_F(NetdBinderTest, InterfaceSetMtu) { + const int currentMtu = getInterfaceMtu(sTun.name()); const int testMtu = 1200; // Add test physical network @@ -3054,6 +3062,10 @@ TEST_F(NetdBinderTest, InterfaceSetMtu) { EXPECT_TRUE(status.isOk()) << status.exceptionMessage(); expectInterfaceMtu(sTun.name(), testMtu); + // restore the MTU back + status = mNetd->interfaceSetMtu(sTun.name(), currentMtu); + EXPECT_TRUE(status.isOk()) << status.exceptionMessage(); + // Remove test physical network EXPECT_TRUE(mNetd->networkDestroy(TEST_NETID1).isOk()); } |
