aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2018-07-09 15:28:09 +0200
committerMicael Karlberg <[email protected]>2018-09-18 14:50:18 +0200
commit6031321a78e3df5304f555ba356a4482469e7d56 (patch)
treeb75a85a7d100eef2bfd395e22fd9651300dde62d /lib/kernel
parent7ed2af8dcfd62a051686ac1e1326fbeca0b18334 (diff)
downloadotp-6031321a78e3df5304f555ba356a4482469e7d56.tar.gz
otp-6031321a78e3df5304f555ba356a4482469e7d56.tar.bz2
otp-6031321a78e3df5304f555ba356a4482469e7d56.zip
[socket-nif] Add support for socket (level socket) option debug
The socket option (level socket) debug is now supported. To actually set this option, the user must have the proper "authority" (CAP_NET_ADMIN capability or an effective user ID of 0). OTP-14831
Diffstat (limited to 'lib/kernel')
-rw-r--r--lib/kernel/test/socket_server.erl13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/kernel/test/socket_server.erl b/lib/kernel/test/socket_server.erl
index 52b0d5b558..54e13cc92d 100644
--- a/lib/kernel/test/socket_server.erl
+++ b/lib/kernel/test/socket_server.erl
@@ -260,17 +260,24 @@ acceptor_do_init(Domain, Type, Proto) ->
end,
F = fun(X) -> case socket:getopt(Sock, socket, X) of
{ok, V} -> f("~p", [V]);
- {error, _} -> f("~w", [X])
+ {error, _} -> "-"
end
end,
- i("(socket) open (~s,~s,~s) - try find (local) address",
- [F(domain), F(type), F(protocol)]),
+ i("(socket) open (~s,~s,~s): "
+ "~n debug: ~s"
+ "~n prio: ~s"
+ "~n try find (local) address",
+ [F(domain), F(type), F(protocol), F(debug), F(priority)]),
Addr = which_addr(Domain),
SA = #{family => Domain,
addr => Addr},
i("found (~p) - try (socket) bind", [Addr]),
+ %% ok = socket:setopt(Sock, otp, debug, true),
+ %% ok = socket:setopt(Sock, socket, debug, 1), %% must have rights!!
Port = case socket:bind(Sock, SA) of
{ok, P} ->
+ %% ok = socket:setopt(Sock, socket, debug, 0), %% must have rights!!
+ %% ok = socket:setopt(Sock, otp, debug, false),
P;
{error, BReason} ->
throw({bind, BReason})