aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2018-07-12 17:00:34 +0200
committerMicael Karlberg <[email protected]>2018-09-18 14:50:18 +0200
commit31ed3b1d9cff6171432459bf2de2b761e987ac97 (patch)
tree0c666cdac856e05f84977f00a427a144f75f70d1 /erts/preloaded
parent3d045788e8033e2e76396900358976ac92fb184a (diff)
downloadotp-31ed3b1d9cff6171432459bf2de2b761e987ac97.tar.gz
otp-31ed3b1d9cff6171432459bf2de2b761e987ac97.tar.bz2
otp-31ed3b1d9cff6171432459bf2de2b761e987ac97.zip
[socket-nif] Add support for socket (level ip) open recvif
Added support for the IP option RECVIF. OTP-14831
Diffstat (limited to 'erts/preloaded')
-rw-r--r--erts/preloaded/ebin/socket.beambin45672 -> 45720 bytes
-rw-r--r--erts/preloaded/src/socket.erl10
2 files changed, 7 insertions, 3 deletions
diff --git a/erts/preloaded/ebin/socket.beam b/erts/preloaded/ebin/socket.beam
index 4502ff6530..57a32cfbad 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 7efe91146b..f70c45b42e 100644
--- a/erts/preloaded/src/socket.erl
+++ b/erts/preloaded/src/socket.erl
@@ -543,7 +543,7 @@
%% -define(SOCKET_OPT_IP_OPTIONS, 18).
%% -define(SOCKET_OPT_IP_PKTINFO, 19).
%% -define(SOCKET_OPT_IP_RECVERR, 20).
-%% -define(SOCKET_OPT_IP_RECVIF, 21).
+-define(SOCKET_OPT_IP_RECVIF, 21).
%% -define(SOCKET_OPT_IP_RECVDSTADDR, 22).
%% -define(SOCKET_OPT_IP_RECVOPTS, 23).
%% -define(SOCKET_OPT_IP_RECVORIGDSTADDR, 24).
@@ -2036,6 +2036,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, recvif, V, _D, _T, _P)
+ when is_boolean(V) ->
+ V;
enc_setopt_value(ip, recvtos, V, _D, _T, _P)
when is_boolean(V) ->
V;
@@ -2352,8 +2355,9 @@ enc_sockopt_key(ip = L, pktinfo = Opt, _Dir, _D, _T, _P) ->
%% 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, recvif = Opt, _Dir, _D, dgram = _T, _P) ->
- not_supported({L, Opt});
+enc_sockopt_key(ip = _L, recvif = _Opt, _Dir, _D, T, _P)
+ when (T =:= dgram) orelse (T =:= raw) ->
+ ?SOCKET_OPT_IP_RECVIF;
enc_sockopt_key(ip = L, recvdstaddr = Opt, _Dir, _D, _T, _P) ->
not_supported({L, Opt});
enc_sockopt_key(ip = L, recvopts = Opt, _Dir, _D, T, _P) when (T =/= stream) ->