diff options
author | Micael Karlberg <[email protected]> | 2018-07-24 10:25:25 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2018-09-18 14:50:18 +0200 |
commit | d7ca5ba9d8a7f094037878acfecb52b0bfbacc2e (patch) | |
tree | 4c2d864c0d276329c6402c91eaa8eb12f780ec4a /erts/preloaded/src | |
parent | de82310c32063b8556add3fe7cf62b26eef27841 (diff) | |
download | otp-d7ca5ba9d8a7f094037878acfecb52b0bfbacc2e.tar.gz otp-d7ca5ba9d8a7f094037878acfecb52b0bfbacc2e.tar.bz2 otp-d7ca5ba9d8a7f094037878acfecb52b0bfbacc2e.zip |
[socket-nif] Add support for socket (level ipv6) option rthdr
Added support for the IPv6 socket option RTHDR.
On FreeBSD this option requires superuser privileges to update.
There is no mention of this on linux, but its still not possible
to update (einval), so I assume that its the same there.
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 7e9b61ba8f..d2267192e5 100644 --- a/erts/preloaded/src/socket.erl +++ b/erts/preloaded/src/socket.erl @@ -657,7 +657,7 @@ -define(SOCKET_OPT_IPV6_RECVPKTINFO, 25). % On FreeBSD: PKTINFO %% -define(SOCKET_OPT_IPV6_RECVTCLASS, 26). %% -define(SOCKET_OPT_IPV6_ROUTER_ALERT, 27). -%% -define(SOCKET_OPT_IPV6_RTHDR, 28). +-define(SOCKET_OPT_IPV6_RTHDR, 28). %% -define(SOCKET_OPT_IPV6_TCLASS, 29). %% -define(SOCKET_OPT_IPV6_UNICAST_HOPS, 30). %% -define(SOCKET_OPT_IPV6_USE_MIN_MTU, 31). @@ -2282,6 +2282,9 @@ enc_setopt_value(ipv6, Opt, V, _D, _T, _P) when ((Opt =:= recvpktinfo) orelse (Opt =:= pktinfo)) andalso is_boolean(V) -> V; +enc_setopt_value(ipv6, rthdr, V, _D, _T, _P) + when is_boolean(V) -> + 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) -> @@ -2727,9 +2730,9 @@ enc_sockopt_key(ipv6 = L, recvtclass = Opt, _Dir, _D, _T, _P) -> not_supported({L, Opt}); enc_sockopt_key(ipv6 = L, router_alert = Opt, _Dir, _D, _T, _P) -> not_supported({L, Opt}); -enc_sockopt_key(ipv6 = L, rthdr = Opt, set = _Dir, _D, T, _P) +enc_sockopt_key(ipv6 = _L, rthdr = _Opt, _Dir, _D, T, _P) when ((T =:= dgram) orelse (T =:= raw)) -> - not_supported({L, Opt}); + ?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) -> @@ -2739,7 +2742,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}); + unknown({L, UnknownOpt, _Dir, _D, _T, _P}); %% TCP socket options %% There are other options that would be useful; info, |