diff options
author | Micael Karlberg <[email protected]> | 2018-07-11 18:20:06 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2018-09-18 14:50:18 +0200 |
commit | e5a5cb1025270c265baeda89dd4cd13a1417a262 (patch) | |
tree | 59039c851ec3d18b4e286eafdb16b9be92114d41 /lib/kernel/test | |
parent | 4d29dde851fb30d86c194961f93e148198ae456d (diff) | |
download | otp-e5a5cb1025270c265baeda89dd4cd13a1417a262.tar.gz otp-e5a5cb1025270c265baeda89dd4cd13a1417a262.tar.bz2 otp-e5a5cb1025270c265baeda89dd4cd13a1417a262.zip |
[socket-nif] Add support for socket (level ip) option mtu
Added support for the IP option MTU.
OTP-14831
Diffstat (limited to 'lib/kernel/test')
-rw-r--r-- | lib/kernel/test/socket_client.erl | 4 | ||||
-rw-r--r-- | lib/kernel/test/socket_server.erl | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/kernel/test/socket_client.erl b/lib/kernel/test/socket_client.erl index 23d3c9956e..dce50682ab 100644 --- a/lib/kernel/test/socket_client.erl +++ b/lib/kernel/test/socket_client.erl @@ -80,6 +80,7 @@ do_start(Domain, stream = Type, Proto, SA) -> {ok, SndBuf} = socket:getopt(Sock, socket, sndbuf), {ok, RcvBuf} = socket:getopt(Sock, socket, rcvbuf), {ok, Linger} = socket:getopt(Sock, socket, linger), + {ok, MTU} = socket:getopt(Sock, ip, mtu), {ok, MIF} = socket:getopt(Sock, ip, multicast_if), {ok, MLoop} = socket:getopt(Sock, ip, multicast_loop), {ok, MTTL} = socket:getopt(Sock, ip, multicast_ttl), @@ -94,13 +95,14 @@ do_start(Domain, stream = Type, Proto, SA) -> "~n (socket) SndBuf: ~p" "~n (socket) RcvBuf: ~p" "~n (socket) Linger: ~p" + "~n (ip) MTU: ~p" "~n (ip) Multicast IF: ~p" "~n (ip) Multicast Loop: ~p" "~n (ip) Multicast TTL: ~p" "~n => wait some", [Name, Peer, Domain, Type, Proto, - OOBI, SndBuf, RcvBuf, Linger, MIF, MLoop, MTTL]), + OOBI, SndBuf, RcvBuf, Linger, MTU, MIF, MLoop, MTTL]), %% Give the server some time... ?LIB:sleep(5000), %% ok = socket:close(Sock), diff --git a/lib/kernel/test/socket_server.erl b/lib/kernel/test/socket_server.erl index 5fd32e040c..f77c91996f 100644 --- a/lib/kernel/test/socket_server.erl +++ b/lib/kernel/test/socket_server.erl @@ -442,6 +442,12 @@ handler_init(Manager, ID, Peek, Sock) -> {ok, SndBuf} = socket:getopt(Sock, socket, sndbuf), {ok, RcvBuf} = socket:getopt(Sock, socket, rcvbuf), {ok, Linger} = socket:getopt(Sock, socket, linger), + MTU = case socket:getopt(Sock, ip, mtu) of + {ok, Val} -> + f("~w", [Val]); + {error, _} -> + "-" % We don't connect UDP (it can be done but we don't) + end, {ok, MIF} = socket:getopt(Sock, ip, multicast_if), {ok, MLoop} = socket:getopt(Sock, ip, multicast_loop), {ok, MTTL} = socket:getopt(Sock, ip, multicast_ttl), @@ -453,11 +459,12 @@ handler_init(Manager, ID, Peek, Sock) -> "~n (socket) SndBuf: ~p" "~n (socket) RcvBuf: ~p" "~n (socket) Linger: ~p" + "~n (ip) MTU: ~s" "~n (ip) Multicast IF: ~p" "~n (ip) Multicast Loop: ~p" "~n (ip) Multicast TTL: ~p", [Domain, Type, Proto, - OOBI, SndBuf, RcvBuf, Linger, MIF, MLoop, MTTL]), + OOBI, SndBuf, RcvBuf, Linger, MTU, MIF, MLoop, MTTL]), %% socket:setopt(Sock, otp, debug, true), handler_loop(#handler{peek = Peek, manager = Manager, |