Skip to content

Commit

Permalink
Fix a couple of compilation issues:
Browse files Browse the repository at this point in the history
* Wrap some ephemeral key API calls with `OTBR_ENABLE_EPSKC`
* Fix a small nit in `ncp_spinel.cpp` related to a dummy va_list variable being uninitialized. It causes problems with certain architectures and compiler flags, and initializing it using va_start doesn't work since it's not in a variadic function.
  • Loading branch information
suveshpratapa committed Jul 24, 2024
1 parent 2325a35 commit 44f4d62
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
12 changes: 9 additions & 3 deletions src/border_agent/border_agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -235,6 +239,7 @@ void BorderAgent::Stop(void)
UnpublishMeshCopService();
}

#if OTBR_ENABLE_EPSKC
void BorderAgent::HandleEpskcStateChanged(void *aContext)
{
BorderAgent *borderAgent = static_cast<BorderAgent *>(aContext);
Expand Down Expand Up @@ -295,6 +300,7 @@ void BorderAgent::UnpublishEpskcService()
kBorderAgentEpskcServiceType);
});
}
#endif

void BorderAgent::HandleMdnsState(Mdns::Publisher::State aState)
{
Expand Down
2 changes: 2 additions & 0 deletions src/border_agent/border_agent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/ncp/ncp_spinel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 44f4d62

Please sign in to comment.