aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2018-07-31 18:01:55 +0200
committerMicael Karlberg <[email protected]>2018-09-18 14:50:18 +0200
commit25c38eff5c1e8d4dc6325afa62031874e23262dc (patch)
tree699fb4b7d0bb2615398ee3f674e005a835066fd4 /lib
parentd4c6b555aea77198d662822c7f5a134a16cff8af (diff)
downloadotp-25c38eff5c1e8d4dc6325afa62031874e23262dc.tar.gz
otp-25c38eff5c1e8d4dc6325afa62031874e23262dc.tar.bz2
otp-25c38eff5c1e8d4dc6325afa62031874e23262dc.zip
[socket-nif] Add more control message decoding
Added decoding of the "known" control message options: pktinfo, recvtos, recvttl and recvorigdstaddr). OTP-14831
Diffstat (limited to 'lib')
-rw-r--r--lib/kernel/test/socket_server.erl18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/kernel/test/socket_server.erl b/lib/kernel/test/socket_server.erl
index 5d00f78b2a..a804078917 100644
--- a/lib/kernel/test/socket_server.erl
+++ b/lib/kernel/test/socket_server.erl
@@ -720,10 +720,18 @@ handler_init(Manager, ID, Msg, Peek, Sock) ->
RtHdr, AuthHdr, HopLimit, HopOpts, DstOpts, FlowInfo,
UHops]),
- ok = soip(Sock, pktinfo, true),
+ SIP =
+ fun(O, V) ->
+ if
+ (Type =:= dgram) ->
+ ok = soip(Sock, O, V);
+ true ->
+ ok
+ end
+ end,
ok = soip(Sock, recvtos, true),
- ok = soip(Sock, recvttl, true),
- %% ok = soip(Sock, recvopts, true),
+ SIP(recvttl, true),
+ ok = soip(Sock, recvorigdstaddr, true),
handler_loop(#handler{msg = Msg,
peek = Peek,
@@ -786,13 +794,13 @@ recv(#handler{peek = true, socket = Sock, type = stream}) ->
recv(#handler{peek = false, socket = Sock, type = stream}) ->
do_recv(Sock);
recv(#handler{socket = Sock, msg = true, type = dgram}) ->
- ok = socket:setopt(Sock, otp, debug, true),
+ %% ok = socket:setopt(Sock, otp, debug, true),
case socket:recvmsg(Sock) of
{ok, #{addr := Source,
iov := [Data],
ctrl := CMsgHdrs,
flags := Flags}} ->
- ok = socket:setopt(Sock, otp, debug, false),
+ %% ok = socket:setopt(Sock, otp, debug, false),
i("received message: "
"~n CMsgHdrs: ~p"
"~n Flags: ~p", [CMsgHdrs, Flags]),