summaryrefslogtreecommitdiffstats
path: root/net/test
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2020-05-09 21:00:27 +0900
committerLorenzo Colitti <lorenzo@google.com>2020-05-09 21:14:57 +0900
commit468222fe3c553a7ca7b3f78bdee1df37ed41eadd (patch)
tree39c95fa0ef5c01e01e1af42fbf3e51d4bd604680 /net/test
parent9cc420f4919ff0c32c581ad3ffb9feb5da9d6bff (diff)
downloadkernel_tests-468222fe3c553a7ca7b3f78bdee1df37ed41eadd.tar.gz
kernel_tests-468222fe3c553a7ca7b3f78bdee1df37ed41eadd.tar.bz2
kernel_tests-468222fe3c553a7ca7b3f78bdee1df37ed41eadd.zip
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 Change-Id: I5981441513585eb3fbfc56d0fc95ff8ff1e371f4
Diffstat (limited to 'net/test')
-rwxr-xr-xnet/test/srcaddr_selection_test.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/net/test/srcaddr_selection_test.py b/net/test/srcaddr_selection_test.py
index 45a81404..e57ce16f 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):