mirror of
https://github.com/espressif/openthread.git
synced 2026-08-04 01:47:47 +00:00
[cli] add command to set mesh-local prefix (#7663)
Also add an expect test for getting/setting mesh-local prefix.
This commit is contained in:
@@ -2177,6 +2177,15 @@ fdde:ad00:beef:0::/64
|
||||
Done
|
||||
```
|
||||
|
||||
### prefix meshlocal <prefix>
|
||||
|
||||
Set the mesh local prefix.
|
||||
|
||||
```bash
|
||||
> prefix meshlocal fdde:ad00:beef:0::/64
|
||||
Done
|
||||
```
|
||||
|
||||
### prefix remove \<prefix\>
|
||||
|
||||
Invalidate a prefix in the Network Data.
|
||||
|
||||
+13
-1
@@ -3564,7 +3564,19 @@ template <> otError Interpreter::Process<Cmd("prefix")>(Arg aArgs[])
|
||||
}
|
||||
else if (aArgs[0] == "meshlocal")
|
||||
{
|
||||
OutputIp6PrefixLine(*otThreadGetMeshLocalPrefix(GetInstancePtr()));
|
||||
if (aArgs[1].IsEmpty())
|
||||
{
|
||||
OutputIp6PrefixLine(*otThreadGetMeshLocalPrefix(GetInstancePtr()));
|
||||
}
|
||||
else
|
||||
{
|
||||
otIp6Prefix prefix;
|
||||
|
||||
SuccessOrExit(error = aArgs[1].ParseAsIp6Prefix(prefix));
|
||||
VerifyOrExit(prefix.mLength == OT_IP6_PREFIX_BITSIZE, error = OT_ERROR_INVALID_ARGS);
|
||||
error =
|
||||
otThreadSetMeshLocalPrefix(GetInstancePtr(), reinterpret_cast<otMeshLocalPrefix *>(&prefix.mPrefix));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -180,6 +180,13 @@ expect "Done"
|
||||
send "ba state\n"
|
||||
expect "Done"
|
||||
|
||||
send "prefix meshlocal fd00:dead:beef:cafe::/96\n"
|
||||
expect_line "Error 7: InvalidArgs"
|
||||
send "prefix meshlocal fd00:dead:beef:cafe::/64\n"
|
||||
expect_line "Done"
|
||||
send "prefix meshlocal\n"
|
||||
expect_line "fd00:dead:beef:cafe::/64"
|
||||
|
||||
send "invalidcommand\n"
|
||||
expect_line "Error 35: InvalidCommand"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user