From 61615f3f152499609b76ec14107c35078611960e Mon Sep 17 00:00:00 2001 From: Mithun Iyer Date: Wed, 5 May 2021 08:54:23 -0700 Subject: Fix a race in reading last seen ICMP error during handshake On receiving an ICMP error during handshake, the error is propagated by reading `endpoint.lastError`. This can race with the socket layer invoking getsockopt() with SO_ERROR where the same value is read and cleared, causing the handshake to bail out with a non-error state. Fix the race by checking for lastError state and failing the handshake with ErrConnectionAborted if the lastError was read and cleared by say SO_ERROR. The race mentioned in the bug, is caught only with the newly added tcp_test unit test, where we have control over stopping/resuming protocol loop. Adding a packetimpact test as well for sanity testing of ICMP error handling during handshake. Fixes #5922 PiperOrigin-RevId: 372135662 --- test/packetimpact/runner/defs.bzl | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/packetimpact/runner/defs.bzl') diff --git a/test/packetimpact/runner/defs.bzl b/test/packetimpact/runner/defs.bzl index 634c15727..afe73a69a 100644 --- a/test/packetimpact/runner/defs.bzl +++ b/test/packetimpact/runner/defs.bzl @@ -251,6 +251,9 @@ ALL_TESTS = [ PacketimpactTestInfo( name = "tcp_syncookie", ), + PacketimpactTestInfo( + name = "tcp_connect_icmp_error", + ), PacketimpactTestInfo( name = "icmpv6_param_problem", ), -- cgit v1.2.3