mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
res_rtp_asterisk: Revert DTLS negotiation changes.
Due to locking issues within pjnath these changes are being reverted until pjnath can be changed. ASTERISK-25645 Revert "res_rtp_asterisk.c: Fix DTLS negotiation delays." This reverts commit24ae124e4f
. Change-Id: I2986cfb2c43dc14455c1bcaf92c3804f9da49705 Revert "res_rtp_asterisk: Resolve further timing issues with DTLS negotiation" This reverts commit965a0eee46
. Change-Id: Ie68fafde27dad4b03cb7a1e27ce2a8502c3f7bbe
This commit is contained in:
@@ -444,7 +444,6 @@ static int ast_rtp_sendcng(struct ast_rtp_instance *instance, int level);
|
|||||||
#ifdef HAVE_OPENSSL_SRTP
|
#ifdef HAVE_OPENSSL_SRTP
|
||||||
static int ast_rtp_activate(struct ast_rtp_instance *instance);
|
static int ast_rtp_activate(struct ast_rtp_instance *instance);
|
||||||
static void dtls_srtp_check_pending(struct ast_rtp_instance *instance, struct ast_rtp *rtp, int rtcp);
|
static void dtls_srtp_check_pending(struct ast_rtp_instance *instance, struct ast_rtp *rtp, int rtcp);
|
||||||
static void dtls_srtp_flush_pending(struct ast_rtp_instance *instance, struct ast_rtp *rtp);
|
|
||||||
static void dtls_srtp_start_timeout_timer(struct ast_rtp_instance *instance, struct ast_rtp *rtp, int rtcp);
|
static void dtls_srtp_start_timeout_timer(struct ast_rtp_instance *instance, struct ast_rtp *rtp, int rtcp);
|
||||||
static void dtls_srtp_stop_timeout_timer(struct ast_rtp_instance *instance, struct ast_rtp *rtp, int rtcp);
|
static void dtls_srtp_stop_timeout_timer(struct ast_rtp_instance *instance, struct ast_rtp *rtp, int rtcp);
|
||||||
#endif
|
#endif
|
||||||
@@ -1684,20 +1683,15 @@ static void ast_rtp_on_ice_complete(pj_ice_sess *ice, pj_status_t status)
|
|||||||
if (rtp->rtcp) {
|
if (rtp->rtcp) {
|
||||||
update_address_with_ice_candidate(rtp, AST_RTP_ICE_COMPONENT_RTCP, &rtp->rtcp->them);
|
update_address_with_ice_candidate(rtp, AST_RTP_ICE_COMPONENT_RTCP, &rtp->rtcp->them);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_OPENSSL_SRTP
|
|
||||||
if (rtp->dtls.dtls_setup != AST_RTP_DTLS_SETUP_PASSIVE) {
|
|
||||||
dtls_perform_handshake(instance, &rtp->dtls, 0);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
dtls_srtp_flush_pending(instance, rtp); /* this flushes pending BIO for both rtp & rtcp as needed. */
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rtp->rtcp && rtp->rtcp->dtls.dtls_setup != AST_RTP_DTLS_SETUP_PASSIVE) {
|
|
||||||
dtls_perform_handshake(instance, &rtp->rtcp->dtls, 1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_OPENSSL_SRTP
|
||||||
|
dtls_perform_handshake(instance, &rtp->dtls, 0);
|
||||||
|
|
||||||
|
if (rtp->rtcp) {
|
||||||
|
dtls_perform_handshake(instance, &rtp->rtcp->dtls, 1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!strictrtp) {
|
if (!strictrtp) {
|
||||||
return;
|
return;
|
||||||
@@ -1892,23 +1886,6 @@ static void dtls_srtp_stop_timeout_timer(struct ast_rtp_instance *instance, stru
|
|||||||
AST_SCHED_DEL_UNREF(rtp->sched, dtls->timeout_timer, ao2_ref(instance, -1));
|
AST_SCHED_DEL_UNREF(rtp->sched, dtls->timeout_timer, ao2_ref(instance, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dtls_srtp_flush_pending(struct ast_rtp_instance *instance, struct ast_rtp *rtp)
|
|
||||||
{
|
|
||||||
struct dtls_details *dtls;
|
|
||||||
|
|
||||||
dtls = &rtp->dtls;
|
|
||||||
ast_mutex_lock(&dtls->lock);
|
|
||||||
dtls_srtp_check_pending(instance, rtp, 0);
|
|
||||||
ast_mutex_unlock(&dtls->lock);
|
|
||||||
|
|
||||||
if (rtp->rtcp) {
|
|
||||||
dtls = &rtp->rtcp->dtls;
|
|
||||||
ast_mutex_lock(&dtls->lock);
|
|
||||||
dtls_srtp_check_pending(instance, rtp, 1);
|
|
||||||
ast_mutex_unlock(&dtls->lock);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dtls_srtp_check_pending(struct ast_rtp_instance *instance, struct ast_rtp *rtp, int rtcp)
|
static void dtls_srtp_check_pending(struct ast_rtp_instance *instance, struct ast_rtp *rtp, int rtcp)
|
||||||
{
|
{
|
||||||
struct dtls_details *dtls = !rtcp ? &rtp->dtls : &rtp->rtcp->dtls;
|
struct dtls_details *dtls = !rtcp ? &rtp->dtls : &rtp->rtcp->dtls;
|
||||||
@@ -2141,8 +2118,6 @@ static int __rtp_recvfrom(struct ast_rtp_instance *instance, void *buf, size_t s
|
|||||||
SSL_set_accept_state(dtls->ssl);
|
SSL_set_accept_state(dtls->ssl);
|
||||||
}
|
}
|
||||||
|
|
||||||
ast_mutex_lock(&dtls->lock);
|
|
||||||
|
|
||||||
dtls_srtp_check_pending(instance, rtp, rtcp);
|
dtls_srtp_check_pending(instance, rtp, rtcp);
|
||||||
|
|
||||||
BIO_write(dtls->read_bio, buf, len);
|
BIO_write(dtls->read_bio, buf, len);
|
||||||
@@ -2153,7 +2128,6 @@ static int __rtp_recvfrom(struct ast_rtp_instance *instance, void *buf, size_t s
|
|||||||
unsigned long error = ERR_get_error();
|
unsigned long error = ERR_get_error();
|
||||||
ast_log(LOG_ERROR, "DTLS failure occurred on RTP instance '%p' due to reason '%s', terminating\n",
|
ast_log(LOG_ERROR, "DTLS failure occurred on RTP instance '%p' due to reason '%s', terminating\n",
|
||||||
instance, ERR_reason_error_string(error));
|
instance, ERR_reason_error_string(error));
|
||||||
ast_mutex_unlock(&dtls->lock);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2171,8 +2145,6 @@ static int __rtp_recvfrom(struct ast_rtp_instance *instance, void *buf, size_t s
|
|||||||
dtls_srtp_start_timeout_timer(instance, rtp, rtcp);
|
dtls_srtp_start_timeout_timer(instance, rtp, rtcp);
|
||||||
}
|
}
|
||||||
|
|
||||||
ast_mutex_unlock(&dtls->lock);
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -4861,20 +4833,7 @@ static void ast_rtp_remote_address_set(struct ast_rtp_instance *instance, struct
|
|||||||
rtp_learning_seq_init(&rtp->rtp_source_learn, rtp->seqno);
|
rtp_learning_seq_init(&rtp->rtp_source_learn, rtp->seqno);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_OPENSSL_SRTP
|
return;
|
||||||
/* Trigger pending outbound DTLS packets received before the address was set. Avoid unnecessary locking
|
|
||||||
* by checking if we're passive. Without this, we only send the pending packets once a new SSL packet is
|
|
||||||
* received in __rtp_recvfrom. If rtp->ice, this is instead done on_ice_complete
|
|
||||||
*/
|
|
||||||
#ifdef HAVE_PJPROJECT
|
|
||||||
if (rtp->ice) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (rtp->dtls.dtls_setup == AST_RTP_DTLS_SETUP_PASSIVE) {
|
|
||||||
dtls_srtp_flush_pending(instance, rtp);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Write t140 redundacy frame
|
/*! \brief Write t140 redundacy frame
|
||||||
|
Reference in New Issue
Block a user