summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorJenkins2 <jenkins2@gerrit.asterisk.org>2017-04-27 10:05:16 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-04-27 10:05:16 -0500
commit54e27cad3ceddfb3494c0a8333a4764375620a84 (patch)
tree277165934d52a80d106ead0cfdd19e331b668186 /res
parent78eb08e7ba6f44436bd0ff2f3885277fca8f0cc5 (diff)
parentafad2ffd9f84bfb72c7649a6c40e663ce93e25bd (diff)
Merge "res_rtp_asterisk.c: Fix crash in RTCP DTLS operation."
Diffstat (limited to 'res')
-rw-r--r--res/res_rtp_asterisk.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index e2638320c..d0d795939 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -1721,8 +1721,10 @@ static void ast_rtp_dtls_stop(struct ast_rtp_instance *instance)
dtls_srtp_stop_timeout_timer(instance, rtp, 1);
ao2_lock(instance);
- if (rtp->rtcp->dtls.ssl && (rtp->rtcp->dtls.ssl != ssl)) {
- SSL_free(rtp->rtcp->dtls.ssl);
+ if (rtp->rtcp->dtls.ssl) {
+ if (rtp->rtcp->dtls.ssl != ssl) {
+ SSL_free(rtp->rtcp->dtls.ssl);
+ }
rtp->rtcp->dtls.ssl = NULL;
}
}
@@ -5445,14 +5447,14 @@ static void ast_rtp_prop_set(struct ast_rtp_instance *instance, enum ast_rtp_pro
* to activating RTP. It is not until RTP is activated that timers start for RTCP
* transmission
*/
- if (rtp->rtcp->s > -1) {
+ if (rtp->rtcp->s > -1 && rtp->rtcp->s != rtp->s) {
close(rtp->rtcp->s);
}
rtp->rtcp->s = rtp->s;
ast_rtp_instance_get_remote_address(instance, &addr);
ast_sockaddr_copy(&rtp->rtcp->them, &addr);
#ifdef HAVE_OPENSSL_SRTP
- if (rtp->rtcp->dtls.ssl) {
+ if (rtp->rtcp->dtls.ssl && rtp->rtcp->dtls.ssl != rtp->dtls.ssl) {
SSL_free(rtp->rtcp->dtls.ssl);
}
rtp->rtcp->dtls.ssl = rtp->dtls.ssl;
@@ -5460,7 +5462,6 @@ static void ast_rtp_prop_set(struct ast_rtp_instance *instance, enum ast_rtp_pro
}
ast_debug(1, "Setup RTCP on RTP instance '%p'\n", instance);
- return;
} else {
if (rtp->rtcp) {
if (rtp->rtcp->schedid > -1) {
@@ -5481,6 +5482,10 @@ static void ast_rtp_prop_set(struct ast_rtp_instance *instance, enum ast_rtp_pro
close(rtp->rtcp->s);
}
#ifdef HAVE_OPENSSL_SRTP
+ ao2_unlock(instance);
+ dtls_srtp_stop_timeout_timer(instance, rtp, 1);
+ ao2_lock(instance);
+
if (rtp->rtcp->dtls.ssl && rtp->rtcp->dtls.ssl != rtp->dtls.ssl) {
SSL_free(rtp->rtcp->dtls.ssl);
}
@@ -5489,11 +5494,8 @@ static void ast_rtp_prop_set(struct ast_rtp_instance *instance, enum ast_rtp_pro
ast_free(rtp->rtcp);
rtp->rtcp = NULL;
}
- return;
}
}
-
- return;
}
/*! \pre instance is locked */