diff --git a/src/border_agent/border_agent.cpp b/src/border_agent/border_agent.cpp index f8a1e0fc218..4b22fd0dd22 100644 --- a/src/border_agent/border_agent.cpp +++ b/src/border_agent/border_agent.cpp @@ -69,9 +69,11 @@ namespace otbr { -static const char kBorderAgentServiceType[] = "_meshcop._udp"; ///< Border agent service type of mDNS -static const char kBorderAgentEpskcServiceType[] = "_meshcop-e._udp"; ///< Border agent ePSKc service -static constexpr int kBorderAgentServiceDummyPort = 49152; +static const char kBorderAgentServiceType[] = "_meshcop._udp"; ///< Border agent service type of mDNS +#if OTBR_ENABLE_EPSKC +static const char kBorderAgentEpskcServiceType[] = "_meshcop-e._udp"; ///< Border agent ePSKc service +#endif +static constexpr int kBorderAgentServiceDummyPort = 49152; /** * Locators @@ -226,7 +228,9 @@ void BorderAgent::Start(void) mServiceInstanceName = GetServiceInstanceNameWithExtAddr(mBaseServiceInstanceName); UpdateMeshCopService(); +#if OTBR_ENABLE_EPSKC otBorderAgentSetEphemeralKeyCallback(mHost.GetInstance(), BorderAgent::HandleEpskcStateChanged, this); +#endif } void BorderAgent::Stop(void) @@ -235,6 +239,7 @@ void BorderAgent::Stop(void) UnpublishMeshCopService(); } +#if OTBR_ENABLE_EPSKC void BorderAgent::HandleEpskcStateChanged(void *aContext) { BorderAgent *borderAgent = static_cast(aContext); @@ -295,6 +300,7 @@ void BorderAgent::UnpublishEpskcService() kBorderAgentEpskcServiceType); }); } +#endif void BorderAgent::HandleMdnsState(Mdns::Publisher::State aState) { diff --git a/src/border_agent/border_agent.hpp b/src/border_agent/border_agent.hpp index 58f84a058a9..5cf42317956 100644 --- a/src/border_agent/border_agent.hpp +++ b/src/border_agent/border_agent.hpp @@ -151,9 +151,11 @@ class BorderAgent : private NonCopyable std::string GetServiceInstanceNameWithExtAddr(const std::string &aServiceInstanceName) const; std::string GetAlternativeServiceInstanceName() const; +#if OTBR_ENABLE_EPSKC static void HandleEpskcStateChanged(void *aContext); void PublishEpskcService(void); void UnpublishEpskcService(void); +#endif otbr::Ncp::RcpHost &mHost; Mdns::Publisher &mPublisher; diff --git a/src/ncp/ncp_spinel.cpp b/src/ncp/ncp_spinel.cpp index 21a1952778f..685bbcd8c2c 100644 --- a/src/ncp/ncp_spinel.cpp +++ b/src/ncp/ncp_spinel.cpp @@ -69,9 +69,10 @@ void NcpSpinel::GetDeviceRole(GetDeviceRoleHandler aHandler) { otError error = OT_ERROR_NONE; spinel_tid_t tid = GetNextTid(); - va_list args; + va_list args = {}; error = mSpinelDriver->SendCommand(SPINEL_CMD_PROP_VALUE_GET, SPINEL_PROP_NET_ROLE, tid, nullptr, args); + if (error != OT_ERROR_NONE) { FreeTid(tid);