diff --git a/src/border_agent/border_agent.cpp b/src/border_agent/border_agent.cpp index addb64ecfee..d1ce1a4365c 100644 --- a/src/border_agent/border_agent.cpp +++ b/src/border_agent/border_agent.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -157,12 +158,14 @@ BorderAgent::BorderAgent(otbr::Ncp::RcpHost &aHost, Mdns::Publisher &aPublisher) : mHost(aHost) , mPublisher(aPublisher) , mIsEnabled(false) - , mIsEphemeralKeyEnabled(false) + , mIsEphemeralKeyEnabled(OTBR_CONFIG_BORDER_AGENT_EPHEMERAL_KEY_ON_INIT) , mVendorName(OTBR_VENDOR_NAME) , mProductName(OTBR_PRODUCT_NAME) , mBaseServiceInstanceName(OTBR_MESHCOP_SERVICE_INSTANCE_NAME) { mHost.AddThreadStateChangedCallback([this](otChangedFlags aFlags) { HandleThreadStateChanged(aFlags); }); + mIsEphemeralKeyEnabled = (otThreadGetVersion() >= OT_THREAD_VERrSION_1_4); + otbrLogInfo("Ephemeral Key is: %s during initialization", (mIsEphemeralKeyEnabled ? "enabled" : "disabled")); } otbrError BorderAgent::SetMeshCopServiceValues(const std::string &aServiceInstanceName,