Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ethernet network enable. #10311

Merged
merged 1 commit into from
Oct 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1855,8 +1855,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 @@ -1871,6 +1871,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 @@ -1999,18 +2000,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