Fix packet order of FIN from SHUT_WR#3562
Merged
stevenengler merged 2 commits intoshadow:mainfrom Apr 24, 2025
Merged
Conversation
SHUT_WR
1c52d4a to
394d80d
Compare
robgjansen
approved these changes
Apr 24, 2025
Member
robgjansen
left a comment
There was a problem hiding this comment.
Good find!
If only we had a nice Rust TCP stack so we could throw this janky C stack in the trash :D
This test currently fails.
This should fix shadow#3100 and its associated regression test. This prevents FIN packets caused by a `SHUT_WR` from being sent before other packets with a lower sequence number.
394d80d to
8d38356
Compare
Contributor
Author
Every time I look at the rust tcp code, I remember how much work still needs to be done. Someday hopefully :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Shadow assigns a priority to packets, and packets with a lower priority will be sent before other packets. Previously, shadow only assigned a priority to non-empty packets (here meaning containing a payload), and a priority of 0 to other packets. But this meant that empty packets like FIN (with a priority of 0) could be sent before other packets, even if the FIN had a higher sequence number. Shadow seems to have discarded these out-of-order FIN packets. See #3100 for an example.
This MR changes the legacy TCP code to always assign a non-zero priority if the packets has a sequence number, so that they won't be sent out of order. This (edit: partially; see #3100 (comment)) fixes (edit: <text to prevent github from closing the linked issue>) #3100, but there are still a lot of other shutdown-related bugs (see all the disabled tests in
src/test/socket/shutdown/test_shutdown.rs), soshutdown()still won't work 100% as expected.Related: #3558 (I think this MR fixes this shutdown issue as well, but it looks like there are still some other issues.)