Only report multicast failures of none of the local interfaces send successfully.
On iOS, `sendmsg` succeeds on only one of the local interfaces when multicasting to an IPv6 address, the others fail with `EINVAL`. This **does not** address the root cause but just ignores the error if any one of the `sendmsg` calls succeed.
diff --git a/src/lib/core/WeaveMessageLayer.cpp b/src/lib/core/WeaveMessageLayer.cpp
index 5393077..d259978 100644
--- a/src/lib/core/WeaveMessageLayer.cpp
+++ b/src/lib/core/WeaveMessageLayer.cpp
@@ -642,7 +642,9 @@
case kMulticast_AllInterfaces:
- // Send the message over each local interface that supports multicast.
+ // Send the message over each local interface that supports multicast, only report an error
+ // if *none* of the interfaces succeed (b/195258416).
+ err = 0xFF;
for (InterfaceIterator intfIter; intfIter.HasCurrent(); intfIter.Next())
{
if (intfIter.SupportsMulticast())
@@ -650,7 +652,7 @@
pktInfo.Interface = intfIter.GetInterface();
WEAVE_ERROR sendErr = ep->SendMsg(&pktInfo, payload, UDPEndPoint::kSendFlag_RetainBuffer);
CheckForceRefreshUDPEndPointsNeeded(sendErr);
- if (err == WEAVE_NO_ERROR)
+ if (err != WEAVE_NO_ERROR)
{
err = FilterUDPSendError(sendErr, true);
}
@@ -664,6 +666,8 @@
// Send the message once for each Weave Fabric ULA assigned to a local interface that supports
// multicast/broadcast. If the caller has specified a particular interface, only send over the
// specified interface. For each message sent, arrange for the source address to be the Fabric ULA.
+ // Only report an error if *none* of the interfaces succeed (b/195258416).
+ err = 0xFF;
for (InterfaceAddressIterator addrIter; addrIter.HasCurrent(); addrIter.Next())
{
pktInfo.SrcAddress = addrIter.GetAddress();
@@ -674,7 +678,7 @@
{
WEAVE_ERROR sendErr = ep->SendMsg(&pktInfo, payload, UDPEndPoint::kSendFlag_RetainBuffer);
CheckForceRefreshUDPEndPointsNeeded(sendErr);
- if (err == WEAVE_NO_ERROR)
+ if (err != WEAVE_NO_ERROR)
{
err = FilterUDPSendError(sendErr, true);
}