diff --git a/src/ncp/ncp_base.cpp b/src/ncp/ncp_base.cpp index 2dfd7912d..4b0ddb4b4 100644 --- a/src/ncp/ncp_base.cpp +++ b/src/ncp/ncp_base.cpp @@ -633,6 +633,10 @@ NcpBase::NcpBase(Instance *aInstance) memset(&mResponseQueue, 0, sizeof(mResponseQueue)); +#if OPENTHREAD_ENABLE_DHCP6_CLIENT + memset(mDhcpAddresses, 0, sizeof(mDhcpAddresses)); +#endif + #if OPENTHREAD_MTD || OPENTHREAD_FTD otMessageQueueInit(&mMessageQueue); otSetStateChangedCallback(mInstance, &NcpBase::HandleStateChanged, this); diff --git a/src/ncp/ncp_base.hpp b/src/ncp/ncp_base.hpp index 0cb5d1af9..d174ba4b7 100644 --- a/src/ncp/ncp_base.hpp +++ b/src/ncp/ncp_base.hpp @@ -43,6 +43,7 @@ #if OPENTHREAD_FTD #include #endif +#include #include #include #include @@ -864,6 +865,10 @@ protected: bool mDisableStreamWrite; bool mShouldEmitChildTableUpdate; +#if OPENTHREAD_ENABLE_DHCP6_CLIENT + otDhcpAddress mDhcpAddresses[OPENTHREAD_CONFIG_NUM_DHCP_PREFIXES]; +#endif + #if OPENTHREAD_FTD #if OPENTHREAD_CONFIG_ENABLE_STEERING_DATA_SET_OOB otExtAddress mSteeringDataAddress; diff --git a/src/ncp/ncp_base_mtd.cpp b/src/ncp/ncp_base_mtd.cpp index b869472ed..605e8c50f 100644 --- a/src/ncp/ncp_base_mtd.cpp +++ b/src/ncp/ncp_base_mtd.cpp @@ -3008,6 +3008,10 @@ void NcpBase::ProcessThreadChangedFlags(void) { mChangedPropsSet.AddProperty(SPINEL_PROP_THREAD_ON_MESH_NETS); mChangedPropsSet.AddProperty(SPINEL_PROP_THREAD_OFF_MESH_ROUTES); + +#if OPENTHREAD_ENABLE_DHCP6_CLIENT + otDhcp6ClientUpdate(mInstance, mDhcpAddresses, OT_ARRAY_LENGTH(mDhcpAddresses), NULL); +#endif } mThreadChangedFlags &= ~threadFlag;