mirror of
https://github.com/espressif/openthread.git
synced 2026-07-08 13:20:25 +00:00
[dua] support to specify iid for domain unicast address (#4900)
This commit is contained in:
@@ -147,6 +147,9 @@ const struct Command Interpreter::sCommands[] = {
|
||||
#if (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
|
||||
{"domainname", &Interpreter::ProcessDomainName},
|
||||
#endif
|
||||
#if OPENTHREAD_CONFIG_DUA_ENABLE
|
||||
{"dua", &Interpreter::ProcessDua},
|
||||
#endif
|
||||
#if OPENTHREAD_FTD
|
||||
{"eidcache", &Interpreter::ProcessEidCache},
|
||||
#endif
|
||||
@@ -609,6 +612,51 @@ exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_DUA_ENABLE
|
||||
void Interpreter::ProcessDua(uint8_t aArgsLength, char *aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
VerifyOrExit(aArgsLength >= 1 && strcmp(aArgs[0], "iid") == 0, error = OT_ERROR_INVALID_COMMAND);
|
||||
|
||||
switch (aArgsLength)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
const otIp6InterfaceIdentifier *iid = otThreadGetFixedDuaInterfaceIdentifier(mInstance);
|
||||
|
||||
if (iid != NULL)
|
||||
{
|
||||
OutputBytes(iid->m8, sizeof(otIp6InterfaceIdentifier));
|
||||
mServer->OutputFormat("\r\n");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
if (strcmp(aArgs[1], "clear") == 0)
|
||||
{
|
||||
SuccessOrExit(error = otThreadSetFixedDuaInterfaceIdentifier(mInstance, NULL));
|
||||
}
|
||||
else
|
||||
{
|
||||
otIp6InterfaceIdentifier iid;
|
||||
|
||||
VerifyOrExit(Hex2Bin(aArgs[1], iid.m8, sizeof(otIp6InterfaceIdentifier)) ==
|
||||
sizeof(otIp6InterfaceIdentifier),
|
||||
error = OT_ERROR_INVALID_ARGS);
|
||||
SuccessOrExit(error = otThreadSetFixedDuaInterfaceIdentifier(mInstance, &iid));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
error = OT_ERROR_INVALID_ARGS;
|
||||
break;
|
||||
}
|
||||
|
||||
exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_DUA_ENABLE
|
||||
|
||||
#endif // (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
|
||||
|
||||
void Interpreter::ProcessBufferInfo(uint8_t aArgsLength, char *aArgs[])
|
||||
|
||||
Reference in New Issue
Block a user