diff options
Diffstat (limited to 'erts/emulator/nifs')
-rw-r--r-- | erts/emulator/nifs/common/socket_nif.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/erts/emulator/nifs/common/socket_nif.c b/erts/emulator/nifs/common/socket_nif.c index ae14e6b4ab..19b40920d3 100644 --- a/erts/emulator/nifs/common/socket_nif.c +++ b/erts/emulator/nifs/common/socket_nif.c @@ -520,6 +520,7 @@ typedef union { #define SOCKET_OPT_IP_DROP_MEMBERSHIP 5 #define SOCKET_OPT_IP_DROP_SOURCE_MEMBERSHIP 6 #define SOCKET_OPT_IP_FREEBIND 7 +#define SOCKET_OPT_IP_HDRINCL 8 #define SOCKET_OPT_IP_MINTTL 9 #define SOCKET_OPT_IP_MSFILTER 10 #define SOCKET_OPT_IP_MTU 11 @@ -1110,6 +1111,11 @@ static ERL_NIF_TERM nsetopt_lvl_ip_freebind(ErlNifEnv* env, SocketDescriptor* descP, ERL_NIF_TERM eVal); #endif +#if defined(IP_HDRINCL) +static ERL_NIF_TERM nsetopt_lvl_ip_hdrincl(ErlNifEnv* env, + SocketDescriptor* descP, + ERL_NIF_TERM eVal); +#endif #if defined(IP_MINTTL) static ERL_NIF_TERM nsetopt_lvl_ip_minttl(ErlNifEnv* env, SocketDescriptor* descP, @@ -1528,6 +1534,10 @@ static ERL_NIF_TERM ngetopt_lvl_ip(ErlNifEnv* env, static ERL_NIF_TERM ngetopt_lvl_ip_freebind(ErlNifEnv* env, SocketDescriptor* descP); #endif +#if defined(IP_HDRINCL) +static ERL_NIF_TERM ngetopt_lvl_ip_hdrincl(ErlNifEnv* env, + SocketDescriptor* descP); +#endif #if defined(IP_MINTTL) static ERL_NIF_TERM ngetopt_lvl_ip_minttl(ErlNifEnv* env, SocketDescriptor* descP); @@ -4951,6 +4961,12 @@ ERL_NIF_TERM nsetopt_lvl_ip(ErlNifEnv* env, break; #endif +#if defined(IP_HDRINCL) + case SOCKET_OPT_IP_HDRINCL: + result = nsetopt_lvl_ip_hdrincl(env, descP, eVal); + break; +#endif + #if defined(IP_MINTTL) case SOCKET_OPT_IP_MINTTL: result = nsetopt_lvl_ip_minttl(env, descP, eVal); @@ -5187,6 +5203,26 @@ ERL_NIF_TERM nsetopt_lvl_ip_freebind(ErlNifEnv* env, +/* nsetopt_lvl_ip_hdrincl - Level IP HDRINCL option + */ +#if defined(IP_HDRINCL) +static +ERL_NIF_TERM nsetopt_lvl_ip_hdrincl(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_HDRINCL, eVal); +} +#endif + + + /* nsetopt_lvl_ip_minttl - Level IP MINTTL option */ #if defined(IP_MINTTL) @@ -8086,6 +8122,12 @@ ERL_NIF_TERM ngetopt_lvl_ip(ErlNifEnv* env, break; #endif +#if defined(IP_HDRINCL) + case SOCKET_OPT_IP_HDRINCL: + result = ngetopt_lvl_ip_hdrincl(env, descP); + break; +#endif + #if defined(IP_MINTTL) case SOCKET_OPT_IP_MINTTL: result = ngetopt_lvl_ip_minttl(env, descP); @@ -8233,6 +8275,24 @@ ERL_NIF_TERM ngetopt_lvl_ip_freebind(ErlNifEnv* env, #endif +/* ngetopt_lvl_ip_hdrincl - Level IP HDRINCL option + */ +#if defined(IP_HDRINCL) +static +ERL_NIF_TERM ngetopt_lvl_ip_hdrincl(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_HDRINCL); +} +#endif + + /* ngetopt_lvl_ip_mtu - Level IP MTU option */ #if defined(IP_MTU) |