Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable netstack save/restore in cloud/gvisor by default. #11267

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/tcpip/stack/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -1976,8 +1976,8 @@ func (s *Stack) ReplaceConfig(st *Stack) {
s.SetRouteTable(st.GetRouteTable())

// Update NICs.
st.mu.Lock()
defer st.mu.Unlock()
st.mu.RLock()
defer st.mu.RUnlock()
s.mu.Lock()
defer s.mu.Unlock()
s.nics = make(map[tcpip.NICID]*nic)
Expand Down
3 changes: 0 additions & 3 deletions test/syscalls/linux/partial_bad_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,6 @@ PosixErrorOr<sockaddr_storage> InetLoopbackAddr(int family) {
// pages one valid and one guard page succeeds as long as the write is
// for exactly the size of 1 page.
TEST_F(PartialBadBufferTest, SendMsgTCP) {
// FIXME(b/171436815): Netstack save/restore is broken.
const DisableSave ds;

auto listen_socket =
ASSERT_NO_ERRNO_AND_VALUE(Socket(AF_INET, SOCK_STREAM, IPPROTO_TCP));

Expand Down
41 changes: 18 additions & 23 deletions test/syscalls/linux/tcp_socket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#include <fcntl.h>

#include <memory>

#ifdef __linux__
#include <linux/filter.h>
#include <sys/epoll.h>
Expand Down Expand Up @@ -1317,23 +1319,22 @@ TEST_P(SimpleTcpSocketTest, ListenConnectParallel) {
std::vector<std::unique_ptr<ScopedThread>> threads;
threads.reserve(num_threads);
for (int i = 0; i < num_threads; i++) {
threads.push_back(
std::make_unique<ScopedThread>([&addr, &addrlen, family]() {
const FileDescriptor c = ASSERT_NO_ERRNO_AND_VALUE(
Socket(family, SOCK_STREAM | SOCK_NONBLOCK, IPPROTO_TCP));

// Now connect to the bound address and this should fail as nothing
// is listening on the bound address.
EXPECT_THAT(RetryEINTR(connect)(c.get(), AsSockAddr(&addr), addrlen),
SyscallFailsWithErrno(EINPROGRESS));
// Wait for the connect to fail or succeed as it can race with the
// socket listening.
struct pollfd poll_fd = {c.get(), POLLERR | POLLOUT, 0};
const int timeout =
GvisorPlatform() == Platform::kFuchsia ? -1 : 1000;
EXPECT_THAT(RetryEINTR(poll)(&poll_fd, 1, timeout),
SyscallSucceedsWithValue(1));
}));
threads.push_back(std::make_unique<ScopedThread>([&addr, &addrlen,
family]() {
const FileDescriptor c = ASSERT_NO_ERRNO_AND_VALUE(
Socket(family, SOCK_STREAM | SOCK_NONBLOCK, IPPROTO_TCP));

// Now connect to the bound address and this should fail as nothing
// is listening on the bound address.
EXPECT_THAT(RetryEINTR(connect)(c.get(), AsSockAddr(&addr), addrlen),
SyscallFailsWithErrno(EINPROGRESS));
// Wait for the connect to fail or succeed as it can race with the
// socket listening.
struct pollfd poll_fd = {c.get(), POLLERR | POLLOUT, 0};
const int timeout = GvisorPlatform() == Platform::kFuchsia ? -1 : 1000;
EXPECT_THAT(RetryEINTR(poll)(&poll_fd, 1, timeout),
SyscallSucceedsWithValue(1));
}));
}
}

Expand Down Expand Up @@ -2458,24 +2459,18 @@ void ShutdownConnectingSocket(int domain, int shutdown_mode) {
}

TEST_P(SimpleTcpSocketTest, ShutdownReadConnectingSocket) {
// TODO(b/171436815): Re-enable when S/R is fixed.
const DisableSave disable_save;
// TODO(b/175409607): Fix this test for hostinet.
SKIP_IF(IsRunningWithHostinet());
ShutdownConnectingSocket(GetParam(), SHUT_RD);
}

TEST_P(SimpleTcpSocketTest, ShutdownWriteConnectingSocket) {
// TODO(b/171436815): Re-enable when S/R is fixed.
const DisableSave disable_save;
// TODO(b/175409607): Fix this test for hostinet.
SKIP_IF(IsRunningWithHostinet());
ShutdownConnectingSocket(GetParam(), SHUT_WR);
}

TEST_P(SimpleTcpSocketTest, ShutdownReadWriteConnectingSocket) {
// TODO(b/171436815): Re-enable when S/R is fixed.
const DisableSave disable_save;
// TODO(b/175409607): Fix this test for hostinet.
SKIP_IF(IsRunningWithHostinet());
ShutdownConnectingSocket(GetParam(), SHUT_RDWR);
Expand Down
Loading