diff options
author | Henrik Nord <[email protected]> | 2015-12-07 16:04:44 +0100 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2015-12-07 16:04:44 +0100 |
commit | 9be3ffd7bbb7fbf386fe7857b3ff9c9803e91cc7 (patch) | |
tree | 85218a522fb7eb4dc6cdbcf32d3f5aeab3ebdcbd /lib/ssl/test/ssl_basic_SUITE.erl | |
parent | 4e7d93de5f0aa04e6a9c67ee9a16e0f34987c846 (diff) | |
parent | 3dd86e73c17631a1e8c12ae4bed8bd320ae66082 (diff) | |
download | otp-9be3ffd7bbb7fbf386fe7857b3ff9c9803e91cc7.tar.gz otp-9be3ffd7bbb7fbf386fe7857b3ff9c9803e91cc7.tar.bz2 otp-9be3ffd7bbb7fbf386fe7857b3ff9c9803e91cc7.zip |
Merge branch 'rlipscombe/rl-ssl-options' into maint
* rlipscombe/rl-ssl-options:
Ensure single 'raw' option is handled correctly
Pass 'raw' options through
OTP-13166
Diffstat (limited to 'lib/ssl/test/ssl_basic_SUITE.erl')
-rw-r--r-- | lib/ssl/test/ssl_basic_SUITE.erl | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/ssl/test/ssl_basic_SUITE.erl b/lib/ssl/test/ssl_basic_SUITE.erl index f032c769e2..69972c44ed 100644 --- a/lib/ssl/test/ssl_basic_SUITE.erl +++ b/lib/ssl/test/ssl_basic_SUITE.erl @@ -95,6 +95,7 @@ options_tests() -> [der_input, misc_ssl_options, ssl_options_not_proplist, + raw_ssl_option, socket_options, invalid_inet_get_option, invalid_inet_get_option_not_list, @@ -330,6 +331,14 @@ init_per_testcase(clear_pem_cache, Config) -> ct:log("TLS/SSL version ~p~n ", [tls_record:supported_protocol_versions()]), ct:timetrap({seconds, 20}), Config; +init_per_testcase(raw_ssl_option, Config) -> + ct:timetrap({seconds, 5}), + case os:type() of + {unix,linux} -> + Config; + _ -> + {skip, "Raw options are platform-specific"} + end; init_per_testcase(_TestCase, Config) -> ct:log("TLS/SSL version ~p~n ", [tls_record:supported_protocol_versions()]), @@ -1155,6 +1164,23 @@ ssl_options_not_proplist(Config) when is_list(Config) -> BadOption]). %%-------------------------------------------------------------------- +raw_ssl_option() -> + [{doc,"Ensure that a single 'raw' option is passed to ssl:listen correctly."}]. + +raw_ssl_option(Config) when is_list(Config) -> + % 'raw' option values are platform-specific; these are the Linux values: + IpProtoTcp = 6, + % Use TCP_KEEPIDLE, because (e.g.) TCP_MAXSEG can't be read back reliably. + TcpKeepIdle = 4, + KeepAliveTimeSecs = 55, + LOptions = [{raw, IpProtoTcp, TcpKeepIdle, <<KeepAliveTimeSecs:32/native>>}], + {ok, LSocket} = ssl:listen(0, LOptions), + % Per http://www.erlang.org/doc/man/inet.html#getopts-2, we have to specify + % exactly which raw option we want, and the size of the buffer. + {ok, [{raw, IpProtoTcp, TcpKeepIdle, <<KeepAliveTimeSecs:32/native>>}]} = ssl:getopts(LSocket, [{raw, IpProtoTcp, TcpKeepIdle, 4}]). + + +%%-------------------------------------------------------------------- versions() -> [{doc,"Test API function versions/0"}]. |