Repository navigation
fix(ice): use a random transaction ID for STUN Binding requests - #954
Merged
Merged
Conversation
The STUN gatherer built its Binding request with TransactionId::default(), an all-zero ID, so every srflx request carried the same transaction ID. RFC 8489 section 5 requires it to be uniformly random; use TransactionId::new(). Fixes webrtc-rs/rtc#283
rainliu
approved these changes
Nov 7, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #954 +/- ##
=======================================
Coverage 86.57% 86.57%
=======================================
Files 66 66
Lines 14423 14423
=======================================
Hits 12486 12486
Misses 1937 1937
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:
|
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.
Fixes webrtc-rs/rtc#283 (filed in
rtc, but the code lives here).RTCStunGatherer::gather_from_stun_serverbuilt the Binding request withTransactionId::default(), which is the all-zero ID, so every server-reflexive request went out with the same transaction ID. RFC 8489 §5 requires the transaction ID to be uniformly random, and some servers/NATs drop or mis-match requests that reuse it.This switches to
TransactionId::new(), which already exists inrtc-stunand fills the ID fromrand::rng().Test
Added
binding_requests_use_random_transaction_ids: it builds two STUN clients against the mock runtime, takes the queued Binding request bytes, and checks the 96-bit transaction ID (bytes 8..20) is non-zero and differs between requests. It fails onmasterand passes with this change.CHANGELOG
[Unreleased]→Fixedupdated.