Repository navigation
Conversation
flight0/flight3 select the SRTP protection profile by iterating the client's use_srtp offer first; Config::local_srtp_protection_profiles acts only as a membership filter, so its order never affects the outcome. Standard TLS practice is server preference (RFC 5246/8446), and RFC 5764 §4.1.1 mandates only that the server select a single profile the client offered — the policy within the offered set is the server's. Add ConfigBuilder::with_srtp_profile_selection (SrtpProfileSelection::ClientPreference | ServerPreference; the default keeps the historical client-order behavior) and route both server-side call sites through select_srtp_profile. Expose DTLSConn::selected_srtp_protection_profile publicly (pion parity: Connection.SelectedSRTPProtectionProfile) and add Endpoint::connection(&remote) so integrators can inspect the negotiated profile; include integration tests pinning both policies over real handshakes. Without ServerPreference, gateways that must rank the intersection by their own policy (AEAD when offered, legacy HMAC-SHA1 otherwise) have to parse the client's ClientHello themselves before feeding it to the engine, duplicating the use_srtp parsing the library already performs.
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.
Summary
Implementation of #335
Changes
config.rs:pub enum SrtpProfileSelection { ClientPreference (default), ServerPreference }+ConfigBuilder::with_srtp_profile_selection(), plumbed throughbuild()intoHandshakeConfig.lib.rs:select_srtp_profile(selection, client_offer, local)— the single place that decides the iteration order; unit tests pin the policy matrix (client order, server order, server order within the client's offer — the RFC boundary — and no intersection → error).flight0.rs/flight3.rs: both server-side call sites routed throughselect_srtp_profile.conn/mod.rs+endpoint.rs:DTLSConn::selected_srtp_protection_profileis nowpub(pion parity:Connection.SelectedSRTPProtectionProfile) andEndpoint::connection(&remote)exposes the established connection, so integrators can inspect the negotiated profile.tests/srtp_profile_selection.rs: integration tests over real handshakes — client[SHA1_80, SHA1_32]vs server[SHA1_32, SHA1_80](orders deliberately conflict):ClientPreferenceselects SHA1_80,ServerPreferenceselects SHA1_32, on both sides.Testing
cargo test -p rtc-dtls— 84 tests green (unit + integration, incl. the two new handshake-level tests).cargo clippy -p rtc-dtlsclean,cargo fmtapplied.