From 736bd18652f220cdb634cc431132ec786b1fec14 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Tue, 30 Jul 2024 10:54:21 -0700 Subject: [PATCH] [ip6] remove UDP port check for messages with `HostTrusted` origin (#10546) This commit removes the checks previously performed on messages with the origin `HostTrusted` that are to be forwarded to the Thread mesh. This origin is used for messages generated by the OpenThread stack itself. These checks were unnecessarily restricting such messages from using Thread Control UDP port numbers (like TMF, MLE, etc.). The additional check `!IsLoopbackToHostAllowed()` (which is set to `true` by default on such messages) bypassed the entire block, preventing any functional impact. Recent related changes (in #9437) added similar guard checks for messages with `HostUntrusted` origins. --- src/core/net/ip6.cpp | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/core/net/ip6.cpp b/src/core/net/ip6.cpp index 4ac19ec76..0941a4abf 100644 --- a/src/core/net/ip6.cpp +++ b/src/core/net/ip6.cpp @@ -1263,22 +1263,6 @@ Error Ip6::HandleDatagram(OwnedPtr aMessagePtr, bool aIsReassembled) } } -#if !OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE - if (aMessagePtr->IsOriginHostTrusted() && !aMessagePtr->IsLoopbackToHostAllowed() && (nextHeader == kProtoUdp)) - { - uint16_t destPort; - - SuccessOrExit( - error = aMessagePtr->Read(aMessagePtr->GetOffset() + Udp::Header::kDestPortFieldOffset, destPort)); - destPort = BigEndian::HostSwap16(destPort); - - if (nextHeader == kProtoUdp) - { - VerifyOrExit(Get().ShouldUsePlatformUdp(destPort), error = kErrorDrop); - } - } -#endif - #if OPENTHREAD_CONFIG_MULTI_RADIO // Since the message will be forwarded, we clear the radio // type on the message to allow the radio type for tx to be