diff options
author | Ian Gudger <igudger@google.com> | 2020-06-12 20:47:28 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-06-12 20:49:02 -0700 |
commit | 3b5eaad3c8b49367d1812dbaf4182fc7282b7f00 (patch) | |
tree | d0da6ed755e24b79800a4b03a8b96fdf5a0c358f /test | |
parent | 82313667ea4bd56d64dd1f7898aa80942684ca2c (diff) |
Allow reading IP_MULTICAST_LOOP and IP_MULTICAST_TTL on TCP sockets.
I am not really sure what the point of this is, but someone filed a bug about
it, so I assume something relies on it.
PiperOrigin-RevId: 316225127
Diffstat (limited to 'test')
-rw-r--r-- | test/syscalls/linux/socket_ip_tcp_generic.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/syscalls/linux/socket_ip_tcp_generic.cc b/test/syscalls/linux/socket_ip_tcp_generic.cc index 15adc8d0e..c2ecb639f 100644 --- a/test/syscalls/linux/socket_ip_tcp_generic.cc +++ b/test/syscalls/linux/socket_ip_tcp_generic.cc @@ -994,6 +994,30 @@ TEST_P(TCPSocketPairTest, SetTCPWindowClampBelowMinRcvBufConnectedSocket) { } } +TEST_P(TCPSocketPairTest, IpMulticastTtlDefault) { + auto sockets = ASSERT_NO_ERRNO_AND_VALUE(NewSocketPair()); + + int get = -1; + socklen_t get_len = sizeof(get); + EXPECT_THAT(getsockopt(sockets->first_fd(), IPPROTO_IP, IP_MULTICAST_TTL, + &get, &get_len), + SyscallSucceedsWithValue(0)); + EXPECT_EQ(get_len, sizeof(get)); + EXPECT_GT(get, 0); +} + +TEST_P(TCPSocketPairTest, IpMulticastLoopDefault) { + auto sockets = ASSERT_NO_ERRNO_AND_VALUE(NewSocketPair()); + + int get = -1; + socklen_t get_len = sizeof(get); + EXPECT_THAT(getsockopt(sockets->first_fd(), IPPROTO_IP, IP_MULTICAST_LOOP, + &get, &get_len), + SyscallSucceedsWithValue(0)); + EXPECT_EQ(get_len, sizeof(get)); + EXPECT_EQ(get, 1); +} + TEST_P(TCPSocketPairTest, TCPResetDuringClose_NoRandomSave) { DisableSave ds; // Too many syscalls. constexpr int kThreadCount = 1000; |