aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2018-07-12 10:42:19 +0200
committerMicael Karlberg <[email protected]>2018-09-18 14:50:18 +0200
commitea680e88b967440b2ecd925321ebb5dd48461608 (patch)
tree9524817c1314103536dbcb6910e294602986433f /erts/emulator
parente0f27afac1cb3e3a5567a05081d0cf307c154b0d (diff)
downloadotp-ea680e88b967440b2ecd925321ebb5dd48461608.tar.gz
otp-ea680e88b967440b2ecd925321ebb5dd48461608.tar.bz2
otp-ea680e88b967440b2ecd925321ebb5dd48461608.zip
[socket-nif] Add support for socket (level ip) option multicast_all
Added support for the IP option MULTICAST_ALL. OTP-14831
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/nifs/common/socket_nif.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/erts/emulator/nifs/common/socket_nif.c b/erts/emulator/nifs/common/socket_nif.c
index 65e530adee..a2bebcd621 100644
--- a/erts/emulator/nifs/common/socket_nif.c
+++ b/erts/emulator/nifs/common/socket_nif.c
@@ -366,6 +366,7 @@ typedef union {
#define SOCKET_OPT_IP_DROP_MEMBERSHIP 5
#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_IF 14
#define SOCKET_OPT_IP_MULTICAST_LOOP 15
#define SOCKET_OPT_IP_MULTICAST_TTL 16
@@ -872,6 +873,11 @@ static ERL_NIF_TERM nsetopt_lvl_ip_mtu_discover(ErlNifEnv* env,
SocketDescriptor* descP,
ERL_NIF_TERM eVal);
#endif
+#if defined(IP_MULTICAST_ALL)
+static ERL_NIF_TERM nsetopt_lvl_ip_multicast_all(ErlNifEnv* env,
+ SocketDescriptor* descP,
+ ERL_NIF_TERM eVal);
+#endif
#if defined(IP_MULTICAST_IF)
static ERL_NIF_TERM nsetopt_lvl_ip_multicast_if(ErlNifEnv* env,
SocketDescriptor* descP,
@@ -1063,6 +1069,10 @@ static ERL_NIF_TERM ngetopt_lvl_ip_mtu(ErlNifEnv* env,
static ERL_NIF_TERM ngetopt_lvl_ip_mtu_discover(ErlNifEnv* env,
SocketDescriptor* descP);
#endif
+#if defined(IP_MULTICAST_ALL)
+static ERL_NIF_TERM ngetopt_lvl_ip_multicast_all(ErlNifEnv* env,
+ SocketDescriptor* descP);
+#endif
#if defined(IP_MULTICAST_IF)
static ERL_NIF_TERM ngetopt_lvl_ip_multicast_if(ErlNifEnv* env,
SocketDescriptor* descP);
@@ -4232,6 +4242,25 @@ ERL_NIF_TERM nsetopt_lvl_ip_mtu_discover(ErlNifEnv* env,
#endif
+/* nsetopt_lvl_ip_multicast_all - Level IP MULTICAST_ALL option
+ */
+#if defined(IP_MULTICAST_ALL)
+static
+ERL_NIF_TERM nsetopt_lvl_ip_multicast_all(ErlNifEnv* env,
+ SocketDescriptor* descP,
+ ERL_NIF_TERM eVal)
+{
+#if defined(SOL_IP)
+ int level = SOL_IP;
+#else
+ int level = IPPROTO_IP;
+#endif
+
+ return nsetopt_bool_opt(env, descP, level, IP_MULTICAST_ALL, eVal);
+}
+#endif
+
+
/* nsetopt_lvl_ip_multicast_if - Level IP MULTICAST_IF option
*
* The value is either the atom 'any' or a 4-tuple.
@@ -5550,6 +5579,12 @@ ERL_NIF_TERM ngetopt_lvl_ip(ErlNifEnv* env,
break;
#endif
+#if defined(IP_MULTICAST_ALL)
+ case SOCKET_OPT_IP_MULTICAST_ALL:
+ result = ngetopt_lvl_ip_multicast_all(env, descP);
+ break;
+#endif
+
#if defined(IP_MULTICAST_IF)
case SOCKET_OPT_IP_MULTICAST_IF:
result = ngetopt_lvl_ip_multicast_if(env, descP);
@@ -5653,6 +5688,24 @@ ERL_NIF_TERM ngetopt_lvl_ip_mtu_discover(ErlNifEnv* env,
#endif
+/* ngetopt_lvl_ip_multicast_all - Level IP MULTICAST_ALL option
+ */
+#if defined(IP_MULTICAST_ALL)
+static
+ERL_NIF_TERM ngetopt_lvl_ip_multicast_all(ErlNifEnv* env,
+ SocketDescriptor* descP)
+{
+#if defined(SOL_IP)
+ int level = SOL_IP;
+#else
+ int level = IPPROTO_IP;
+#endif
+
+ return ngetopt_bool_opt(env, descP, level, IP_MULTICAST_ALL);
+}
+#endif
+
+
/* ngetopt_lvl_ip_multicast_if - Level IP MULTICAST_IF option
*/
#if defined(IP_MULTICAST_IF)