From 149ca009678edc580de9f0b1d54f551d376742cb Mon Sep 17 00:00:00 2001 From: Ghanan Gowripalan Date: Wed, 15 Sep 2021 12:18:00 -0700 Subject: [bind] Return EINVAL for under sized address ...and EAFNOSUPPORT for unexpected address family. To comply with Linux. Updates #6021, #6575. PiperOrigin-RevId: 396893590 --- test/syscalls/linux/udp_socket.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/syscalls/linux/udp_socket.cc') diff --git a/test/syscalls/linux/udp_socket.cc b/test/syscalls/linux/udp_socket.cc index b9af5cbdd..0c0a16074 100644 --- a/test/syscalls/linux/udp_socket.cc +++ b/test/syscalls/linux/udp_socket.cc @@ -643,12 +643,12 @@ TEST_P(UdpSocketTest, DisconnectAfterBindToUnspecAndConnect) { sockaddr_storage unspec = {.ss_family = AF_UNSPEC}; int bind_res = bind(sock_.get(), AsSockAddr(&unspec), sizeof(unspec)); - if (IsRunningOnGvisor() && !IsRunningWithHostinet()) { - // TODO(https://gvisor.dev/issue/6575): Match Linux's behaviour. - ASSERT_THAT(bind_res, SyscallFailsWithErrno(EINVAL)); - } else if (GetFamily() == AF_INET) { + if ((!IsRunningOnGvisor() || IsRunningWithHostinet()) && + GetFamily() == AF_INET) { // Linux allows this for undocumented compatibility reasons: // https://github.com/torvalds/linux/commit/29c486df6a208432b370bd4be99ae1369ede28d8. + // + // TODO(https://gvisor.dev/issue/6575): Match Linux's behaviour. ASSERT_THAT(bind_res, SyscallSucceeds()); } else { ASSERT_THAT(bind_res, SyscallFailsWithErrno(EAFNOSUPPORT)); -- cgit v1.2.3