From be4cfb7c549e0269bcfa014230f0e95d809a0b44 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 11 Feb 2022 12:07:29 -0500 Subject: [PATCH] TT#14008 add extra logging for SRTP/SSRC updates Change-Id: I564193c919563ec14c61db1031f696d5029e6e40 (cherry picked from commit 014301bee86259e02f5187f5e0a641445c5532e3) --- daemon/call.c | 16 ++++++++++++++-- kernel-module/xt_RTPENGINE.c | 22 ++++++++++------------ 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index 063198648..0006f21cc 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -587,6 +587,8 @@ void call_timer(void *ptr) { if (!sfd) goto next; + log_info_stream_fd(sfd); + rwlock_lock_r(&sfd->call->master_lock); ps = sfd->stream; @@ -665,6 +667,10 @@ void call_timer(void *ptr) { if (sink->crypto.params.crypto_suite && o->encrypt.last_index[u] - ctx->srtp_index > 0x4000) { + ilog(LOG_DEBUG, "Updating SRTP encryption index from %" PRIu64 + " to %" PRIu64, + ctx->srtp_index, + o->encrypt.last_index[u]); ctx->srtp_index = o->encrypt.last_index[u]; update = true; } @@ -684,12 +690,17 @@ void call_timer(void *ptr) { atomic64_add(&ctx->octets, diff_bytes); atomic64_add(&ctx->packets, diff_packets); atomic64_set(&ctx->last_seq, ke->target.decrypt.last_index[u]); - ctx->srtp_index = ke->target.decrypt.last_index[u]; if (sfd->crypto.params.crypto_suite && ke->target.decrypt.last_index[u] - - ctx->srtp_index > 0x4000) + - ctx->srtp_index > 0x4000) { + ilog(LOG_DEBUG, "Updating SRTP decryption index from %" PRIu64 + " to %" PRIu64, + ctx->srtp_index, + ke->target.decrypt.last_index[u]); + ctx->srtp_index = ke->target.decrypt.last_index[u]; update = true; + } } mutex_unlock(&ps->in_lock); } @@ -702,6 +713,7 @@ void call_timer(void *ptr) { next: g_slice_free1(sizeof(*ke), ke); i = g_list_delete_link(i, i); + log_info_pop(); } kill_calls_timer(hlp.del_scheduled, NULL); diff --git a/kernel-module/xt_RTPENGINE.c b/kernel-module/xt_RTPENGINE.c index 23743ddbf..de7e25a56 100644 --- a/kernel-module/xt_RTPENGINE.c +++ b/kernel-module/xt_RTPENGINE.c @@ -1599,10 +1599,10 @@ static void proc_list_crypto_print(struct seq_file *f, struct re_crypto_context seq_printf(f, " ROC:"); for (i = 0; i < ARRAY_SIZE(c->roc); i++) { - if (i == 0) - seq_printf(f, " %u", (unsigned int) c->roc[i]); - else - seq_printf(f, ", %u", (unsigned int) c->roc[i]); + seq_printf(f, "%s %u (%lu)", + (i == 0) ? "" : ",", + (unsigned int) c->roc[i], + (unsigned long) s->last_index[i]); } seq_printf(f, "\n"); @@ -1660,10 +1660,9 @@ static int proc_list_show(struct seq_file *f, void *v) { for (i = 0; i < ARRAY_SIZE(g->target.ssrc); i++) { if (!g->target.ssrc[i]) break; - if (i == 0) - seq_printf(f, " %lx", (unsigned long) ntohl(g->target.ssrc[i])); - else - seq_printf(f, ", %lx", (unsigned long) ntohl(g->target.ssrc[i])); + seq_printf(f, "%s %lx", + (i == 0) ? "" : ",", + (unsigned long) ntohl(g->target.ssrc[i])); } seq_printf(f, "\n"); @@ -1693,10 +1692,9 @@ static int proc_list_show(struct seq_file *f, void *v) { for (j = 0; j < ARRAY_SIZE(o->output.ssrc_out); j++) { if (!o->output.ssrc_out[j]) break; - if (j == 0) - seq_printf(f, " %lx", (unsigned long) ntohl(o->output.ssrc_out[j])); - else - seq_printf(f, ", %lx", (unsigned long) ntohl(o->output.ssrc_out[j])); + seq_printf(f, "%s %lx", + (j == 0) ? "" : ",", + (unsigned long) ntohl(o->output.ssrc_out[j])); } seq_printf(f, "\n");