mirror of
https://github.com/espressif/openthread.git
synced 2026-10-01 21:37:39 +00:00
[border-agent] apply pskc if changed (#10641)
This commit applies new pskc into secure transport when it's changed via active/pending dataset, without impacting existing secure session if any or ephemeralkey mode if it's activated
This commit is contained in:
@@ -308,19 +308,41 @@ exit:
|
|||||||
|
|
||||||
void BorderAgent::HandleNotifierEvents(Events aEvents)
|
void BorderAgent::HandleNotifierEvents(Events aEvents)
|
||||||
{
|
{
|
||||||
VerifyOrExit(aEvents.ContainsAny(kEventThreadRoleChanged | kEventCommissionerStateChanged));
|
if ((aEvents.ContainsAny(kEventThreadRoleChanged | kEventCommissionerStateChanged)))
|
||||||
|
{
|
||||||
#if OPENTHREAD_CONFIG_COMMISSIONER_ENABLE && OPENTHREAD_FTD
|
#if OPENTHREAD_CONFIG_COMMISSIONER_ENABLE && OPENTHREAD_FTD
|
||||||
VerifyOrExit(Get<Commissioner>().IsDisabled());
|
VerifyOrExit(Get<Commissioner>().IsDisabled());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (Get<Mle::MleRouter>().IsAttached())
|
if (Get<Mle::MleRouter>().IsAttached())
|
||||||
{
|
{
|
||||||
Start();
|
Start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (aEvents.ContainsAny(kEventPskcChanged))
|
||||||
{
|
{
|
||||||
Stop();
|
VerifyOrExit(mState != kStateStopped);
|
||||||
|
|
||||||
|
#if OPENTHREAD_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ENABLE
|
||||||
|
// No-op if Ephemeralkey mode is activated, new pskc will be applied
|
||||||
|
// when Ephemeralkey mode is deactivated.
|
||||||
|
VerifyOrExit(!mUsingEphemeralKey);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
{
|
||||||
|
Pskc pskc;
|
||||||
|
Get<KeyManager>().GetPskc(pskc);
|
||||||
|
|
||||||
|
// If there is secure session already established, it won't be impacted,
|
||||||
|
// new pskc will be applied for next connection.
|
||||||
|
SuccessOrExit(Get<Tmf::SecureAgent>().SetPsk(pskc.m8, Pskc::kSize));
|
||||||
|
pskc.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|||||||
Reference in New Issue
Block a user