From a48676aa506904ceae62e928ad370fed349729fc Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 13 Nov 2026 07:46:21 -0400 Subject: [PATCH] MT#55283 drop stray STUN packets Don't forward STUN packets even if there is no ICE agent (unless passthrough mode is active). Prevents accidental ICE negotiations between endpoints. Change-Id: I4a34de5ba4dd6c1159d256c5cd8c9190945aa4e1 --- daemon/media_socket.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/daemon/media_socket.c b/daemon/media_socket.c index 53639bb0d..2a099e34d 100644 --- a/daemon/media_socket.c +++ b/daemon/media_socket.c @@ -2733,14 +2733,18 @@ static const char *__stream_ssrc_out(struct packet_stream *out_srtp, uint32_t ss // -1 = packet not handled, proceed; // 1 = same as 0, but stream can be kernelized static int media_demux_protocols(struct packet_handler_ctx *phc) { - if (phc->mp.media->ice_agent && is_stun(&phc->s)) { - int stun_ret = stun(&phc->s, phc->mp.sfd, &phc->mp.fsin); - if (!stun_ret) - return 0; - if (stun_ret == 1) { - call_media_state_machine(phc->mp.media); - return 1; + if (is_stun(&phc->s)) { + if (phc->mp.media->ice_agent) { + int stun_ret = stun(&phc->s, phc->mp.sfd, &phc->mp.fsin); + if (!stun_ret) + return 0; + if (stun_ret == 1) { + call_media_state_machine(phc->mp.media); + return 1; + } } + else if (!MEDIA_ISSET(phc->mp.media, PASSTHRU)) + return 0; // drop } // verify packet against ICE checks if present