From dfb3273f887a80c25a6d133fd5a082153ba58570 Mon Sep 17 00:00:00 2001 From: Ghanan Gowripalan Date: Wed, 1 Sep 2021 19:41:43 -0700 Subject: Support sending with packet sockets ...through the loopback interface, only. This change only supports sending on packet sockets through the loopback interface as the loopback interface is the only interface used in packet socket syscall tests - the other link endpoints are not excercised with the existing test infrastructure. Support for sending on packet sockets through the other interfaces will be added as needed. BUG: https://fxbug.dev/81592 PiperOrigin-RevId: 394368899 --- test/runner/main.go | 1 + test/syscalls/linux/packet_socket.cc | 8 -------- test/syscalls/linux/packet_socket_raw.cc | 8 -------- 3 files changed, 1 insertion(+), 16 deletions(-) (limited to 'test') diff --git a/test/runner/main.go b/test/runner/main.go index 34e9c6279..2cab8d2d4 100644 --- a/test/runner/main.go +++ b/test/runner/main.go @@ -170,6 +170,7 @@ func runRunsc(tc gtest.TestCase, spec *specs.Spec) error { "-network", *network, "-log-format=text", "-TESTONLY-unsafe-nonroot=true", + "-TESTONLY-allow-packet-endpoint-write=true", "-net-raw=true", fmt.Sprintf("-panic-signal=%d", unix.SIGTERM), "-watchdog-action=panic", diff --git a/test/syscalls/linux/packet_socket.cc b/test/syscalls/linux/packet_socket.cc index ca4ab0aad..bfa5d179a 100644 --- a/test/syscalls/linux/packet_socket.cc +++ b/test/syscalls/linux/packet_socket.cc @@ -285,14 +285,6 @@ 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(&dest), sizeof(dest)), - SyscallFailsWithErrno(EINVAL)); - GTEST_SKIP(); - } - // Send it. ASSERT_THAT(sendto(socket_, send_buf, sizeof(send_buf), 0, reinterpret_cast(&dest), sizeof(dest)), diff --git a/test/syscalls/linux/packet_socket_raw.cc b/test/syscalls/linux/packet_socket_raw.cc index 61714d1da..e57c60ffa 100644 --- a/test/syscalls/linux/packet_socket_raw.cc +++ b/test/syscalls/linux/packet_socket_raw.cc @@ -296,14 +296,6 @@ TEST_P(RawPacketTest, Send) { memcpy(send_buf + sizeof(ethhdr) + sizeof(iphdr) + sizeof(udphdr), kMessage, sizeof(kMessage)); - // We don't implement writing to packet sockets on gVisor. - if (IsRunningOnGvisor()) { - ASSERT_THAT(sendto(s_, send_buf, sizeof(send_buf), 0, - reinterpret_cast(&dest), sizeof(dest)), - SyscallFailsWithErrno(EINVAL)); - GTEST_SKIP(); - } - // Send it. ASSERT_THAT(sendto(s_, send_buf, sizeof(send_buf), 0, reinterpret_cast(&dest), sizeof(dest)), -- cgit v1.2.3