[cli] support 1 or more mcast addresses for ipmaddr add command (#7253)

Because the 2 addresses are registered sequentially from the same
method call, the OpenThread stack will not have had the opportunity to
send out MLR.req with a single address. So this should result in
sending out one MLR.req with two addresses inside, if 2 addresses are
provided.  Without changes in the APIs.
This commit is contained in:
Esko Dijk
2022-01-05 11:56:53 -08:00
committed by GitHub
parent a04a68b51b
commit 392b9205bb
+10 -2
View File
@@ -2132,12 +2132,20 @@ exit:
otError Interpreter::ProcessIpMulticastAddrAdd(Arg aArgs[])
{
otError error;
otIp6Address address;
#if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
otError error = OT_ERROR_INVALID_ARGS;
for (Arg *arg = &aArgs[0]; !arg->IsEmpty(); arg++)
{
SuccessOrExit(error = arg->ParseAsIp6Address(address));
SuccessOrExit(error = otIp6SubscribeMulticastAddress(GetInstancePtr(), &address));
}
#else
otError error;
SuccessOrExit(error = aArgs[0].ParseAsIp6Address(address));
error = otIp6SubscribeMulticastAddress(GetInstancePtr(), &address);
#endif
exit:
return error;
}