diff options
author | Micael Karlberg <[email protected]> | 2018-07-24 16:40:55 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2018-09-18 14:50:18 +0200 |
commit | 00a2425bde77ddb9ae4c03b8c4e5470064773981 (patch) | |
tree | fe118b4be3b1ea5c2f61e9e1ad3cb7cc46fea276 /erts/preloaded | |
parent | b9237c96b2b86c82bb128625cc532b3528222560 (diff) | |
download | otp-00a2425bde77ddb9ae4c03b8c4e5470064773981.tar.gz otp-00a2425bde77ddb9ae4c03b8c4e5470064773981.tar.bz2 otp-00a2425bde77ddb9ae4c03b8c4e5470064773981.zip |
[socket-nif] Add support for socket (level ip) option recverr
Added support for the IP socket option RECVERR.
To actually make use of this option, we need the recvmsg
function, which we don't have yet. Baby steps.
OTP-14831.
Diffstat (limited to 'erts/preloaded')
-rw-r--r-- | erts/preloaded/ebin/socket.beam | bin | 58020 -> 58076 bytes | |||
-rw-r--r-- | erts/preloaded/src/socket.erl | 33 |
2 files changed, 18 insertions, 15 deletions
diff --git a/erts/preloaded/ebin/socket.beam b/erts/preloaded/ebin/socket.beam Binary files differindex 20f2cf659b..e2b988f8a6 100644 --- a/erts/preloaded/ebin/socket.beam +++ b/erts/preloaded/ebin/socket.beam diff --git a/erts/preloaded/src/socket.erl b/erts/preloaded/src/socket.erl index 0c3a17b54d..0a101008c6 100644 --- a/erts/preloaded/src/socket.erl +++ b/erts/preloaded/src/socket.erl @@ -620,7 +620,7 @@ -define(SOCKET_OPT_IP_NODEFRAG, 17). %% -define(SOCKET_OPT_IP_OPTIONS, 18). %% -define(SOCKET_OPT_IP_PKTINFO, 19). -%% -define(SOCKET_OPT_IP_RECVERR, 20). +-define(SOCKET_OPT_IP_RECVERR, 20). -define(SOCKET_OPT_IP_RECVIF, 21). %% -define(SOCKET_OPT_IP_RECVDSTADDR, 22). -define(SOCKET_OPT_IP_RECVOPTS, 23). @@ -638,34 +638,34 @@ -define(SOCKET_OPT_IPV6_ADDRFORM, 1). -define(SOCKET_OPT_IPV6_ADD_MEMBERSHIP, 2). -define(SOCKET_OPT_IPV6_AUTHHDR, 3). % Obsolete? -%% -define(SOCKET_OPT_IPV6_AUTH_LEVEL, 4). -%% -define(SOCKET_OPT_IPV6_CHECKSUM, 5). +%% -define(SOCKET_OPT_IPV6_AUTH_LEVEL, 4). % FreeBSD +%% -define(SOCKET_OPT_IPV6_CHECKSUM, 5). % FreeBSD -define(SOCKET_OPT_IPV6_DROP_MEMBERSHIP, 6). -define(SOCKET_OPT_IPV6_DSTOPTS, 7). -%% -define(SOCKET_OPT_IPV6_ESP_TRANS_LEVEL, 8). -%% -define(SOCKET_OPT_IPV6_ESP_NETWORK_LEVEL, 9). -%% -define(SOCKET_OPT_IPV6_FAITH, 10). +%% -define(SOCKET_OPT_IPV6_ESP_TRANS_LEVEL, 8). % FreeBSD +%% -define(SOCKET_OPT_IPV6_ESP_NETWORK_LEVEL, 9). % FreeBSD +%% -define(SOCKET_OPT_IPV6_FAITH, 10). % FreeBSD -define(SOCKET_OPT_IPV6_FLOWINFO, 11). -define(SOCKET_OPT_IPV6_HOPLIMIT, 12). -define(SOCKET_OPT_IPV6_HOPOPTS, 13). -%% -define(SOCKET_OPT_IPV6_IPCOMP_LEVEL, 14). -%% -define(SOCKET_OPT_IPV6_JOIN_GROUP, 15). -%% -define(SOCKET_OPT_IPV6_LEAVE_GROUP, 16). +%% -define(SOCKET_OPT_IPV6_IPCOMP_LEVEL, 14). % FreeBSD +%% -define(SOCKET_OPT_IPV6_JOIN_GROUP, 15). % FreeBSD +%% -define(SOCKET_OPT_IPV6_LEAVE_GROUP, 16). % FreeBSD -define(SOCKET_OPT_IPV6_MTU, 17). -define(SOCKET_OPT_IPV6_MTU_DISCOVER, 18). -define(SOCKET_OPT_IPV6_MULTICAST_HOPS, 19). -define(SOCKET_OPT_IPV6_MULTICAST_IF, 20). -define(SOCKET_OPT_IPV6_MULTICAST_LOOP, 21). -%% -define(SOCKET_OPT_IPV6_PORTRANGE, 22). -%% -define(SOCKET_OPT_IPV6_PKTOPTIONS, 23). +%% -define(SOCKET_OPT_IPV6_PORTRANGE, 22). % FreeBSD +%% -define(SOCKET_OPT_IPV6_PKTOPTIONS, 23). % FreeBSD %% -define(SOCKET_OPT_IPV6_RECVERR, 24). -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_TCLASS, 29). +%% -define(SOCKET_OPT_IPV6_TCLASS, 29). % FreeBSD -define(SOCKET_OPT_IPV6_UNICAST_HOPS, 30). -%% -define(SOCKET_OPT_IPV6_USE_MIN_MTU, 31). +%% -define(SOCKET_OPT_IPV6_USE_MIN_MTU, 31). % FreeBSD -define(SOCKET_OPT_IPV6_V6ONLY, 32). -define(SOCKET_OPT_TCP_CONGESTION, 1). @@ -2219,6 +2219,9 @@ enc_setopt_value(ip, multicast_ttl, V, _D, _T, _P) enc_setopt_value(ip, nodefrag, V, _D, _T, _P) when is_boolean(V) -> V; +enc_setopt_value(ip, recverr, V, _D, _T, _P) + when is_boolean(V) -> + V; enc_setopt_value(ip, recvif, V, _D, _T, _P) when is_boolean(V) -> V; @@ -2672,8 +2675,8 @@ enc_sockopt_key(ip = L, pktinfo = Opt, _Dir, _D, _T, _P) -> not_supported({L, Opt}); %% This require special code for accessing the errors. %% via calling the recvmsg with the MSG_ERRQUEUE flag set, -enc_sockopt_key(ip = L, recverr = Opt, _Dir, _D, _T, _P) -> - not_supported({L, Opt}); +enc_sockopt_key(ip = _L, recverr = _Opt, _Dir, _D, _T, _P) -> + ?SOCKET_OPT_IP_RECVERR; enc_sockopt_key(ip = _L, recvif = _Opt, _Dir, _D, T, _P) when (T =:= dgram) orelse (T =:= raw) -> ?SOCKET_OPT_IP_RECVIF; |