diff options
author | Ian Gudger <igudger@google.com> | 2019-02-07 23:14:06 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-02-07 23:15:23 -0800 |
commit | 80f901b16b8bb8fe397cc44578035173f5155b24 (patch) | |
tree | 91707e2f2b424f71f7bac661c05a830b56244255 /test/syscalls/linux/socket_ip_udp_generic.cc | |
parent | fda4d1f4f11201c34bd15d41ba4c94279d135d95 (diff) |
Plumb IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP to netstack.
Also includes a few fixes for IPv4 multicast support. IPv6 support is coming in
a followup CL.
PiperOrigin-RevId: 233008638
Change-Id: If7dae6222fef43fda48033f0292af77832d95e82
Diffstat (limited to 'test/syscalls/linux/socket_ip_udp_generic.cc')
-rw-r--r-- | test/syscalls/linux/socket_ip_udp_generic.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/syscalls/linux/socket_ip_udp_generic.cc b/test/syscalls/linux/socket_ip_udp_generic.cc index 789154fb3..58d1c846d 100644 --- a/test/syscalls/linux/socket_ip_udp_generic.cc +++ b/test/syscalls/linux/socket_ip_udp_generic.cc @@ -117,5 +117,19 @@ TEST_P(UDPSocketPairTest, SetUDPMulticastTTLAboveMax) { SyscallFailsWithErrno(EINVAL)); } +TEST_P(UDPSocketPairTest, SetEmptyIPAddMembership) { + auto sockets = ASSERT_NO_ERRNO_AND_VALUE(NewSocketPair()); + + struct ip_mreqn req = {}; + int ret = setsockopt(sockets->first_fd(), IPPROTO_IP, IP_ADD_MEMBERSHIP, &req, + sizeof(req)); + // FIXME: gVisor returns the incorrect errno. + if (IsRunningOnGvisor()) { + EXPECT_THAT(ret, SyscallFails()); + } else { + EXPECT_THAT(ret, SyscallFailsWithErrno(EINVAL)); + } +} + } // namespace testing } // namespace gvisor |