Repository navigation
fix(sctp): report duplicate TSNs and bound SACKs - #301
Merged
Merged
Conversation
The receiver never listed a repeated TSN: handle_data calls PayloadQueue::push, which records duplicates, only after can_push has already turned repeats away. It also delayed the SACK for a packet that held only repeats, which RFC 9260 section 6.2 says MUST be sent at once. Repeats are now recorded (at most 20 between SACKs, as dcSCTP and usrsctp keep) and answered with an immediate SACK. The SACK keeps within the association's MTU: gap blocks nearest the cumulative TSN first, then the repeats that still fit.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #301 +/- ##
==========================================
+ Coverage 88.49% 88.51% +0.01%
==========================================
Files 510 511 +1
Lines 75230 75334 +104
==========================================
+ Hits 66575 66680 +105
+ Misses 8655 8654 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
rainliu
approved these changes
Nov 11, 2026
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.
The receiver never reports a TSN it got twice.
handle_dataonly callsPayloadQueue::push, which is what records a duplicate, whencan_pushreturns true, andcan_pushis false for exactly those chunks. Sopop_duplicates()always comes back empty and every SACK goes out with zero duplicate TSNs. A packet carrying nothing but repeats also waits for the delayed-ack timer, but RFC 9260 section 6.2 says that SACK MUST go out immediately.This change records each repeat and sends the SACK at once. The repeat list is capped at 20 between SACKs, the same cap dcSCTP and usrsctp use (Linux uses 16). Following the RFC 9260 section 3.3.4 example, a TSN received three times is listed twice.
The SACK is also bounded by the association's MTU now. Gap blocks closest to the cumulative TSN go in first, then whatever repeats still fit. Today the gap list has no limit, so a large window with heavy loss can produce a SACK bigger than one packet (one of the new tests builds an 8028-byte SACK against a 1428-byte MTU). pion/sctp#493 fixed the same thing. The doc comment on
SettingEngineBuilder::with_sctp_mtupreviously said SACKs ignore the MTU, so it now says they don't.pion/sctp has the same receiver bug (
receivePayloadQueue.pushis also guarded bycanPush).Tests (
association/duplicate_report_test.rs):cargo fmt --check,cargo clippy,cargo test --workspace, the doc tests and bothscripts/check-*.pychecks pass locally on rustc 1.99.1.