From bc185e6f0f7c42715193221a9846a382f62513cd Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Mon, 15 Sep 2025 10:43:14 -0400 Subject: [PATCH] MT#63317 rework endpoint matching a bit Change-Id: If0c58f72822a45e5fb89a248a01b9a401592ec30 --- daemon/media_socket.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/daemon/media_socket.c b/daemon/media_socket.c index 0d69ecb05..d98184c9a 100644 --- a/daemon/media_socket.c +++ b/daemon/media_socket.c @@ -3162,10 +3162,9 @@ static bool media_packet_address_check(struct packet_handler_ctx *phc) if (phc->mp.sfd->confirmed) { /* see if we need to compare the source address with the known endpoint */ if (PS_ISSET2(phc->mp.stream, STRICT_SOURCE, MEDIA_HANDOVER)) { - endpoint_t endpoint = phc->mp.fsin; + bool matched = memcmp(&phc->mp.fsin, update_endpoint, sizeof(phc->mp.fsin)) == 0; - int tmp = memcmp(&endpoint, update_endpoint, sizeof(endpoint)); - if (tmp && PS_ISSET(phc->mp.stream, MEDIA_HANDOVER)) { + if (!matched && PS_ISSET(phc->mp.stream, MEDIA_HANDOVER)) { /* out_lock remains locked */ ilog(LOG_INFO | LOG_FLAG_LIMIT, "Peer address changed to %s%s%s", FMT_M(endpoint_print_buf(&phc->mp.fsin))); @@ -3176,11 +3175,11 @@ static bool media_packet_address_check(struct packet_handler_ctx *phc) goto update_addr; } - if (tmp && PS_ISSET(phc->mp.stream, STRICT_SOURCE)) { + if (!matched && PS_ISSET(phc->mp.stream, STRICT_SOURCE)) { ilog(LOG_INFO | LOG_FLAG_LIMIT, "Drop due to strict-source attribute; " "got %s%s%s, " "expected %s%s%s", - FMT_M(endpoint_print_buf(&endpoint)), + FMT_M(endpoint_print_buf(&phc->mp.fsin)), FMT_M(endpoint_print_buf(update_endpoint))); atomic64_inc_na(&phc->mp.stream->stats_in->errors); atomic64_inc_na(&phc->mp.sfd->local_intf->stats->in.errors);