[dataset] only master key is needed to attach (#4051)

This commit is contained in:
Jonathan Hui
2019-08-05 09:02:25 -07:00
committed by GitHub
parent 2eab474025
commit af573f5e72
10 changed files with 18 additions and 23 deletions
+1 -3
View File
@@ -82,13 +82,11 @@ $ cd <path-to-openthread>/output/<platform>/bin
$ ./ot-cli-ftd 2 $ ./ot-cli-ftd 2
``` ```
Configure Thread Master Key and PAN ID from Node 1's Active Operational Dataset: Configure Thread Master Key from Node 1's Active Operational Dataset:
```bash ```bash
> dataset masterkey dfd34f0f05cad978ec4e32b0413038ff > dataset masterkey dfd34f0f05cad978ec4e32b0413038ff
Done Done
> dataset panid 0x8f28
Done
> dataset commit active > dataset commit active
Done Done
``` ```
-2
View File
@@ -210,8 +210,6 @@ Click the Flash button located under the Browse... button.
```bash ```bash
> dataset masterkey dfd34f0f05cad978ec4e32b0413038ff > dataset masterkey dfd34f0f05cad978ec4e32b0413038ff
Done Done
> dataset panid 0x8f28
Done
> dataset commit active > dataset commit active
Done Done
> routerselectionjitter 1 > routerselectionjitter 1
-2
View File
@@ -97,8 +97,6 @@ The [NXP(Freescale) Test Tool][test-tool] provides a convenient method for flash
```bash ```bash
> dataset masterkey dfd34f0f05cad978ec4e32b0413038ff > dataset masterkey dfd34f0f05cad978ec4e32b0413038ff
Done Done
> dataset panid 0x8f28
Done
> dataset commit active > dataset commit active
Done Done
> ifconfig up > ifconfig up
-2
View File
@@ -205,8 +205,6 @@ To test the example:
```bash ```bash
> dataset masterkey dfd34f0f05cad978ec4e32b0413038ff > dataset masterkey dfd34f0f05cad978ec4e32b0413038ff
Done Done
> dataset panid 0x8f28
Done
> dataset commit active > dataset commit active
Done Done
> ifconfig up > ifconfig up
-2
View File
@@ -235,8 +235,6 @@ To test the example:
```bash ```bash
> dataset masterkey dfd34f0f05cad978ec4e32b0413038ff > dataset masterkey dfd34f0f05cad978ec4e32b0413038ff
Done Done
> dataset panid 0x8f28
Done
> dataset commit active > dataset commit active
Done Done
> ifconfig up > ifconfig up
-2
View File
@@ -158,8 +158,6 @@ $ (gdb) c
```bash ```bash
> dataset masterkey dfd34f0f05cad978ec4e32b0413038ff > dataset masterkey dfd34f0f05cad978ec4e32b0413038ff
Done Done
> dataset panid 0x8f28
Done
> dataset commit active > dataset commit active
Done Done
> routerselectionjitter 1 > routerselectionjitter 1
+2 -2
View File
@@ -309,8 +309,8 @@ otError otDatasetGetActive(otInstance *aInstance, otOperationalDataset *aDataset
* If the dataset does not include an Active Timestamp, the dataset is only partially complete. * If the dataset does not include an Active Timestamp, the dataset is only partially complete.
* *
* If Thread is enabled on a device that has a partially complete Active Dataset, the device will attempt to attach to * If Thread is enabled on a device that has a partially complete Active Dataset, the device will attempt to attach to
* an existing Thread network using any existing information in the dataset. The minimum set of information needed to * an existing Thread network using any existing information in the dataset. Only the Thread Master Key is needed to
* attach is the PAN ID and Thread Master Key. * attach to a network.
* *
* If channel is not included in the dataset, the device will send MLE Announce messages across different channels to * If channel is not included in the dataset, the device will send MLE Announce messages across different channels to
* find neighbors on other channels. * find neighbors on other channels.
+1 -6
View File
@@ -66,10 +66,7 @@ The Pending Operational Dataset is used to communicate changes to the Active Ope
### Attach to Existing Network ### Attach to Existing Network
The minimum set of parameters required for a device to attach a Thread network are: Only the Master Key is required for a device to attach to a Thread network.
* Master Key
* PAN ID
While not required, specifying the channel avoids the need to search across multiple channels, improving both latency and efficiency of the attach process. While not required, specifying the channel avoids the need to search across multiple channels, improving both latency and efficiency of the attach process.
@@ -78,8 +75,6 @@ After the device successfully attaches to a Thread network, the device will retr
1. Create a partial Active Operational Dataset. 1. Create a partial Active Operational Dataset.
```bash ```bash
> dataset panid 0x8f28
Done
> dataset masterkey dfd34f0f05cad978ec4e32b0413038ff > dataset masterkey dfd34f0f05cad978ec4e32b0413038ff
Done Done
> dataset commit active > dataset commit active
-2
View File
@@ -405,7 +405,6 @@ otError otThreadSetEnabled(otInstance *aInstance, bool aEnabled)
if (aEnabled) if (aEnabled)
{ {
VerifyOrExit(instance.Get<Mac::Mac>().GetPanId() != Mac::kPanIdBroadcast, error = OT_ERROR_INVALID_STATE);
error = instance.Get<Mle::MleRouter>().Start(/* aAnnounceAttach */ false); error = instance.Get<Mle::MleRouter>().Start(/* aAnnounceAttach */ false);
} }
else else
@@ -413,7 +412,6 @@ otError otThreadSetEnabled(otInstance *aInstance, bool aEnabled)
instance.Get<Mle::MleRouter>().Stop(true); instance.Get<Mle::MleRouter>().Stop(true);
} }
exit:
return error; return error;
} }
+14
View File
@@ -243,6 +243,20 @@ otError Mle::Start(bool aAnnounceAttach)
VerifyOrExit(!otPlatRadioGetPromiscuous(&GetInstance()), error = OT_ERROR_INVALID_STATE); VerifyOrExit(!otPlatRadioGetPromiscuous(&GetInstance()), error = OT_ERROR_INVALID_STATE);
VerifyOrExit(Get<ThreadNetif>().IsUp(), error = OT_ERROR_INVALID_STATE); VerifyOrExit(Get<ThreadNetif>().IsUp(), error = OT_ERROR_INVALID_STATE);
if (Get<Mac::Mac>().GetPanId() == Mac::kPanIdBroadcast)
{
// if PAN ID is not configured, pick a random one to start
uint16_t panid;
do
{
panid = Random::NonCrypto::GetUint16();
} while (panid == Mac::kPanIdBroadcast);
Get<Mac::Mac>().SetPanId(panid);
}
SetStateDetached(); SetStateDetached();
ApplyMeshLocalPrefix(); ApplyMeshLocalPrefix();