Use blocking sockets when testing raw IP sockets

The original code instantiated the raw IP sockets with NON_BLOCKING,
which caused problems in the PingSuccessfully test case. That case sends
and expects to immediately receive an ICMPv6 Echo Request/Reply. On
Fuchsia, the Loopback devices tx/rx queues are decoupled, so it's
possible for the test to call `recvmsg` before the packet has been
delivered to the socket (resulting in EAGAIN). By using a blocking
socket, the test will wait until `recvmsg` no longer returns EAGAIN.

PiperOrigin-RevId: 641989486
This commit is contained in:
Jeff Martin
2024-06-10 12:43:07 -07:00
committed by gVisor bot
parent 2a0dff228a
commit 04369e04d0
+1 -2
View File
@@ -592,8 +592,7 @@ class RawSocketICMPv6Test : public Test {
void SetUp() override {
SKIP_IF(!ASSERT_NO_ERRNO_AND_VALUE(HaveRawIPSocketCapability()));
fd_ = ASSERT_NO_ERRNO_AND_VALUE(
Socket(AF_INET6, SOCK_RAW | SOCK_NONBLOCK, IPPROTO_ICMPV6));
fd_ = ASSERT_NO_ERRNO_AND_VALUE(Socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6));
}
void TearDown() override {