face: Connect faces to the parent (unicast) or associated (multicast) channels
Change-Id: Ie7b2e8fb60050a2bc6e4f5ad053c26e121f3c3d5
Refs: #4973
diff --git a/daemon/face/udp-factory.cpp b/daemon/face/udp-factory.cpp
index b15b762..993f61a 100644
--- a/daemon/face/udp-factory.cpp
+++ b/daemon/face/udp-factory.cpp
@@ -362,6 +362,13 @@
m_mcastFaces[localEp] = face;
connectFaceClosedSignal(*face, [this, localEp] { m_mcastFaces.erase(localEp); });
+ // Associate with the first available channel of the same protocol family
+ auto channelIt = std::find_if(m_channels.begin(), m_channels.end(),
+ [isV4 = localEp.address().is_v4()] (const auto& it) {
+ return it.first.address().is_v4() == isV4;
+ });
+ face->setChannel(channelIt != m_channels.end() ? channelIt->second : nullptr);
+
return face;
}