diff --git a/src/core/mac/mac.cpp b/src/core/mac/mac.cpp index dd8d3540e..74ed3ad53 100644 --- a/src/core/mac/mac.cpp +++ b/src/core/mac/mac.cpp @@ -381,6 +381,7 @@ void Mac::SendBeaconRequest(Frame &aFrame) void Mac::SendBeacon(Frame &aFrame) { + uint8_t numUnsecurePorts; uint16_t fcf; // initialize MAC header @@ -389,6 +390,18 @@ void Mac::SendBeacon(Frame &aFrame) aFrame.SetSrcPanId(mPanId); aFrame.SetSrcAddr(mExtAddress); + // set the Joining Permitted flag + mNetif.GetIp6Filter().GetUnsecurePorts(numUnsecurePorts); + + if (numUnsecurePorts) + { + mBeacon.SetJoiningPermitted(); + } + else + { + mBeacon.ClearJoiningPermitted(); + } + // write payload memcpy(aFrame.GetPayload(), &mBeacon, sizeof(mBeacon)); aFrame.SetPayloadLength(sizeof(mBeacon));