From 262551ff64b0bea8bc560b0f9723ab1c7047e4f2 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Mon, 5 May 2025 09:07:35 -0700 Subject: [PATCH] [udp] relax `SocketHandle::Matches()` for host interface (#11465) This commit relaxes the `SocketHandle::Matches()` method to allow a socket associated with `kNetifUnspecified` to match when `IsHostInterface()` is set. This is in addition to the existing behavior of matching a backbone socket under the same condition. --- src/core/net/udp6.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core/net/udp6.cpp b/src/core/net/udp6.cpp index 4295217ea..ab5eedda9 100644 --- a/src/core/net/udp6.cpp +++ b/src/core/net/udp6.cpp @@ -46,7 +46,14 @@ bool Udp::SocketHandle::Matches(const MessageInfo &aMessageInfo) const bool matches = false; #if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE - VerifyOrExit(IsBackbone() == aMessageInfo.IsHostInterface()); + if (aMessageInfo.IsHostInterface()) + { + VerifyOrExit(IsBackbone() || (GetNetifId() == kNetifUnspecified)); + } + else + { + VerifyOrExit(!IsBackbone()); + } #endif VerifyOrExit(GetSockName().mPort == aMessageInfo.GetSockPort());