Skip to content

Connect DTLS without a negotiated SRTP profile - #3699

Open
HashimTheArab wants to merge 1 commit into
pion:mainfrom
HashimTheArab:fix/dtls-no-srtp-profile
Open

HashimTheArab wants to merge 1 commit into
pion:mainfrom
HashimTheArab:fix/dtls-no-srtp-profile

Conversation

@HashimTheArab

Copy link
Copy Markdown
Contributor

Description

DTLSTransport fails with ErrNoSRTPProtectionProfile whenever the handshake completes without a negotiated SRTP profile, even if the connection only carries data channels.

A peer is allowed to leave out use_srtp (RFC 5764 Section 4.1.1), and some data-channel-only endpoints do. Minecraft Bedrock's WebRTC transport is one example: some of its servers take the DTLS client role and send no use_srtp. libwebrtc connects to these peers, because a failed SRTP key setup does not fail its DTLS transport, so data channels keep working. Pion fails the transport, so SCTP never starts.

SettingEngine can't work around this. The profile comes from the peer's ClientHello, and the DTLS message hooks only change messages Pion sends.

This change keeps the transport connected when no profile was negotiated and SRTP is not wanted. The missing profile is remembered, so starting SRTP later returns ErrNoSRTPProtectionProfile. A transport that already wants SRTP fails as before.

Pion is the DTLS server in this case. If Pion is the DTLS client and the server leaves out use_srtp, pion/dtls still aborts the handshake with errRequestedButNoSRTPExtension. This PR does not change that.

Testing

TestDTLSTransport_Start_ConnectsWithoutSRTPProfile fails without the change and passes with it.

A peer may decline the use_srtp extension (RFC 5764 Section 4.1.1), as
data-channel-only endpoints such as some NetherNet servers do. The
transport failed with ErrNoSRTPProtectionProfile even though data
channels never use SRTP. libwebrtc logs the missing crypto suite and
keeps the transport connected.

Keep the transport connected when no profile was negotiated and media
is not wanted; starting SRTP later returns ErrNoSRTPProtectionProfile,
and a transport that already wants media still fails as before.
@codecov

codecov Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.62%. Comparing base (60271fb) to head (536df91).

Files with missing lines Patch % Lines
dtlstransport.go 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3699      +/-   ##
==========================================
+ Coverage   90.59%   90.62%   +0.02%     
==========================================
  Files          83       83              
  Lines        9170     9174       +4     
==========================================
+ Hits         8308     8314       +6     
+ Misses        862      860       -2     
Flag Coverage Δ
go 90.62% <87.50%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants