diff options
author | Micael Karlberg <[email protected]> | 2018-07-09 15:28:09 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2018-09-18 14:50:18 +0200 |
commit | 6031321a78e3df5304f555ba356a4482469e7d56 (patch) | |
tree | b75a85a7d100eef2bfd395e22fd9651300dde62d /erts/preloaded/src | |
parent | 7ed2af8dcfd62a051686ac1e1326fbeca0b18334 (diff) | |
download | otp-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 'erts/preloaded/src')
-rw-r--r-- | erts/preloaded/src/socket.erl | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/erts/preloaded/src/socket.erl b/erts/preloaded/src/socket.erl index f22f9e5072..66ae9c7fd8 100644 --- a/erts/preloaded/src/socket.erl +++ b/erts/preloaded/src/socket.erl @@ -469,7 +469,7 @@ %% -define(SOCKET_OPT_SOCK_BINDTODEVICE, 3). -define(SOCKET_OPT_SOCK_BROADCAST, 4). %% -define(SOCKET_OPT_SOCK_BUSY_POLL, 5). -%% -define(SOCKET_OPT_SOCK_DEBUG, 6). +-define(SOCKET_OPT_SOCK_DEBUG, 6). -define(SOCKET_OPT_SOCK_DOMAIN, 7). -define(SOCKET_OPT_SOCK_DONTROUTE, 8). %% -define(SOCKET_OPT_SOCK_ERROR, 9). @@ -1831,6 +1831,8 @@ enc_setopt_value(otp = L, Opt, V, _D, _T, _P) -> enc_setopt_value(socket, broadcast, V, _D, _T, _P) when is_boolean(V) -> V; +enc_setopt_value(socket, debug, V, _D, _T, _P) when is_integer(V) -> + V; enc_setopt_value(socket, keepalive, V, _D, _T, _P) when is_boolean(V) -> V; enc_setopt_value(socket, linger, abort, D, T, P) -> @@ -2045,8 +2047,8 @@ enc_sockopt_key(socket, broadcast = _Opt, _Dir, _D, dgram = _T, _P) -> ?SOCKET_OPT_SOCK_BROADCAST; enc_sockopt_key(socket = L, busy_poll = Opt, _Dir, _D, _T, _P) -> not_supported({L, Opt}); -enc_sockopt_key(socket = L, debug = Opt, _Dir, _D, _T, _P) -> - not_supported({L, Opt}); +enc_sockopt_key(socket = _L, debug = _Opt, _Dir, _D, _T, _P) -> + ?SOCKET_OPT_SOCK_DEBUG; enc_sockopt_key(socket, domain = _Opt, get = _Dir, _D, _T, _P) -> ?SOCKET_OPT_SOCK_DOMAIN; enc_sockopt_key(socket, dontroute = _Opt, _Dir, _D, _T, _P) -> |