-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass 'raw' options through ssl:listen/1 #824
Conversation
Patch has passed first testings and has been assigned to be reviewed I am a script, I am not human |
I do not remember seeing your question, however it is easy to sometimes miss a thread |
I've updated the commit message. Let me know if you need more details. |
Humm are you sure you pushed the new commit message? I can not see it! |
Er, my bad. I mean I updated the PR comment. I'll update the commit tomorrow. Sorry. |
In Erlang R16B03-1, I've been passing raw options to ssl:listen as follows, and it's been working fine: % The constants are defined elsewhere. LOpts = [{raw, ?IPPROTO_TCP, ?TCP_MAXSEG, <<MSS:32/native>>} | ...], {ok, LSocket} = ssl:listen(0, LOpts) In Erlang 17.3, this fails with {option_not_a_key_value_tuple,{raw,6,2,<<64,2,0,0>>}} I originally reported this in http://erlang.org/pipermail/erlang-questions/2014-October/081226.html I need to pass this particular raw option to ssl:listen, because it needs to be applied when the socket is first opened -- between inet:open and prim_inet:listen -- it cannot be applied later by setopts. This means that it needs to be done by inet_tcp:listen/2 -- well, actually by inet:open/8, but... Otherwise it's racey -- a client could connect between prim_inet:listen and the setopts call. The MSS option is advertised in the SYN,ACK packet, and can't be changed later.
9891c24
to
b02221c
Compare
I've copied the details to the commit itself. |
Patch has passed first testings and has been assigned to be reviewed I am a script, I am not human |
Looks good :) By the way it would be great if you could add a test case also that uses the raw-option, |
any progress on that tests case? |
Unfortunately, no. I started looking at it, and then got snowed under with more important work-related stuff. A couple of problems:
When I'm a little less busy, I'll try to get the test cases finished up. |
You can test for platform in all init_suite/group/testcase functions and skip test if the requirements are Maybe you could read the option back with ssl:getopts that will fallback to inet:getopts for non "ssl" otpions. Make sure not to set the default value. |
I've added a test; it uses TCP_KEEPALIVE, because TCP_MAXSEG can't be read back reliably. |
The summary line of the commit message is too long and/or ends with a "." Bad message: Ensure that a single 'raw' option is passed to ssl:listen correctly I am a script, I am not human |
b48d167
to
515fd34
Compare
Add a test to ensure that a single 'raw' option can be passed to ssl:listen correctly. Note: multiple raw options are (incorrectly) handled by inet:listen_options. See http://erlang.org/pipermail/erlang-questions/2014-March/078371.html
515fd34
to
3dd86e7
Compare
In Erlang R16B03-1, I've been passing raw options to
ssl:listen
asfollows, and it's been working fine:
In Erlang 17.3, this fails with
{option_not_a_key_value_tuple,{raw,6,2,<<64,2,0,0>>}}
I originally reported this in
http://erlang.org/pipermail/erlang-questions/2014-October/081226.html
I need to pass this particular raw option to
ssl:listen
, because it needs to be applied when the socket is first opened -- betweeninet:open
andprim_inet:listen
-- it cannot be applied later bysetopts
. This means that it needs to be done byinet_tcp:listen/2
-- well, actually byinet:open/8
, but...Otherwise it's racey -- a client could connect between
prim_inet:listen
and thesetopts
call. The MSS option is advertised in theSYN,ACK
packet, and can't be changed later.