Ignore non-DTLS data before handshake is complete

https://datatracker.ietf.org/doc/html/rfc9147#name-demul
https://datatracker.ietf.org/doc/html/rfc5764#section-5.1.2

If data is received before handshake is complete, discard it rather than
forwarding it blindly to GnuTLS which can get confused.
This commit is contained in:
Stephen Paul Weber 2023-07-04 21:59:24 -05:00 committed by Marvin W
parent da383a2fe9
commit 7c048ecaef
No known key found for this signature in database
GPG key ID: 072E9235DB996F2A

View file

@ -46,7 +46,7 @@ public class Handler {
return srtp_session.decrypt_rtp(data); return srtp_session.decrypt_rtp(data);
} }
if (component_id == 2) return srtp_session.decrypt_rtcp(data); if (component_id == 2) return srtp_session.decrypt_rtcp(data);
} else if (component_id == 1) { } else if (component_id == 1 && (data[0] >= 20 && data[0] <= 63)) {
on_data_rec(data); on_data_rec(data);
} }
return null; return null;