-
Notifications
You must be signed in to change notification settings - Fork 110
fix(2117): if si_wq is full, reset connection in case of flooding #2150
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2311,7 +2311,7 @@ ttls_recv(void *tls_data, unsigned char *buf, unsigned int len, unsigned int *re | |
| TTLS_WARN(tls, "TLS cannot decrypt msg on state %s, ret=%d%s\n", | ||
| tls_state_to_str(tls->state), r, | ||
| r == -EBADMSG ? "(bad ciphertext)" : ""); | ||
| return r; | ||
| return T_BLOCK_WITH_RST; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems we're going to block the client, not just reset it's connection. As noted in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's pure misleading in naming, all I want is sending
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, if we need to reset connections, then we do need designated RST constant and appropriate workflow handling the return codes. |
||
| } | ||
|
|
||
| if (io->msgtype == TTLS_MSG_ALERT) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Introducing
Conn_Resetstate, used only in one function seems like a workaround. I'd prefer a more clear solution. Seems this state is only needed to not to execute the skb processing while the socket is in the queue for closing, so don't we already have enough information about the socket state at the moment?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not a workaround, but a bugfix: In case of errors, we should exit the call chain and stop handling the involved TLS records, unrolled skb,
sk->sk_receive_queue, and futuresk_data_readycallbacks from the kernel (that's why we need to reset but not close the socket). Otherwise, it's an undefined behavior. And yes, we didn't cover theRSTcase (not close) in that function, that's exactly why I made changes here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new socket state used only in one function looks awkward.
Can we handle this with a real socket state? Maybe we can even avoid calling
sk_data_readyby setting some socket state and/or doing partial close/reset?