TT#64601 refuse overriding crypto params from SDES when DTLS is in use

Change-Id: I10f2fe3fdd0955fa39b5edcb31196042cdb0b731
(cherry picked from commit ab77ed50af)
changes/64/34164/1
Richard Fuchs 6 years ago
parent 5a3755677e
commit a5b1231600

@ -931,9 +931,16 @@ void call_media_state_machine(struct call_media *m) {
static int __init_stream(struct packet_stream *ps) { static int __init_stream(struct packet_stream *ps) {
struct call_media *media = ps->media; struct call_media *media = ps->media;
struct call *call = ps->call; struct call *call = ps->call;
int active = -1; int dtls_active = -1;
struct dtls_connection *dtls_conn = NULL;
if (MEDIA_ISSET(media, SDES)) { if (MEDIA_ISSET(media, DTLS)) {
dtls_conn = dtls_ptr(ps->selected_sfd);
if (dtls_conn)
dtls_active = dtls_is_active(dtls_conn);
}
if (MEDIA_ISSET(media, SDES) && dtls_active == -1) {
for (GList *l = ps->sfds.head; l; l = l->next) { for (GList *l = ps->sfds.head; l; l = l->next) {
struct stream_fd *sfd = l->data; struct stream_fd *sfd = l->data;
crypto_init(&sfd->crypto, &media->sdes_in.params); crypto_init(&sfd->crypto, &media->sdes_in.params);
@ -942,19 +949,16 @@ static int __init_stream(struct packet_stream *ps) {
} }
if (MEDIA_ISSET(media, DTLS) && !PS_ISSET(ps, FALLBACK_RTCP)) { if (MEDIA_ISSET(media, DTLS) && !PS_ISSET(ps, FALLBACK_RTCP)) {
struct dtls_connection *d = dtls_ptr(ps->selected_sfd);
if (d)
active = dtls_is_active(d);
// we try to retain our role if possible, but must handle a role switch // we try to retain our role if possible, but must handle a role switch
if ((active && !MEDIA_ISSET(media, SETUP_ACTIVE)) if ((dtls_active && !MEDIA_ISSET(media, SETUP_ACTIVE))
|| (!active && !MEDIA_ISSET(media, SETUP_PASSIVE))) || (!dtls_active && !MEDIA_ISSET(media, SETUP_PASSIVE)))
active = -1; dtls_active = -1;
if (active == -1) if (dtls_active == -1)
active = (PS_ISSET(ps, FILLED) && MEDIA_ISSET(media, SETUP_ACTIVE)); dtls_active = (PS_ISSET(ps, FILLED) && MEDIA_ISSET(media, SETUP_ACTIVE));
dtls_connection_init(&ps->ice_dtls, ps, active, call->dtls_cert); dtls_connection_init(&ps->ice_dtls, ps, dtls_active, call->dtls_cert);
for (GList *l = ps->sfds.head; l; l = l->next) { for (GList *l = ps->sfds.head; l; l = l->next) {
struct stream_fd *sfd = l->data; struct stream_fd *sfd = l->data;
dtls_connection_init(&sfd->dtls, ps, active, call->dtls_cert); dtls_connection_init(&sfd->dtls, ps, dtls_active, call->dtls_cert);
} }
if (!PS_ISSET(ps, FINGERPRINT_VERIFIED) && media->fingerprint.hash_func if (!PS_ISSET(ps, FINGERPRINT_VERIFIED) && media->fingerprint.hash_func

Loading…
Cancel
Save