From ea680e88b967440b2ecd925321ebb5dd48461608 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 12 Jul 2018 10:42:19 +0200 Subject: [socket-nif] Add support for socket (level ip) option multicast_all Added support for the IP option MULTICAST_ALL. OTP-14831 --- erts/preloaded/src/socket.erl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'erts/preloaded/src/socket.erl') diff --git a/erts/preloaded/src/socket.erl b/erts/preloaded/src/socket.erl index 5338f0d988..643f59467b 100644 --- a/erts/preloaded/src/socket.erl +++ b/erts/preloaded/src/socket.erl @@ -527,7 +527,7 @@ %% -define(SOCKET_OPT_IP_MSFILTER, 10). -define(SOCKET_OPT_IP_MTU, 11). -define(SOCKET_OPT_IP_MTU_DISCOVER, 12). -%% -define(SOCKET_OPT_IP_MULTICAST_ALL, 13). +-define(SOCKET_OPT_IP_MULTICAST_ALL, 13). -define(SOCKET_OPT_IP_MULTICAST_IF, 14). -define(SOCKET_OPT_IP_MULTICAST_LOOP, 15). -define(SOCKET_OPT_IP_MULTICAST_TTL, 16). @@ -1992,6 +1992,9 @@ enc_setopt_value(ip, mtu_discover, V, _D, _T, _P) (V =:= probe) orelse is_integer(V) -> V; +enc_setopt_value(ip, multicast_all, V, _D, _T, _P) + when is_boolean(V) -> + V; enc_setopt_value(ip, multicast_if, V, _D, _T, _P) when (V =:= any) orelse (is_tuple(V) andalso (size(V) =:= 4)) -> V; @@ -2289,8 +2292,8 @@ enc_sockopt_key(ip = _L, mtu = _Opt, get = _Dir, _D, _T, _P) -> ?SOCKET_OPT_IP_MTU; enc_sockopt_key(ip = _L, mtu_discover = _Opt, _Dir, _D, _T, _P) -> ?SOCKET_OPT_IP_MTU_DISCOVER; -enc_sockopt_key(ip = L, multicast_all = Opt, _Dir, _D, _T, _P) -> - not_supported({L, Opt}); +enc_sockopt_key(ip = _L, multicast_all = _Opt, _Dir, _D, _T, _P) -> + ?SOCKET_OPT_IP_MULTICAST_ALL; enc_sockopt_key(ip = _L, multicast_if = _Opt, _Dir, _D, _T, _P) -> ?SOCKET_OPT_IP_MULTICAST_IF; enc_sockopt_key(ip = _L, multicast_loop = _Opt, _Dir, _D, _T, _P) -> -- cgit v1.2.3