diff options
author | Micael Karlberg <[email protected]> | 2018-07-25 12:29:41 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2018-09-18 14:50:18 +0200 |
commit | 70a5b8d6a01b91a6044c6a5a0f8ed8919afd509b (patch) | |
tree | 878cf90a617b2d9404c81b29e48cc589601752c3 /erts/preloaded | |
parent | 587d3a9a76b6ef2c88b850d007d39d34c37b5825 (diff) | |
download | otp-70a5b8d6a01b91a6044c6a5a0f8ed8919afd509b.tar.gz otp-70a5b8d6a01b91a6044c6a5a0f8ed8919afd509b.tar.bz2 otp-70a5b8d6a01b91a6044c6a5a0f8ed8919afd509b.zip |
[socket-nif] Add support for socket (level ip) option pktinfo
Added support for ip level socket option PKTINFO.
This option requires sendmsg and/or recvmsg to actually use,
so we cannot test this fully at the moment (although both set
and get works).
OTP-14831
Diffstat (limited to 'erts/preloaded')
-rw-r--r-- | erts/preloaded/ebin/socket.beam | bin | 59016 -> 59056 bytes | |||
-rw-r--r-- | erts/preloaded/src/socket.erl | 9 |
2 files changed, 6 insertions, 3 deletions
diff --git a/erts/preloaded/ebin/socket.beam b/erts/preloaded/ebin/socket.beam Binary files differindex be5413e116..b5b18e1c3a 100644 --- a/erts/preloaded/ebin/socket.beam +++ b/erts/preloaded/ebin/socket.beam diff --git a/erts/preloaded/src/socket.erl b/erts/preloaded/src/socket.erl index 4028fa9191..28931e4ed0 100644 --- a/erts/preloaded/src/socket.erl +++ b/erts/preloaded/src/socket.erl @@ -632,7 +632,7 @@ -define(SOCKET_OPT_IP_MULTICAST_TTL, 16). -define(SOCKET_OPT_IP_NODEFRAG, 17). %% -define(SOCKET_OPT_IP_OPTIONS, 18). % FreeBSD -%% -define(SOCKET_OPT_IP_PKTINFO, 19). +-define(SOCKET_OPT_IP_PKTINFO, 19). -define(SOCKET_OPT_IP_RECVERR, 20). -define(SOCKET_OPT_IP_RECVIF, 21). %% -define(SOCKET_OPT_IP_RECVDSTADDR, 22). @@ -2246,6 +2246,9 @@ enc_setopt_value(ip, multicast_ttl, V, _D, _T, _P) enc_setopt_value(ip, nodefrag, V, _D, _T, _P) when is_boolean(V) -> V; +enc_setopt_value(ip, pktinfo, V, _D, _T, _P) + when is_boolean(V) -> + V; enc_setopt_value(ip, recverr, V, _D, _T, _P) when is_boolean(V) -> V; @@ -2700,8 +2703,8 @@ enc_sockopt_key(ip = _L, nodefrag = _Opt, _Dir, _D, raw = _T, _P) -> ?SOCKET_OPT_IP_NODEFRAG; enc_sockopt_key(ip = L, options = Opt, _Dir, _D, _T, _P) -> not_supported({Opt, L}); -enc_sockopt_key(ip = L, pktinfo = Opt, _Dir, _D, _T, _P) -> - not_supported({L, Opt}); +enc_sockopt_key(ip = _L, pktinfo = _Opt, _Dir, _D, dgram = _T, _P) -> + ?SOCKET_OPT_IP_PKTINFO; %% This require special code for accessing the errors. %% via calling the recvmsg with the MSG_ERRQUEUE flag set, enc_sockopt_key(ip = _L, recverr = _Opt, _Dir, _D, _T, _P) -> |