[mle] include the CCM flag in the Discovery Response (#6800)

Commercial Commissioning Mode flag from the Security Policy has to be
set in the Discovery Response TLV of the MLE Discovery Response
messages.
This commit is contained in:
Eduardo Montoya
2021-07-08 09:51:06 -07:00
committed by GitHub
parent 0f680af4ba
commit c5790f3801
2 changed files with 34 additions and 0 deletions
+29
View File
@@ -2248,6 +2248,33 @@ public:
}
}
/**
* This method indicates whether or not the Commercial Commissioning Mode flag is set.
*
* @retval TRUE If the Commercial Commissioning Mode flag is set.
* @retval FALSE If the Commercial Commissioning Mode flag is not set.
*
*/
bool IsCommercialCommissioningMode(void) const { return (mFlags & kCCMMask) != 0; }
/**
* This method sets the Commercial Commissioning Mode flag.
*
* @param[in] aCCM TRUE if set, FALSE otherwise.
*
*/
void SetCommercialCommissioningMode(bool aCCM)
{
if (aCCM)
{
mFlags |= kCCMMask;
}
else
{
mFlags &= ~kCCMMask;
}
}
private:
enum
{
@@ -2255,6 +2282,8 @@ private:
kVersionMask = 0xf << kVersionOffset,
kNativeOffset = 3,
kNativeMask = 1 << kNativeOffset,
kCCMOffset = 2,
kCCMMask = 1 << kCCMOffset,
};
uint8_t mFlags;
uint8_t mReserved;
+5
View File
@@ -2930,6 +2930,11 @@ Error MleRouter::SendDiscoveryResponse(const Ip6::Address &aDestination, const M
discoveryResponse.SetNativeCommissioner(false);
}
if (Get<KeyManager>().GetSecurityPolicy().mCommercialCommissioningEnabled)
{
discoveryResponse.SetCommercialCommissioningMode(true);
}
SuccessOrExit(error = discoveryResponse.AppendTo(*message));
// Extended PAN ID TLV