diff options
author | Andrei Vagin <avagin@google.com> | 2021-04-23 16:43:03 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-04-23 16:45:03 -0700 |
commit | 80cd26c2f43e78d43e2ff769cf0449e67254e673 (patch) | |
tree | 5dd1e5cbeea267597a83023e4e33734b0fdb8566 /test/syscalls | |
parent | 915b8137981e5acb48b58f378a058b88938d44d4 (diff) |
hostinet: parse the timeval structure from a SO_TIMESTAMP control message
PiperOrigin-RevId: 370181621
Diffstat (limited to 'test/syscalls')
-rw-r--r-- | test/syscalls/linux/udp_socket.cc | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/test/syscalls/linux/udp_socket.cc b/test/syscalls/linux/udp_socket.cc index 18f566eec..29e174f71 100644 --- a/test/syscalls/linux/udp_socket.cc +++ b/test/syscalls/linux/udp_socket.cc @@ -1529,10 +1529,6 @@ TEST_P(UdpSocketTest, ErrorQueue) { #endif // __linux__ TEST_P(UdpSocketTest, SoTimestampOffByDefault) { - // TODO(gvisor.dev/issue/1202): SO_TIMESTAMP socket option not supported by - // hostinet. - SKIP_IF(IsRunningWithHostinet()); - int v = -1; socklen_t optlen = sizeof(v); ASSERT_THAT(getsockopt(bind_.get(), SOL_SOCKET, SO_TIMESTAMP, &v, &optlen), @@ -1542,10 +1538,6 @@ TEST_P(UdpSocketTest, SoTimestampOffByDefault) { } TEST_P(UdpSocketTest, SoTimestamp) { - // TODO(gvisor.dev/issue/1202): ioctl() and SO_TIMESTAMP socket option are not - // supported by hostinet. - SKIP_IF(IsRunningWithHostinet()); - ASSERT_NO_ERRNO(BindLoopback()); ASSERT_THAT(connect(sock_.get(), bind_addr_, addrlen_), SyscallSucceeds()); @@ -1555,8 +1547,8 @@ TEST_P(UdpSocketTest, SoTimestamp) { char buf[3]; // Send zero length packet from sock to bind_. - ASSERT_THAT(RetryEINTR(write)(sock_.get(), buf, 0), - SyscallSucceedsWithValue(0)); + ASSERT_THAT(RetryEINTR(write)(sock_.get(), buf, sizeof(buf)), + SyscallSucceedsWithValue(sizeof(buf))); struct pollfd pfd = {bind_.get(), POLLIN, 0}; ASSERT_THAT(RetryEINTR(poll)(&pfd, 1, /*timeout=*/1000), @@ -1586,9 +1578,13 @@ TEST_P(UdpSocketTest, SoTimestamp) { ASSERT_TRUE(tv.tv_sec != 0 || tv.tv_usec != 0); - // There should be nothing to get via ioctl. - ASSERT_THAT(ioctl(bind_.get(), SIOCGSTAMP, &tv), - SyscallFailsWithErrno(ENOENT)); + // TODO(gvisor.dev/issue/1202): ioctl(SIOCGSTAMP) is not supported by + // hostinet. + if (!IsRunningWithHostinet()) { + // There should be nothing to get via ioctl. + ASSERT_THAT(ioctl(bind_.get(), SIOCGSTAMP, &tv), + SyscallFailsWithErrno(ENOENT)); + } } TEST_P(UdpSocketTest, WriteShutdownNotConnected) { |