From 392b9205bbf248c222cf55d3933891cee81fa19d Mon Sep 17 00:00:00 2001 From: Esko Dijk Date: Wed, 5 Jan 2022 20:56:53 +0100 Subject: [PATCH] [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. --- src/cli/cli.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index dae4d2d8a..8812cf7e2 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -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; }