Add more randomness to TCP connections.
Previously we used a fixed sequence number and a fixed remote IP address. This makes TCPAcceptTest fail a low percentage of the time because if we re-use the same remote port on two different incoming connections, the second one is likely to hit the previous socket which is now in TIME-WAIT state. This will either silently drop the SYN or send an ack with the previous sequence number. Make the sequence number random (there's no reason it shouldn't be) and use GetRandomDestination to put 13-16 bits of entropy in the remote address. Test: all_tests.sh passes on android-3.18. Bug: 31119353 Change-Id: Ie6aee2a48404eafdc3c33262eb252df4b89876c6
Loading
Please sign in to comment