diff --git a/src/core/mac/mac.cpp b/src/core/mac/mac.cpp index a29ee3fc5..6eb15955e 100644 --- a/src/core/mac/mac.cpp +++ b/src/core/mac/mac.cpp @@ -907,7 +907,7 @@ void Mac::ProcessTransmitSecurity(TxFrame &aFrame) #if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE // Transmit security will be processed after time IE content is updated. - VerifyOrExit(aFrame.mInfo.mTxInfo.mCslPresent == 0); + VerifyOrExit(!aFrame.IsCslIePresent()); #endif aFrame.ProcessTransmitAesCcm(*extAddress); diff --git a/src/core/mac/mac_frame.hpp b/src/core/mac/mac_frame.hpp index 739117a88..7e5bd8b29 100644 --- a/src/core/mac/mac_frame.hpp +++ b/src/core/mac/mac_frame.hpp @@ -1422,6 +1422,22 @@ public: mInfo.mTxInfo.mIsSecurityProcessed = aIsSecurityProcessed; } + /** + * Indicates whether or not the frame contains the CSL IE. + * + * @retval TRUE The frame contains the CSL IE. + * @retval FALSE The frame does not contain the CSL IE. + * + */ + bool IsCslIePresent(void) const { return mInfo.mTxInfo.mCslPresent; } + + /** + * Sets the CSL IE present flag. + * + * @param[in] aCslPresent TRUE if the frame contains the CSL IE. + */ + void SetCslIePresent(bool aCslPresent) { mInfo.mTxInfo.mCslPresent = aCslPresent; } + /** * Indicates whether or not the frame header is updated. * diff --git a/src/core/mac/mac_links.hpp b/src/core/mac/mac_links.hpp index 3abafd9c7..605866d18 100644 --- a/src/core/mac/mac_links.hpp +++ b/src/core/mac/mac_links.hpp @@ -186,6 +186,9 @@ public: mTxFrame802154.SetTxDelay(0); mTxFrame802154.SetTxDelayBaseTime(0); #endif +#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE + mTxFrame802154.SetCslIePresent(false); +#endif #endif #if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE mTxFrameTrel.SetLength(0); diff --git a/src/core/thread/mesh_forwarder.cpp b/src/core/thread/mesh_forwarder.cpp index a88830c4b..8b799f6aa 100644 --- a/src/core/thread/mesh_forwarder.cpp +++ b/src/core/thread/mesh_forwarder.cpp @@ -1702,12 +1702,8 @@ void MeshForwarder::AppendHeaderIe(const Message *aMessage, Mac::TxFrame &aFrame if (Get().IsCslEnabled()) { IgnoreError(aFrame.AppendHeaderIeAt(index)); - aFrame.mInfo.mTxInfo.mCslPresent = true; - iePresent = true; - } - else - { - aFrame.mInfo.mTxInfo.mCslPresent = false; + aFrame.SetCslIePresent(true); + iePresent = true; } #endif