From 60dca7fbcecdf40e611b720c42a1a72af207c3b9 Mon Sep 17 00:00:00 2001 From: Li Cao Date: Sat, 20 Sep 2025 05:35:37 +0800 Subject: [PATCH] [ncp] add netif state property change (#11950) This commit makes NCP send notification to the host when the netif state changes. At the beginning we use ThreadHost API to start the thread network on OTBR NCP which explicitly sends spinel property set command to the NCP and get response. So the host side can get the latest state of netif in the response. However if we use the cli command (`ifconfig up`) to start the thread network, we need the NCP to send a notification to the host that netif state changes. I have verified that with the change, the host can receive the update if we issue `ifconfig up` command. --- src/ncp/changed_props_set.cpp | 1 + src/ncp/ncp_base_mtd.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/ncp/changed_props_set.cpp b/src/ncp/changed_props_set.cpp index 3bd30e970..3133683ff 100644 --- a/src/ncp/changed_props_set.cpp +++ b/src/ncp/changed_props_set.cpp @@ -54,6 +54,7 @@ const ChangedPropsSet::Entry ChangedPropsSet::mSupportedProps[] = { {SPINEL_PROP_IPV6_LL_ADDR, SPINEL_STATUS_OK, true}, {SPINEL_PROP_IPV6_ML_ADDR, SPINEL_STATUS_OK, true}, {SPINEL_PROP_IPV6_ADDRESS_TABLE, SPINEL_STATUS_OK, true}, + {SPINEL_PROP_NET_IF_UP, SPINEL_STATUS_OK, true}, {SPINEL_PROP_NET_ROLE, SPINEL_STATUS_OK, true}, {SPINEL_PROP_NET_PARTITION_ID, SPINEL_STATUS_OK, true}, {SPINEL_PROP_NET_KEY_SEQUENCE_COUNTER, SPINEL_STATUS_OK, true}, diff --git a/src/ncp/ncp_base_mtd.cpp b/src/ncp/ncp_base_mtd.cpp index 728604251..c92a8f79c 100644 --- a/src/ncp/ncp_base_mtd.cpp +++ b/src/ncp/ncp_base_mtd.cpp @@ -4749,6 +4749,7 @@ void NcpBase::ProcessThreadChangedFlags(void) {OT_CHANGED_PSKC, SPINEL_PROP_NET_PSKC}, {OT_CHANGED_CHANNEL_MANAGER_NEW_CHANNEL, SPINEL_PROP_CHANNEL_MANAGER_NEW_CHANNEL}, {OT_CHANGED_SUPPORTED_CHANNEL_MASK, SPINEL_PROP_PHY_CHAN_SUPPORTED}, + {OT_CHANGED_THREAD_NETIF_STATE, SPINEL_PROP_NET_IF_UP}, {OT_CHANGED_THREAD_BACKBONE_ROUTER_STATE, SPINEL_PROP_BACKBONE_ROUTER_STATE}, };