summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlair Prescott <Blair.Prescott@broadcom.com>2021-08-12 13:21:25 -0700
committerBlair Prescott <Blair.Prescott@broadcom.com>2021-08-12 17:43:15 -0700
commitbeccb965e2b87e694ef65c4da9729d66f8706745 (patch)
tree690cf88bdbdb6c0627240dace5f95a64756df270
parent82413484a6b925a397b08bdde8ddf7deb00cd8b6 (diff)
downloadtests-beccb965e2b87e694ef65c4da9729d66f8706745.tar.gz
net-test: Reset blackhole before fastopen test
A pre-existing network connection can trigger the TCP fastopen blackhole timer. Reset the timer before the fastopen test begins. Test: Run vts_kernel_net_tests with Ethernet or Wi-Fi connected Bug: 196423144 Signed-off-by: Blair Prescott <Blair.Prescott@broadcom.com> Change-Id: I8c75aca81bd207a6700d920a7db888e2b58aab52
-rwxr-xr-xnet/test/tcp_fastopen_test.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/net/test/tcp_fastopen_test.py b/net/test/tcp_fastopen_test.py
index eadae79..5b89a2d 100755
--- a/net/test/tcp_fastopen_test.py
+++ b/net/test/tcp_fastopen_test.py
@@ -28,6 +28,7 @@ import tcp_metrics
TCPOPT_FASTOPEN = 34
TCP_FASTOPEN_CONNECT = 30
+BH_TIMEOUT_SYSCTL = "/proc/sys/net/ipv4/tcp_fastopen_blackhole_timeout_sec"
class TcpFastOpenTest(multinetwork_base.MultiNetworkBaseTest):
@@ -63,12 +64,21 @@ class TcpFastOpenTest(multinetwork_base.MultiNetworkBaseTest):
with self.assertRaisesErrno(ENOENT):
self.tcp_metrics.GetMetrics(saddr, daddr)
+ def clearBlackhole(self):
+ if net_test.LINUX_VERSION < (4, 14, 0):
+ return
+ timeout = self.GetSysctl(BH_TIMEOUT_SYSCTL)
+
+ # Write to timeout to clear any pre-existing blackhole condition
+ self.SetSysctl(BH_TIMEOUT_SYSCTL, timeout)
+
def CheckConnectOption(self, version):
ip_layer = {4: scapy.IP, 6: scapy.IPv6}[version]
netid = self.RandomNetid()
s = self.TFOClientSocket(version, netid)
self.clearTcpMetrics(version, netid)
+ self.clearBlackhole()
# Connect the first time.
remoteaddr = self.GetRemoteAddress(version)