diff options
author | Raimo Niskanen <[email protected]> | 2010-09-02 10:31:28 +0200 |
---|---|---|
committer | Raimo Niskanen <[email protected]> | 2010-09-02 10:31:28 +0200 |
commit | 9a30a97f07a68fc5a2f1c0095bdd88818e94089a (patch) | |
tree | ef3ee558e05c86d78da4c5ffee7d06350090f01d | |
parent | 2a6db0111898f25f5c615ce9b7f4e6ef84381a03 (diff) | |
parent | c61fe198825316de24e7b37620b3ebd8ebd81c6d (diff) | |
download | otp-9a30a97f07a68fc5a2f1c0095bdd88818e94089a.tar.gz otp-9a30a97f07a68fc5a2f1c0095bdd88818e94089a.tar.bz2 otp-9a30a97f07a68fc5a2f1c0095bdd88818e94089a.zip |
Merge branch 'rani/sctp-linger-bugfix/OTP-8726' into dev
* rani/sctp-linger-bugfix/OTP-8726:
Fix SCTP linger option
-rw-r--r-- | erts/emulator/drivers/common/inet_drv.c | 4 | ||||
-rw-r--r-- | lib/kernel/test/gen_sctp_SUITE.erl | 26 |
2 files changed, 24 insertions, 6 deletions
diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c index 059288d1cb..221904c114 100644 --- a/erts/emulator/drivers/common/inet_drv.c +++ b/erts/emulator/drivers/common/inet_drv.c @@ -5032,8 +5032,8 @@ static int sctp_set_opts(inet_descriptor* desc, char* ptr, int len) } case INET_OPT_LINGER: { - CHKLEN(curr, ASSOC_ID_LEN + 2 + 4); - arg.lin.l_onoff = get_int16 (curr); curr += 2; + CHKLEN(curr, 2*4); + arg.lin.l_onoff = get_int32 (curr); curr += 4; arg.lin.l_linger = get_int32 (curr); curr += 4; proto = SOL_SOCKET; diff --git a/lib/kernel/test/gen_sctp_SUITE.erl b/lib/kernel/test/gen_sctp_SUITE.erl index fad8c7398b..0899a9e660 100644 --- a/lib/kernel/test/gen_sctp_SUITE.erl +++ b/lib/kernel/test/gen_sctp_SUITE.erl @@ -23,12 +23,16 @@ %%-compile(export_all). --export([all/1,init_per_testcase/2,fin_per_testcase/2, - basic/1,api_open_close/1,api_listen/1,api_connect_init/1, - xfer_min/1,xfer_active/1]). +-export([all/1,init_per_testcase/2,fin_per_testcase/2]). +-export( + [basic/1, + api_open_close/1,api_listen/1,api_connect_init/1,api_opts/1, + xfer_min/1,xfer_active/1]). all(suite) -> - [basic,api_open_close,api_listen,api_connect_init,xfer_min,xfer_active]. + [basic, + api_open_close,api_listen,api_connect_init,api_opts, + xfer_min,xfer_active]. init_per_testcase(_Func, Config) -> Dog = test_server:timetrap(test_server:seconds(15)), @@ -382,3 +386,17 @@ api_connect_init(Config) when is_list(Config) -> ?line ok = gen_sctp:close(Sa), ?line ok = gen_sctp:close(Sb), ok. + +api_opts(doc) -> + "Test socket options"; +api_opts(suite) -> + []; +api_opts(Config) when is_list(Config) -> + ?line {ok,S} = gen_sctp:open(0), + ?line OSType = os:type(), + ?line case {inet:setopts(S, [{linger,{true,2}}]),OSType} of + {ok,_} -> + ok; + {{error,einval},{unix,sunos}} -> + ok + end. |