diff options
author | Micael Karlberg <[email protected]> | 2018-07-12 11:22:53 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2018-09-18 14:50:18 +0200 |
commit | ca81f1d1602cf994fca9fcd61e892c76e4e2742c (patch) | |
tree | 0c13550d6ac34dec6bc0604f88c2ecc2863ba507 /lib/kernel/test | |
parent | 0122d2cafdb6f44c221796f1a6b2a5188dfb153d (diff) | |
download | otp-ca81f1d1602cf994fca9fcd61e892c76e4e2742c.tar.gz otp-ca81f1d1602cf994fca9fcd61e892c76e4e2742c.tar.bz2 otp-ca81f1d1602cf994fca9fcd61e892c76e4e2742c.zip |
[socket-nif] Add support for socket (level ip) option recvttl
Added support for the IP option RECVTTL.
OTP-14831
Diffstat (limited to 'lib/kernel/test')
-rw-r--r-- | lib/kernel/test/socket_client.erl | 34 | ||||
-rw-r--r-- | lib/kernel/test/socket_server.erl | 8 |
2 files changed, 27 insertions, 15 deletions
diff --git a/lib/kernel/test/socket_client.erl b/lib/kernel/test/socket_client.erl index fa905de954..8ec9a02374 100644 --- a/lib/kernel/test/socket_client.erl +++ b/lib/kernel/test/socket_client.erl @@ -86,6 +86,7 @@ do_start(Domain, stream = Type, Proto, SA) -> {ok, MIF} = socket:getopt(Sock, ip, multicast_if), {ok, MLoop} = socket:getopt(Sock, ip, multicast_loop), {ok, MTTL} = socket:getopt(Sock, ip, multicast_ttl), + {ok, RecvTOS} = socket:getopt(Sock, ip, recvtos), i("connected: " "~n From: ~p" "~n To: ~p" @@ -103,11 +104,13 @@ do_start(Domain, stream = Type, Proto, SA) -> "~n (ip) Multicast IF: ~p" "~n (ip) Multicast Loop: ~p" "~n (ip) Multicast TTL: ~p" + "~n (ip) RecvTOS: ~p" "~n => wait some", [Name, Peer, Domain, Type, Proto, OOBI, SndBuf, RcvBuf, Linger, - MTU, MTUDisc, MALL, MIF, MLoop, MTTL]), + MTU, MTUDisc, MALL, MIF, MLoop, MTTL, + RecvTOS]), %% Give the server some time... ?LIB:sleep(5000), %% ok = socket:close(Sock), @@ -122,17 +125,19 @@ do_start(Domain, dgram = Type, Proto, SA) -> try do_init(Domain, Type, Proto) of Sock -> %% Give the server some time... - {ok, Domain} = socket:getopt(Sock, socket, domain), - {ok, Type} = socket:getopt(Sock, socket, type), - {ok, Proto} = socket:getopt(Sock, socket, protocol), - {ok, OOBI} = socket:getopt(Sock, socket, oobinline), - {ok, SndBuf} = socket:getopt(Sock, socket, sndbuf), - {ok, RcvBuf} = socket:getopt(Sock, socket, rcvbuf), - {ok, Linger} = socket:getopt(Sock, socket, linger), - {ok, MALL} = socket:getopt(Sock, ip, multicast_all), - {ok, MIF} = socket:getopt(Sock, ip, multicast_if), - {ok, MLoop} = socket:getopt(Sock, ip, multicast_loop), - {ok, MTTL} = socket:getopt(Sock, ip, multicast_ttl), + {ok, Domain} = socket:getopt(Sock, socket, domain), + {ok, Type} = socket:getopt(Sock, socket, type), + {ok, Proto} = socket:getopt(Sock, socket, protocol), + {ok, OOBI} = socket:getopt(Sock, socket, oobinline), + {ok, SndBuf} = socket:getopt(Sock, socket, sndbuf), + {ok, RcvBuf} = socket:getopt(Sock, socket, rcvbuf), + {ok, Linger} = socket:getopt(Sock, socket, linger), + {ok, MALL} = socket:getopt(Sock, ip, multicast_all), + {ok, MIF} = socket:getopt(Sock, ip, multicast_if), + {ok, MLoop} = socket:getopt(Sock, ip, multicast_loop), + {ok, MTTL} = socket:getopt(Sock, ip, multicast_ttl), + {ok, RecvTOS} = socket:getopt(Sock, ip, recvtos), + {ok, RecvTTL} = socket:getopt(Sock, ip, recvttl), i("initiated when: " "~n (socket) Domain: ~p" "~n (socket) Type: ~p" @@ -145,10 +150,13 @@ do_start(Domain, dgram = Type, Proto, SA) -> "~n (ip) Multicast IF: ~p" "~n (ip) Multicast Loop: ~p" "~n (ip) Multicast TTL: ~p" + "~n (ip) RecvTOS: ~p" + "~n (ip) RecvTTL: ~p" "~n => wait some", [Domain, Type, Proto, OOBI, SndBuf, RcvBuf, Linger, - MALL, MIF, MLoop, MTTL]), + MALL, MIF, MLoop, MTTL, + RecvTOS, RecvTTL]), ?LIB:sleep(5000), %% ok = socket:close(Sock), send_loop(#client{socket = Sock, diff --git a/lib/kernel/test/socket_server.erl b/lib/kernel/test/socket_server.erl index 6a207a7b1b..ff8f6575a3 100644 --- a/lib/kernel/test/socket_server.erl +++ b/lib/kernel/test/socket_server.erl @@ -460,6 +460,8 @@ handler_init(Manager, ID, Peek, Sock) -> {ok, MLoop} = socket:getopt(Sock, ip, multicast_loop), {ok, MTTL} = socket:getopt(Sock, ip, multicast_ttl), NF = G(nodefrag), % raw only + RecvTOS = G(recvtos), + RecvTTL = G(recvttl), % not stream i("got continue when: " "~n (socket) Domain: ~p" "~n (socket) Type: ~p" @@ -474,11 +476,13 @@ handler_init(Manager, ID, Peek, Sock) -> "~n (ip) Multicast IF: ~p" "~n (ip) Multicast Loop: ~p" "~n (ip) Multicast TTL: ~p" - "~n (ip) NodeFrag: ~s", + "~n (ip) NodeFrag: ~s" + "~n (ip) RecvTOS: ~s" + "~n (ip) RecvTTL: ~s", [Domain, Type, Proto, OOBI, SndBuf, RcvBuf, Linger, MTU, MTUDisc, MALL, MIF, MLoop, MTTL, - NF]), + NF, RecvTOS, RecvTTL]), %% socket:setopt(Sock, otp, debug, true), handler_loop(#handler{peek = Peek, manager = Manager, |