-
Notifications
You must be signed in to change notification settings - Fork 177
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
Use the expected sequence number for challenge ACK messages #1236
Conversation
5638f14
to
240d935
Compare
That avoids avoid endless ACK/RST retransmissions. FreeRTOS-Plus-TCP issue FreeRTOS#1235
240d935
to
9147cd1
Compare
Thanks for your contribution. I'm trying to understand the changes, from what I've seen in the wire shark capture on issue!1235 and AFAIK, the target device should have dropped the connection after the second RST packet was received as this packet contains a sequence number equals to the challenge ACK packet acknowledgement number. However the target didn't reset the connection, that's why i believe @tony-josi-aws has suggested here that the second RST packet should be handled separately as in we need to compare the second RST packet's sequence number with the challenge ACK packets's acknowledgement number. However, I can't see this being part of the changes, am I missing something? |
Thanks for your contribution to FreeRTOS+TCP. I just tested your implementation locally and verified that it works by not leading to continuously sending ACK/RST. Attaching PCAP and screen capture of the tests for anyone interested: the second RST (packet 11) from the external device (in this case, a server running on Windows OS) has triggered a closing of the socket on the FreeRTOS+TCP device: PCAP file: wshark.zip A further improvement to be fully complaint with RFC 5961 [3.2. Mitigation] is to set the sequence number of the challenges ACK as per the TCP sockets In my test case, the acknowledgement number of the first RST was what was expected by the FreeRTOS+TCP device, so swapping it to the sequence number was as per RFC:
But I believe in the case of a malicious RST this might not be the case, hence it might be more reasonable to use So, in my opinion, it makes sense to also take Feel free to share your opinion, and if you wish to add those changes to the PR please do so or let us know. Thanks for taking a look at this PR. In this PR, @mj-servus corrects that by updating the sequence number of the first RST which is used as the base packet to form the challenge ACK. Updating the sequence number causes the acknowledgement number of the challenge ACK to be updated with that sequence number because of the swapping mentioned in the previous paragraph. |
Thank you very much for the suggestions. I adopted the code accordingly. |
713e011
to
877fe74
Compare
@tony-josi-aws Thanks for your detailed explanation. |
Co-authored-by: Ahmed Ismail <[email protected]>
That avoids avoid endless ACK/RST retransmissions.
Description
See #1235
Test Steps
Checklist:
Related Issue
#1235
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.