diff options
author | Kevin Krakauer <krakauer@google.com> | 2021-06-28 10:38:34 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-06-28 10:40:55 -0700 |
commit | 27cc5a883a3cc077da884c0d058b69b607ec02f2 (patch) | |
tree | 8ee462eb39360e8f11251f75f0595f2575751b6c /test/syscalls/linux/packet_socket.cc | |
parent | e5526f4f2696a2334d61b05f31ad23b7bee4342b (diff) |
check explicitly that AF_PACKET sockets can't write in gVisor
PiperOrigin-RevId: 381896875
Diffstat (limited to 'test/syscalls/linux/packet_socket.cc')
-rw-r--r-- | test/syscalls/linux/packet_socket.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/test/syscalls/linux/packet_socket.cc b/test/syscalls/linux/packet_socket.cc index 4f68de176..1e246c421 100644 --- a/test/syscalls/linux/packet_socket.cc +++ b/test/syscalls/linux/packet_socket.cc @@ -231,9 +231,6 @@ TEST_P(CookedPacketTest, Receive) { // Send via a packet socket. TEST_P(CookedPacketTest, Send) { - // We don't implement writing to packet sockets on gVisor. - SKIP_IF(IsRunningOnGvisor()); - // Let's send a UDP packet and receive it using a regular UDP socket. FileDescriptor udp_sock = ASSERT_NO_ERRNO_AND_VALUE(Socket(AF_INET, SOCK_DGRAM, 0)); @@ -287,6 +284,14 @@ TEST_P(CookedPacketTest, Send) { memcpy(send_buf + sizeof(iphdr), &udphdr, sizeof(udphdr)); memcpy(send_buf + sizeof(iphdr) + sizeof(udphdr), kMessage, sizeof(kMessage)); + // We don't implement writing to packet sockets on gVisor. + if (IsRunningOnGvisor()) { + ASSERT_THAT(sendto(socket_, send_buf, sizeof(send_buf), 0, + reinterpret_cast<struct sockaddr*>(&dest), sizeof(dest)), + SyscallFailsWithErrno(EINVAL)); + GTEST_SKIP(); + } + // Send it. ASSERT_THAT(sendto(socket_, send_buf, sizeof(send_buf), 0, reinterpret_cast<struct sockaddr*>(&dest), sizeof(dest)), |