From 12e99364db99e336d5382510241f47e40e0db9af Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 17 May 2019 16:43:30 +0200 Subject: [esock|test] On some platforms recvmsg does *not* return address On some platforms, e.g. FreeBSD, recvmsg does *not* return address for a Unix Domain (stream) socket. Unlike, for instance, on Linux. OTP-15822 --- erts/emulator/test/socket_SUITE.erl | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'erts/emulator/test') diff --git a/erts/emulator/test/socket_SUITE.erl b/erts/emulator/test/socket_SUITE.erl index 337a34c0d2..b420acd57c 100644 --- a/erts/emulator/test/socket_SUITE.erl +++ b/erts/emulator/test/socket_SUITE.erl @@ -2156,10 +2156,25 @@ api_b_sendmsg_and_recvmsg_tcpL(_Config) when is_list(_Config) -> end, Recv = fun(Sock) -> case socket:recvmsg(Sock) of + %% On some platforms, the address + %% is *not* provided (e.g. FreeBSD) + {ok, #{addr := undefined, + iov := [Data]}} -> + {ok, Data}; + %% On some platforms, the address + %% *is* provided (e.g. linux) {ok, #{addr := #{family := local}, iov := [Data]}} -> + socket:setopt(Sock, + otp, + debug, + false), {ok, Data}; {error, _} = ERROR -> + socket:setopt(Sock, + otp, + debug, + false), ERROR end end, @@ -9539,6 +9554,13 @@ sc_rs_recvmsg_send_shutdown_receive_tcpL(_Config) when is_list(_Config) -> MsgData = ?DATA, Recv = fun(Sock) -> case socket:recvmsg(Sock) of + %% On some platforms, the address + %% is *not* provided (e.g. FreeBSD) + {ok, #{addr := undefined, + iov := [Data]}} -> + {ok, Data}; + %% On some platforms, the address + %% *is* provided (e.g. linux) {ok, #{addr := #{family := local}, iov := [Data]}} -> {ok, Data}; @@ -11472,6 +11494,13 @@ traffic_ping_pong_send_and_recv_tcp(InitState) -> traffic_ping_pong_sendmsg_and_recvmsg_tcp(#{domain := local} = InitState) -> Recv = fun(Sock, Sz) -> case socket:recvmsg(Sock, Sz, 0) of + %% On some platforms, the address + %% is *not* provided (e.g. FreeBSD) + {ok, #{addr := undefined, + iov := [Data]}} -> + {ok, Data}; + %% On some platforms, the address + %% *is* provided (e.g. linux) {ok, #{addr := #{family := local}, iov := [Data]}} -> {ok, Data}; @@ -19932,7 +19961,12 @@ has_support_unix_domain_socket() -> {win32, _} -> {skip, "Not supported"}; _ -> - ok + case socket:supports(local) of + true -> + ok; + false -> + {skip, "Not supported"} + end end. -- cgit v1.2.3