From bfae1d497b27cdeb43531243c373a60a9589cd4a Mon Sep 17 00:00:00 2001 From: Yuzhuo Yang Date: Fri, 9 Aug 2024 12:02:57 +0000 Subject: [PATCH] [epskc] set ePSKc init status according to otversion --- src/border_agent/border_agent.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/border_agent/border_agent.cpp b/src/border_agent/border_agent.cpp index addb64ecfee..ea7d08ea79b 100644 --- a/src/border_agent/border_agent.cpp +++ b/src/border_agent/border_agent.cpp @@ -77,6 +77,11 @@ static const char kBorderAgentServiceType[] = "_meshcop._udp"; ///< Bo static const char kBorderAgentEpskcServiceType[] = "_meshcop-e._udp"; ///< Border agent ePSKc service static constexpr int kBorderAgentServiceDummyPort = 49152; +static const uint16_t kThreadVersion11 = 2; ///< Thread Version 1.1 +static const uint16_t kThreadVersion12 = 3; ///< Thread Version 1.2 +static const uint16_t kThreadVersion13 = 4; ///< Thread Version 1.3 +static const uint16_t kThreadVersion14 = 5; ///< Thread Version 1.4 + /** * Locators * @@ -163,6 +168,9 @@ BorderAgent::BorderAgent(otbr::Ncp::RcpHost &aHost, Mdns::Publisher &aPublisher) , mBaseServiceInstanceName(OTBR_MESHCOP_SERVICE_INSTANCE_NAME) { mHost.AddThreadStateChangedCallback([this](otChangedFlags aFlags) { HandleThreadStateChanged(aFlags); }); + mIsEphemeralKeyEnabled = (otThreadGetVersion() >= kThreadVersion14); + otbrLogInfo("otVersion:%d, IsEphemeralKeyEnabled:%d during initialization", otThreadGetVersion(), + mIsEphemeralKeyEnabled); } otbrError BorderAgent::SetMeshCopServiceValues(const std::string &aServiceInstanceName,