Skip to content

Commit

Permalink
Set OffPremiseServicesReachableIPv4 and OffPremiseServicesReachableIP… (
Browse files Browse the repository at this point in the history
#15008)

* Set OffPremiseServicesReachableIPv4 and OffPremiseServicesReachableIPv6 to null if the reachable status is unknown

* Address review comments
  • Loading branch information
yufengwangca authored Feb 11, 2022
1 parent 6380d38 commit 681e9b9
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/platform/Ameba/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface **
ifp->type = EMBER_ZCL_INTERFACE_TYPE_ETHERNET;
else
ifp->type = EMBER_ZCL_INTERFACE_TYPE_WI_FI;
ifp->offPremiseServicesReachableIPv4.SetNonNull(false);
ifp->offPremiseServicesReachableIPv6.SetNonNull(false);
ifp->offPremiseServicesReachableIPv4.SetNull();
ifp->offPremiseServicesReachableIPv6.SetNull();

memcpy(ifp->MacAddress, ifa->hwaddr, sizeof(ifa->hwaddr));

Expand Down
4 changes: 2 additions & 2 deletions src/platform/EFR32/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface **
const char * threadNetworkName = otThreadGetNetworkName(ThreadStackMgrImpl().OTInstance());
ifp->name = Span<const char>(threadNetworkName, strlen(threadNetworkName));
ifp->fabricConnected = true;
ifp->offPremiseServicesReachableIPv4.SetNonNull(false);
ifp->offPremiseServicesReachableIPv6.SetNonNull(false);
ifp->offPremiseServicesReachableIPv4.SetNull();
ifp->offPremiseServicesReachableIPv6.SetNull();
ifp->type = InterfaceType::EMBER_ZCL_INTERFACE_TYPE_THREAD;
#else
/* TODO */
Expand Down
4 changes: 2 additions & 2 deletions src/platform/ESP32/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface **
ifp->name = CharSpan::fromCharString(ifp->Name);
ifp->fabricConnected = true;
ifp->type = GetInterfaceType(esp_netif_get_desc(ifa));
ifp->offPremiseServicesReachableIPv4.SetNonNull(false);
ifp->offPremiseServicesReachableIPv6.SetNonNull(false);
ifp->offPremiseServicesReachableIPv4.SetNull();
ifp->offPremiseServicesReachableIPv6.SetNull();
if (esp_netif_get_mac(ifa, ifp->MacAddress) != ESP_OK)
{
ChipLogError(DeviceLayer, "Failed to get network hardware address");
Expand Down
4 changes: 2 additions & 2 deletions src/platform/Linux/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,8 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface **
ifp->name = CharSpan::fromCharString(ifp->Name);
ifp->fabricConnected = ifa->ifa_flags & IFF_RUNNING;
ifp->type = ConnectivityUtils::GetInterfaceConnectionType(ifa->ifa_name);
ifp->offPremiseServicesReachableIPv4.SetNonNull(false);
ifp->offPremiseServicesReachableIPv6.SetNonNull(false);
ifp->offPremiseServicesReachableIPv4.SetNull();
ifp->offPremiseServicesReachableIPv6.SetNull();

if (ConnectivityUtils::GetInterfaceHardwareAddrs(ifa->ifa_name, ifp->MacAddress, kMaxHardwareAddrSize) !=
CHIP_NO_ERROR)
Expand Down
16 changes: 8 additions & 8 deletions src/platform/P6/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetBootReason(uint8_t & bootReason)
void DiagnosticDataProviderImpl::UpdateoffPremiseService(bool ipv4service, bool ipv6service)
{
/* Enable/Disable IPv4 Off Premise Services */
mipv4_offpremise = ipv4service;
mipv4_offpremise.SetNonNull(ipv4service);

/* Enable/Disable IPv6 Off Premise Services */
mipv6_offpremise = ipv6service;
mipv6_offpremise.SetNonNull(ipv6service);
}

CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface ** netifpp)
Expand All @@ -158,12 +158,12 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface **
if (net_interface)
{
/* Update Network Interface list */
ifp->name = CharSpan::fromCharString(net_interface->name);
ifp->fabricConnected = net_interface->flags & NETIF_FLAG_LINK_UP;
ifp->type = EMBER_ZCL_INTERFACE_TYPE_WI_FI;
ifp->offPremiseServicesReachableIPv4.SetNonNull(mipv4_offpremise);
ifp->offPremiseServicesReachableIPv6.SetNonNull(mipv6_offpremise);
ifp->hardwareAddress = ByteSpan(net_interface->hwaddr, net_interface->hwaddr_len);
ifp->name = CharSpan::fromCharString(net_interface->name);
ifp->fabricConnected = net_interface->flags & NETIF_FLAG_LINK_UP;
ifp->type = EMBER_ZCL_INTERFACE_TYPE_WI_FI;
ifp->offPremiseServicesReachableIPv4 = mipv4_offpremise;
ifp->offPremiseServicesReachableIPv6 = mipv6_offpremise;
ifp->hardwareAddress = ByteSpan(net_interface->hwaddr, net_interface->hwaddr_len);
}
*netifpp = ifp;

Expand Down
4 changes: 2 additions & 2 deletions src/platform/P6/DiagnosticDataProviderImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider
uint32_t mPacketUnicastTxCount = 0;
uint64_t mOverrunCount = 0;
uint8_t mWiFiMacAddress[CY_WCM_MAC_ADDR_LEN];
bool mipv4_offpremise = false;
bool mipv6_offpremise = false;
app::DataModel::Nullable<bool> mipv4_offpremise;
app::DataModel::Nullable<bool> mipv6_offpremise;
};

} // namespace DeviceLayer
Expand Down
4 changes: 2 additions & 2 deletions src/platform/Zephyr/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface **
ChipLogError(DeviceLayer, "Failed to get interface type");
}

ifp->offPremiseServicesReachableIPv4.SetNonNull(false);
ifp->offPremiseServicesReachableIPv6.SetNonNull(false);
ifp->offPremiseServicesReachableIPv4.SetNull();
ifp->offPremiseServicesReachableIPv6.SetNull();

uint8_t addressSize;
if (interfaceIterator.GetHardwareAddress(ifp->MacAddress, addressSize, sizeof(ifp->MacAddress)) != CHIP_NO_ERROR)
Expand Down

0 comments on commit 681e9b9

Please sign in to comment.