aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2018-07-26 11:07:05 +0200
committerMicael Karlberg <[email protected]>2018-09-18 14:50:18 +0200
commit6b01561dc13a0152f56da0a2c61ad88236f87de7 (patch)
tree83541c84c02ddb1b3ab978a351e688401de1d535 /erts/preloaded
parent8ed757c8df2df54e19e67ca0a0734cd5a0f9ab23 (diff)
downloadotp-6b01561dc13a0152f56da0a2c61ad88236f87de7.tar.gz
otp-6b01561dc13a0152f56da0a2c61ad88236f87de7.tar.bz2
otp-6b01561dc13a0152f56da0a2c61ad88236f87de7.zip
[socket-nif] Add support for socket (level ip) option sendsrcaddr
Added support for ip level socket option SENDSRCADDR. This option requires sendmsg to actually use, so we cannot test this fully at the moment. OTP-14831
Diffstat (limited to 'erts/preloaded')
-rw-r--r--erts/preloaded/ebin/socket.beambin59660 -> 59768 bytes
-rw-r--r--erts/preloaded/src/socket.erl9
2 files changed, 7 insertions, 2 deletions
diff --git a/erts/preloaded/ebin/socket.beam b/erts/preloaded/ebin/socket.beam
index 90cb657178..b2bd8f2728 100644
--- a/erts/preloaded/ebin/socket.beam
+++ b/erts/preloaded/ebin/socket.beam
Binary files differ
diff --git a/erts/preloaded/src/socket.erl b/erts/preloaded/src/socket.erl
index 68b7d3f4b0..1983c993a5 100644
--- a/erts/preloaded/src/socket.erl
+++ b/erts/preloaded/src/socket.erl
@@ -638,11 +638,11 @@
-define(SOCKET_OPT_IP_RECVTTL, 26).
-define(SOCKET_OPT_IP_RETOPTS, 27).
-define(SOCKET_OPT_IP_ROUTER_ALERT, 28).
-%% -define(SOCKET_OPT_IP_SNDSRCADDR, 29).
+-define(SOCKET_OPT_IP_SENDSRCADDR, 29). % FreeBSD
-define(SOCKET_OPT_IP_TOS, 30).
-define(SOCKET_OPT_IP_TRANSPARENT, 31).
-define(SOCKET_OPT_IP_TTL, 32).
--define(SOCKET_OPT_IP_UNBLOCK_SOURCE, 33).
+-define(SOCKET_OPT_IP_UNBLOCK_SOURCE, 33).
-define(SOCKET_OPT_IPV6_ADDRFORM, 1).
-define(SOCKET_OPT_IPV6_ADD_MEMBERSHIP, 2).
@@ -2316,6 +2316,9 @@ enc_setopt_value(ip, retopts, V, _D, _T, _P)
enc_setopt_value(ip, router_alert, V, _D, _T, _P)
when is_integer(V) ->
V;
+enc_setopt_value(ip, sendsrcaddr, V, _D, _T, _P)
+ when is_boolean(V) ->
+ V;
enc_setopt_value(ip, tos, V, _D, _T, _P)
when (V =:= lowdelay) orelse
(V =:= throughput) orelse
@@ -2776,6 +2779,8 @@ enc_sockopt_key(ip = _L, retopts = _Opt, _Dir, _D, T, _P) when (T =/= stream) ->
?SOCKET_OPT_IP_RETOPTS;
enc_sockopt_key(ip, router_alert = _Opt, _Dir, _D, raw = _T, _P) ->
?SOCKET_OPT_IP_ROUTER_ALERT;
+enc_sockopt_key(ip, sendsrcaddr = _Opt, _Dir, _D, _T, _P) ->
+ ?SOCKET_OPT_IP_SENDSRCADDR;
%% On FreeBSD it specifies that this option is only valid
%% for stream, dgram and "some" raw sockets...
%% No such condition on linux (in the man page)...