diff options
author | Micael Karlberg <[email protected]> | 2018-07-24 17:01:46 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2018-09-18 14:50:18 +0200 |
commit | 4e24993aff4c5a0cb2bec96e5499131a660a79f9 (patch) | |
tree | 01dbfd99552c6b7f1baddcc101ba6d664c68d877 /erts/preloaded/src | |
parent | 00a2425bde77ddb9ae4c03b8c4e5470064773981 (diff) | |
download | otp-4e24993aff4c5a0cb2bec96e5499131a660a79f9.tar.gz otp-4e24993aff4c5a0cb2bec96e5499131a660a79f9.tar.bz2 otp-4e24993aff4c5a0cb2bec96e5499131a660a79f9.zip |
[socket-nif] Add support for socket (level ipv6) option recverr
Added support for the IPv6 socket option RECVERR.
To actually make use of this option, we need the recvmsg
function, which we don't have yet. Baby steps.
OTP-14831.
Diffstat (limited to 'erts/preloaded/src')
-rw-r--r-- | erts/preloaded/src/socket.erl | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/erts/preloaded/src/socket.erl b/erts/preloaded/src/socket.erl index 0a101008c6..5695e45ac5 100644 --- a/erts/preloaded/src/socket.erl +++ b/erts/preloaded/src/socket.erl @@ -658,7 +658,7 @@ -define(SOCKET_OPT_IPV6_MULTICAST_LOOP, 21). %% -define(SOCKET_OPT_IPV6_PORTRANGE, 22). % FreeBSD %% -define(SOCKET_OPT_IPV6_PKTOPTIONS, 23). % FreeBSD -%% -define(SOCKET_OPT_IPV6_RECVERR, 24). +-define(SOCKET_OPT_IPV6_RECVERR, 24). -define(SOCKET_OPT_IPV6_RECVPKTINFO, 25). % On FreeBSD: PKTINFO %% -define(SOCKET_OPT_IPV6_RECVTCLASS, 26). -define(SOCKET_OPT_IPV6_ROUTER_ALERT, 27). @@ -2308,6 +2308,9 @@ enc_setopt_value(ipv6, multicast_if, V, _D, _T, _P) enc_setopt_value(ipv6, multicast_loop, V, _D, _T, _P) when is_boolean(V) -> V; +enc_setopt_value(ipv6, recverr, V, _D, _T, _P) + when is_boolean(V) -> + V; enc_setopt_value(ipv6, Opt, V, _D, _T, _P) when ((Opt =:= recvpktinfo) orelse (Opt =:= pktinfo)) andalso is_boolean(V) -> @@ -2759,8 +2762,8 @@ enc_sockopt_key(ipv6 = L, portrange = Opt, _Dir, _D, _T, _P) -> not_supported({L, Opt}); enc_sockopt_key(ipv6 = L, pktoptions = Opt, _Dir, _D, _T, _P) -> not_supported({L, Opt}); -enc_sockopt_key(ipv6 = L, recverr = Opt, _Dir, _D, _T, _P) -> - not_supported({L, Opt}); +enc_sockopt_key(ipv6 = _L, recverr = _Opt, _Dir, _D, _T, _P) -> + ?SOCKET_OPT_IPV6_RECVERR; enc_sockopt_key(ipv6 = _L, Opt, _Dir, _D, T, _P) when ((Opt =:= recvpktinfo) orelse (Opt =:= pktinfo)) andalso ((T =:= dgram) orelse (T =:= raw)) -> @@ -2781,7 +2784,7 @@ enc_sockopt_key(ipv6 = L, use_min_mtu = Opt, _Dir, _D, _T, _P) -> enc_sockopt_key(ipv6 = _L, v6only = _Opt, _Dir, _D, _T, _P) -> ?SOCKET_OPT_IPV6_V6ONLY; enc_sockopt_key(ipv6 = L, UnknownOpt, _Dir, _D, _T, _P) -> - unknown({L, UnknownOpt, _Dir, _D, _T, _P}); + unknown({L, UnknownOpt}); %% TCP socket options %% There are other options that would be useful; info, |