aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded/src/socket.erl
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2018-07-18 10:23:45 +0200
committerMicael Karlberg <[email protected]>2018-09-18 14:50:18 +0200
commit8d759e6f00b1cf834fe21654de3f53df706e8c0f (patch)
tree398850c414d1b9a67cdaf3d4c6e003a196eacd2b /erts/preloaded/src/socket.erl
parent180fd01ba04ff24e5b9cb8ab0098342f1d443b17 (diff)
downloadotp-8d759e6f00b1cf834fe21654de3f53df706e8c0f.tar.gz
otp-8d759e6f00b1cf834fe21654de3f53df706e8c0f.tar.bz2
otp-8d759e6f00b1cf834fe21654de3f53df706e8c0f.zip
[socket-nif] Add support for socket (level ipv6) option v6only
Added support for the IPv6 option V6ONLY. OTP-14831
Diffstat (limited to 'erts/preloaded/src/socket.erl')
-rw-r--r--erts/preloaded/src/socket.erl8
1 files changed, 5 insertions, 3 deletions
diff --git a/erts/preloaded/src/socket.erl b/erts/preloaded/src/socket.erl
index 64e0e6ce5b..3e31326759 100644
--- a/erts/preloaded/src/socket.erl
+++ b/erts/preloaded/src/socket.erl
@@ -602,7 +602,7 @@
%% -define(SOCKET_OPT_IPV6_TCLASS, 30).
%% -define(SOCKET_OPT_IPV6_UNICAST_HOPS, 31).
%% -define(SOCKET_OPT_IPV6_USE_MIN_MTU, 32).
-%% -define(SOCKET_OPT_IPV6_V6ONLY, 33).
+-define(SOCKET_OPT_IPV6_V6ONLY, 33).
-define(SOCKET_OPT_TCP_CONGESTION, 1).
-define(SOCKET_OPT_TCP_CORK, 2).
@@ -2105,6 +2105,8 @@ enc_setopt_value(ipv6, drop_membership, #{multiaddr := MA,
enc_setopt_value(ipv6, hoplimit, V, _D, T, _P)
when is_boolean(V) andalso ((T =:= dgram) orelse (T =:= raw)) ->
V;
+enc_setopt_value(ipv6, v6only, V, _D, _T, _P) when is_boolean(V) ->
+ V;
enc_setopt_value(ipv6 = L, Opt, V, _D, _T, _P) ->
not_supported({L, Opt, V});
@@ -2490,8 +2492,8 @@ enc_sockopt_key(ipv6 = L, unicast_hops = Opt, _Dir, _D, _T, _P) ->
not_supported({L, Opt});
enc_sockopt_key(ipv6 = L, use_min_mtu = Opt, _Dir, _D, _T, _P) ->
not_supported({L, Opt});
-enc_sockopt_key(ipv6 = L, v6only = Opt, _Dir, _D, _T, _P) ->
- not_supported({L, Opt});
+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});