diff options
author | Lorenzo Colitti <lorenzo@google.com> | 2020-05-10 02:53:57 +0000 |
---|---|---|
committer | Lorenzo Colitti <lorenzo@google.com> | 2020-05-10 03:52:58 +0000 |
commit | 3f518a4f0319bdfeab2d363a89f1ddf4856162f8 (patch) | |
tree | 3bf4ad0c5bb0541b00f38d3f7cb438b0bbd19bf2 | |
parent | 984999a6af5b283a8865252be47004c57fdd2ab0 (diff) | |
download | tests-3f518a4f0319bdfeab2d363a89f1ddf4856162f8.tar.gz |
Fix srcaddr_selection_test when forwarding is on.
This test does not pass when forwarding is on (e.g., when
tethering is on, or on Pixel devices when a SIM card is inserted)
because Linux disables optimistic addresses when fowarding is on.
Make the test disable forwarding while it's running.
Bug: 156144865
Test: atest vts_kernel_net_tests
Original-Change: https://android-review.googlesource.com/1306569
Merged-In: I5981441513585eb3fbfc56d0fc95ff8ff1e371f4
Change-Id: I5981441513585eb3fbfc56d0fc95ff8ff1e371f4
-rwxr-xr-x | net/test/srcaddr_selection_test.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/net/test/srcaddr_selection_test.py b/net/test/srcaddr_selection_test.py index 45a8140..e57ce16 100755 --- a/net/test/srcaddr_selection_test.py +++ b/net/test/srcaddr_selection_test.py @@ -72,6 +72,9 @@ class IPv6SourceAddressSelectionTest(multinetwork_base.MultiNetworkBaseTest): def SetUseOptimistic(self, ifname, value): self.SetSysctl("/proc/sys/net/ipv6/conf/%s/use_optimistic" % ifname, value) + def SetForwarding(self, value): + self.SetSysctl("/proc/sys/net/ipv6/conf/all/forwarding", value) + def GetSourceIP(self, netid, mode="mark"): s = self.BuildSocket(6, net_test.UDPSocket, netid, mode) # Because why not...testing for temporary addresses is a separate thing. @@ -163,6 +166,12 @@ class MultiInterfaceSourceAddressSelectionTest(IPv6SourceAddressSelectionTest): # link-local address is generated. self.WaitForDad(self.test_lladdr) + # Disable forwarding, because optimistic addresses don't work when + # forwarding is on. Forwarding will be re-enabled when the sysctls are + # restored by MultiNetworkBaseTest.tearDownClass. + # TODO: Fix this and remove this hack. + self.SetForwarding("0") + class TentativeAddressTest(MultiInterfaceSourceAddressSelectionTest): |