diff options
author | Benedict Wong <benedictwong@google.com> | 2018-03-20 17:31:14 -0700 |
---|---|---|
committer | Benedict Wong <benedictwong@google.com> | 2018-03-23 12:12:50 -0700 |
commit | 059f098b7e0f77718177713cc776369ac7b0faf2 (patch) | |
tree | b39d0ac9e82191a1a2902cc885eda67af27904af | |
parent | 2113ad3e00992556dde023dc3d9e0b718a723f48 (diff) | |
download | tests-059f098b7e0f77718177713cc776369ac7b0faf2.tar.gz |
Fix algorithm tests to ensure no lingering sockets
Lingering TCP sockets appear to be causing testUpdatePolicy to fail due
to policies attached to TCP sockets in TIME_WAIT. This patch sets
SO_LINGER on the algorithm tests' sockets, forcing them to shutdown
cleanly, and synchronously.
Bug: 74071662
Test: Ran on common 3.18, 4.4 with parallel_tests.sh 20 10
Merged-In: Ie9ab9b7672cc2ce8309ed871eeee09ec8128aac9
Change-Id: Ie9ab9b7672cc2ce8309ed871eeee09ec8128aac9
(cherry picked from commit f7699431b8717d77c24b517dfb8ef43065874698)
-rwxr-xr-x | net/test/xfrm_algorithm_test.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/net/test/xfrm_algorithm_test.py b/net/test/xfrm_algorithm_test.py index 90e7ee0..1de6e4b 100755 --- a/net/test/xfrm_algorithm_test.py +++ b/net/test/xfrm_algorithm_test.py @@ -252,6 +252,12 @@ class XfrmAlgorithmTest(xfrm_base.XfrmLazyTest): sock_right.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) self.SelectInterface(sock_right, netid, "mark") + # For UDP, set SO_LINGER to 0, to prevent TCP sockets from hanging around + # in a TIME_WAIT state. + if params["proto"] == SOCK_STREAM: + net_test.DisableFinWait(sock_left) + net_test.DisableFinWait(sock_right) + # Apply the left outbound socket policy. xfrm_base.ApplySocketPolicy(sock_left, family, xfrm.XFRM_POLICY_OUT, spi_right, req_ids[0], None) @@ -320,8 +326,6 @@ class XfrmAlgorithmTest(xfrm_base.XfrmLazyTest): sock_left.send("hello request") data = sock_left.recv(2048) self.assertEquals("hello response", data) - if params["proto"] == SOCK_STREAM: - sock_left.shutdown(SHUT_RD) sock_left.close() server.join() if server_error: |