diff options
author | Micael Karlberg <[email protected]> | 2018-07-24 12:29:22 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2018-09-18 14:50:18 +0200 |
commit | b598160c2f1162658ea948284aee5b53951a3b9e (patch) | |
tree | 4d1f65fd76f3e2ef62cc7d57906544d1bdd7bd87 /erts/preloaded/src | |
parent | e54642b537177941ff361b1eebdec10e02cfc22d (diff) | |
download | otp-b598160c2f1162658ea948284aee5b53951a3b9e.tar.gz otp-b598160c2f1162658ea948284aee5b53951a3b9e.tar.bz2 otp-b598160c2f1162658ea948284aee5b53951a3b9e.zip |
[socket-nif] Add support for socket (level ipv6) option unicast_hops
Added support for the IPv6 socket option UNICAST_HOPS.
OTP-14831.
Diffstat (limited to 'erts/preloaded/src')
-rw-r--r-- | erts/preloaded/src/socket.erl | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/erts/preloaded/src/socket.erl b/erts/preloaded/src/socket.erl index 95bd5ce094..3bc3c7dc28 100644 --- a/erts/preloaded/src/socket.erl +++ b/erts/preloaded/src/socket.erl @@ -659,7 +659,7 @@ %% -define(SOCKET_OPT_IPV6_ROUTER_ALERT, 27). -define(SOCKET_OPT_IPV6_RTHDR, 28). %% -define(SOCKET_OPT_IPV6_TCLASS, 29). -%% -define(SOCKET_OPT_IPV6_UNICAST_HOPS, 30). +-define(SOCKET_OPT_IPV6_UNICAST_HOPS, 30). %% -define(SOCKET_OPT_IPV6_USE_MIN_MTU, 31). -define(SOCKET_OPT_IPV6_V6ONLY, 32). @@ -2300,6 +2300,12 @@ enc_setopt_value(ipv6, Opt, V, _D, _T, _P) enc_setopt_value(ipv6, rthdr, V, _D, T, _P) when is_boolean(V) andalso ((T =:= dgram) orelse (T =:= raw)) -> V; +enc_setopt_value(ipv6, unicast_hops, V, _D, _T, _P) + when (V =:= default) -> + -1; +enc_setopt_value(ipv6, unicast_hops, V, _D, _T, _P) + when is_integer(V) andalso (V >= 0) andalso (V =< 255) -> + 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) -> @@ -2750,8 +2756,8 @@ enc_sockopt_key(ipv6 = _L, rthdr = _Opt, _Dir, _D, T, _P) ?SOCKET_OPT_IPV6_RTHDR; enc_sockopt_key(ipv6 = L, tclass = Opt, _Dir, _D, _T, _P) -> not_supported({L, Opt}); -enc_sockopt_key(ipv6 = L, unicast_hops = Opt, _Dir, _D, _T, _P) -> - not_supported({L, Opt}); +enc_sockopt_key(ipv6 = _L, unicast_hops = _Opt, _Dir, _D, _T, _P) -> + ?SOCKET_OPT_IPV6_UNICAST_HOPS; 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) -> |