pc: ignore DTLS-decrypted packets in RtpTransport::OnReadPacket RtpTransport subscribes to the underlying packet transport's read callback, which fires for both SRTP-bypass packets (kSrtpEncrypted) and DTLS-decrypted application data (kDtlsDecrypted, e.g. SCTP cleartext). DcSctpTransport filters on decryption_info(); RtpTransport relied on InferRtpPacketType to reject the cleartext. That only works because the default SCTP common header starts with 0x13 0x88 (port 5000), which fails the V=2 check. Any payload whose first byte has high bits 10 and whose second byte's low 7 bits land in the RTCP-reserved PT range [64, 96) gets misrouted to SrtpTransport and fails UnprotectRtcp with a noisy log. Filter on decryption_info() up front. Bug: webrtc:517079993 Change-Id: I769a07644eb1286fa6c685cef3e1ef5937545843 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/476180 Reviewed-by: Victor Boivie <boivie@webrtc.org> Commit-Queue: Victor Boivie <boivie@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#47830}
diff --git a/media/sctp/dcsctp_transport.cc b/media/sctp/dcsctp_transport.cc index 96f02da..907140c 100644 --- a/media/sctp/dcsctp_transport.cc +++ b/media/sctp/dcsctp_transport.cc
@@ -744,6 +744,7 @@ PacketTransportInternal* /* transport */, const ReceivedIpPacket& packet) { RTC_DCHECK_RUN_ON(network_thread_); + // TODO: bugs.webrtc.org/517079993 - follow RFC 7983 design. if (packet.decryption_info() != ReceivedIpPacket::kDtlsDecrypted) { // We are only interested in SCTP packets. return;
diff --git a/pc/rtp_transport.cc b/pc/rtp_transport.cc index 8e9d1ea..9326f40 100644 --- a/pc/rtp_transport.cc +++ b/pc/rtp_transport.cc
@@ -423,6 +423,12 @@ const ReceivedIpPacket& received_packet) { TRACE_EVENT0("webrtc", "RtpTransport::OnReadPacket"); + // DTLS-decrypted application data is not RTP/RTCP. + // TODO: bugs.webrtc.org/517079993 - follow RFC 7983 design. + if (received_packet.decryption_info() == ReceivedIpPacket::kDtlsDecrypted) { + return; + } + // When using RTCP multiplexing we might get RTCP packets on the RTP // transport. We check the RTP payload type to determine if it is RTCP. RtpPacketType packet_type = InferRtpPacketType(received_packet.payload());