diff options
author | Ghanan Gowripalan <ghanan@google.com> | 2021-09-14 14:00:55 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-09-14 14:03:53 -0700 |
commit | 5593b8a7e6cb5fc04c1b9e23a92b880517330cd4 (patch) | |
tree | c329a36b2dd9bec88068fc02c378595f36a92e7b | |
parent | 2b46e2d19e642ed8a0a58ea1c62a38b53e7dfb2d (diff) |
Don't use SOL_UDP when creating sockets
SOL_UDP is used when get/set-ing socket options to specify the socket
level. When creating normal UDP sockets, the protocol need not be
specified. When creating RAW IP sockets for UDP, use IPPROTO_UDP.
PiperOrigin-RevId: 396675986
-rw-r--r-- | test/syscalls/linux/raw_socket.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/syscalls/linux/raw_socket.cc b/test/syscalls/linux/raw_socket.cc index f0eb7cc4a..ef1db47ee 100644 --- a/test/syscalls/linux/raw_socket.cc +++ b/test/syscalls/linux/raw_socket.cc @@ -950,7 +950,7 @@ void TestRawSocketMaybeBindReceive(bool do_bind) { }; FileDescriptor udp_sock = - ASSERT_NO_ERRNO_AND_VALUE(Socket(AF_INET, SOCK_DGRAM, SOL_UDP)); + ASSERT_NO_ERRNO_AND_VALUE(Socket(AF_INET, SOCK_DGRAM, 0)); sockaddr_in udp_sock_bind_addr = addr; socklen_t udp_sock_bind_addr_len = sizeof(udp_sock_bind_addr); ASSERT_THAT(bind(udp_sock.get(), @@ -964,7 +964,7 @@ void TestRawSocketMaybeBindReceive(bool do_bind) { ASSERT_EQ(udp_sock_bind_addr_len, sizeof(udp_sock_bind_addr)); FileDescriptor raw_sock = - ASSERT_NO_ERRNO_AND_VALUE(Socket(AF_INET, SOCK_RAW, SOL_UDP)); + ASSERT_NO_ERRNO_AND_VALUE(Socket(AF_INET, SOCK_RAW, IPPROTO_UDP)); auto test_recv = [&](const char* scope, uint32_t expected_destination) { SCOPED_TRACE(scope); |