summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls/linux/udp_socket.cc
diff options
context:
space:
mode:
authorGhanan Gowripalan <ghanan@google.com>2021-09-15 12:18:00 -0700
committergVisor bot <gvisor-bot@google.com>2021-09-15 12:20:51 -0700
commit149ca009678edc580de9f0b1d54f551d376742cb (patch)
tree648e02a87b55617196e68474aa4a07b49d586c0f /test/syscalls/linux/udp_socket.cc
parent2d9883e4f1355677f986fc9a387fb70b6e438611 (diff)
[bind] Return EINVAL for under sized address
...and EAFNOSUPPORT for unexpected address family. To comply with Linux. Updates #6021, #6575. PiperOrigin-RevId: 396893590
Diffstat (limited to 'test/syscalls/linux/udp_socket.cc')
-rw-r--r--test/syscalls/linux/udp_socket.cc8
1 files changed, 4 insertions, 4 deletions
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));