FS-7500: check for uninit srtp
This commit is contained in:
parent
62c3ddfab3
commit
d293e9bd1b
|
@ -3321,7 +3321,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
|
||||||
if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV] && idx == 0 && rtp_session->recv_ctx[idx]) {
|
if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV] && idx == 0 && rtp_session->recv_ctx[idx]) {
|
||||||
rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV_RESET] = 1;
|
rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV_RESET] = 1;
|
||||||
} else {
|
} else {
|
||||||
if ((stat = srtp_create(&rtp_session->recv_ctx[idx], policy))) {
|
if ((stat = srtp_create(&rtp_session->recv_ctx[idx], policy)) || !rtp_session->recv_ctx[idx]) {
|
||||||
status = SWITCH_STATUS_FALSE;
|
status = SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3343,7 +3343,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
|
||||||
if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND] && idx == 0 && rtp_session->send_ctx[idx]) {
|
if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND] && idx == 0 && rtp_session->send_ctx[idx]) {
|
||||||
rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND_RESET] = 1;
|
rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND_RESET] = 1;
|
||||||
} else {
|
} else {
|
||||||
if ((stat = srtp_create(&rtp_session->send_ctx[idx], policy))) {
|
if ((stat = srtp_create(&rtp_session->send_ctx[idx], policy)) || !rtp_session->send_ctx[idx]) {
|
||||||
status = SWITCH_STATUS_FALSE;
|
status = SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5081,13 +5081,16 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
|
||||||
int sbytes = (int) *bytes;
|
int sbytes = (int) *bytes;
|
||||||
err_status_t stat = 0;
|
err_status_t stat = 0;
|
||||||
|
|
||||||
if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV_RESET]) {
|
if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV_RESET] || !rtp_session->recv_ctx[rtp_session->srtp_idx_rtp]) {
|
||||||
switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV_RESET);
|
switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV_RESET);
|
||||||
srtp_dealloc(rtp_session->recv_ctx[rtp_session->srtp_idx_rtp]);
|
srtp_dealloc(rtp_session->recv_ctx[rtp_session->srtp_idx_rtp]);
|
||||||
rtp_session->recv_ctx[rtp_session->srtp_idx_rtp] = NULL;
|
rtp_session->recv_ctx[rtp_session->srtp_idx_rtp] = NULL;
|
||||||
if ((stat = srtp_create(&rtp_session->recv_ctx[rtp_session->srtp_idx_rtp], &rtp_session->recv_policy[rtp_session->srtp_idx_rtp]))) {
|
if ((stat = srtp_create(&rtp_session->recv_ctx[rtp_session->srtp_idx_rtp],
|
||||||
|
&rtp_session->recv_policy[rtp_session->srtp_idx_rtp])) || !rtp_session->recv_ctx[rtp_session->srtp_idx_rtp]) {
|
||||||
|
|
||||||
|
rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV] = 0;
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Error! RE-Activating Secure RTP RECV\n");
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Error! RE-Activating Secure RTP RECV\n");
|
||||||
|
rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV] = 0;
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -6929,14 +6932,16 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
|
||||||
err_status_t stat;
|
err_status_t stat;
|
||||||
|
|
||||||
|
|
||||||
if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND_RESET]) {
|
if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND_RESET] || !rtp_session->send_ctx[rtp_session->srtp_idx_rtp]) {
|
||||||
|
|
||||||
switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND_RESET);
|
switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND_RESET);
|
||||||
srtp_dealloc(rtp_session->send_ctx[rtp_session->srtp_idx_rtp]);
|
srtp_dealloc(rtp_session->send_ctx[rtp_session->srtp_idx_rtp]);
|
||||||
rtp_session->send_ctx[rtp_session->srtp_idx_rtp] = NULL;
|
rtp_session->send_ctx[rtp_session->srtp_idx_rtp] = NULL;
|
||||||
if ((stat = srtp_create(&rtp_session->send_ctx[rtp_session->srtp_idx_rtp], &rtp_session->send_policy[rtp_session->srtp_idx_rtp]))) {
|
if ((stat = srtp_create(&rtp_session->send_ctx[rtp_session->srtp_idx_rtp],
|
||||||
|
&rtp_session->send_policy[rtp_session->srtp_idx_rtp])) || !rtp_session->send_ctx[rtp_session->srtp_idx_rtp]) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR,
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR,
|
||||||
"Error! RE-Activating %s Secure RTP SEND\n", rtp_type(rtp_session));
|
"Error! RE-Activating %s Secure RTP SEND\n", rtp_type(rtp_session));
|
||||||
|
rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND] = 0;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto end;
|
goto end;
|
||||||
} else {
|
} else {
|
||||||
|
@ -7459,8 +7464,10 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_write_raw(switch_rtp_t *rtp_session,
|
||||||
switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND_RESET);
|
switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND_RESET);
|
||||||
srtp_dealloc(rtp_session->send_ctx[rtp_session->srtp_idx_rtp]);
|
srtp_dealloc(rtp_session->send_ctx[rtp_session->srtp_idx_rtp]);
|
||||||
rtp_session->send_ctx[rtp_session->srtp_idx_rtp] = NULL;
|
rtp_session->send_ctx[rtp_session->srtp_idx_rtp] = NULL;
|
||||||
if ((stat = srtp_create(&rtp_session->send_ctx[rtp_session->srtp_idx_rtp], &rtp_session->send_policy[rtp_session->srtp_idx_rtp]))) {
|
if ((stat = srtp_create(&rtp_session->send_ctx[rtp_session->srtp_idx_rtp],
|
||||||
|
&rtp_session->send_policy[rtp_session->srtp_idx_rtp])) || !rtp_session->send_ctx[rtp_session->srtp_idx_rtp]) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Error! RE-Activating Secure RTP SEND\n");
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Error! RE-Activating Secure RTP SEND\n");
|
||||||
|
rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND] = 0;
|
||||||
status = SWITCH_STATUS_FALSE;
|
status = SWITCH_STATUS_FALSE;
|
||||||
goto end;
|
goto end;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue