Skip to content

Commit

Permalink
Remove ethernet network enable. (#10311)
Browse files Browse the repository at this point in the history
  • Loading branch information
cecille authored and pull[bot] committed Oct 22, 2021
1 parent f51cc06 commit 6bae5fa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,6 @@ EmberAfNetworkCommissioningError OnEnableNetworkCommandCallbackInternal(app::Com
{
size_t networkSeq;
EmberAfNetworkCommissioningError err = EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_NETWORK_ID_NOT_FOUND;
// TODO(cecille): This is very dangerous - need to check against real netif name, ensure no password.
constexpr char ethernetNetifMagicCode[] = "ETH0";
if (networkID.size() == sizeof(ethernetNetifMagicCode) &&
memcmp(networkID.data(), ethernetNetifMagicCode, networkID.size()) == 0)
{
ChipLogProgress(Zcl, "Wired network enabling requested. Assuming success.");
ExitNow(err = EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_SUCCESS);
}

for (networkSeq = 0; networkSeq < kMaxNetworks; networkSeq++)
{
Expand Down
19 changes: 5 additions & 14 deletions src/controller/CHIPDeviceController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1851,8 +1851,8 @@ CommissioningStage DeviceCommissioner::GetNextCommissioningStage()
case CommissioningStage::kDeviceAttestation:
return CommissioningStage::kCheckCertificates;
case CommissioningStage::kCheckCertificates:
return CommissioningStage::kNetworkEnable; // TODO : for softAP, this needs to be network setup
case CommissioningStage::kNetworkEnable:
// For thread and wifi, this should go to network setup then enable. For on-network we can skip right to finding the
// operational network because the provisioning of certificates will trigger the device to start operational advertising.
#if CHIP_DEVICE_CONFIG_ENABLE_MDNS
return CommissioningStage::kFindOperational; // TODO : once case is working, need to add stages to find and reconnect
// here.
Expand All @@ -1867,6 +1867,7 @@ CommissioningStage DeviceCommissioner::GetNextCommissioningStage()
// Currently unimplemented.
case CommissioningStage::kConfigACL:
case CommissioningStage::kNetworkSetup:
case CommissioningStage::kNetworkEnable:
case CommissioningStage::kScanNetworks:
return CommissioningStage::kError;
// Neither of these have a next stage so return kError;
Expand Down Expand Up @@ -1995,18 +1996,8 @@ void DeviceCommissioner::AdvanceCommissioningStage(CHIP_ERROR err)
break;
case CommissioningStage::kNetworkEnable: {
ChipLogProgress(Controller, "Enabling Network");
// TODO: For ethernet, we actually need a scan stage to get the ethernet netif name. Right now, default to using a magic
// value to enable without checks.
NetworkCommissioningCluster netCom;
// TODO: should get the endpoint information from the descriptor cluster.
netCom.Associate(device, 0);
// TODO: Once network credential sending is implemented, attempting to set wifi credential on an ethernet only device
// will cause an error to be sent back. At that point, we should scan and we shoud see the proper ethernet network ID
// returned in the scan results. For now, we use magic.
char magicNetworkEnableCode[] = "ETH0";
netCom.EnableNetwork(mSuccess.Cancel(), mFailure.Cancel(),
ByteSpan(reinterpret_cast<uint8_t *>(&magicNetworkEnableCode), sizeof(magicNetworkEnableCode)),
breadcrumb, kCommandTimeoutMs);
// For on-network, this is a NO-OP becuase we now start operational advertising once credentials are provisioned.
// This is a placeholder for thread and wifi networks once that is implemented.
}
break;
case CommissioningStage::kFindOperational: {
Expand Down

0 comments on commit 6bae5fa

Please sign in to comment.