tests: fix UDP multicast transport tests with IPv6
A valid scope id is always required on the multicast address
Change-Id: Ic676fcde0ee50daf75eb38c137e3cb917f43699f
diff --git a/tests/daemon/face/multicast-udp-transport-fixture.hpp b/tests/daemon/face/multicast-udp-transport-fixture.hpp
index 959ca9c..4c984f4 100644
--- a/tests/daemon/face/multicast-udp-transport-fixture.hpp
+++ b/tests/daemon/face/multicast-udp-transport-fixture.hpp
@@ -32,6 +32,7 @@
#include "tests/test-common.hpp"
#include "tests/daemon/limited-io.hpp"
#include "tests/daemon/face/dummy-link-service.hpp"
+#include "tests/daemon/face/transport-test-common.hpp"
namespace nfd::tests {
@@ -43,7 +44,7 @@
{
protected:
void
- initialize(ip::address address)
+ initialize(const shared_ptr<const ndn::net::NetworkInterface>& netif, const ip::address& address)
{
ip::address mcastAddr;
if (address.is_v4()) {
@@ -53,19 +54,19 @@
else {
// the group FF0X::114 is reserved for experimentation at all scope levels (RFC 4727)
auto v6Addr = ip::address_v6::from_string("FF01::114");
- v6Addr.scope_id(address.to_v6().scope_id());
+ v6Addr.scope_id(netif->getIndex());
mcastAddr = v6Addr;
}
mcastEp = udp::endpoint(mcastAddr, 7373);
remoteMcastEp = udp::endpoint(mcastAddr, 8383);
MulticastUdpTransport::openRxSocket(remoteSockRx, mcastEp, address);
- MulticastUdpTransport::openTxSocket(remoteSockTx, udp::endpoint(address, 0), nullptr, true);
+ MulticastUdpTransport::openTxSocket(remoteSockTx, udp::endpoint(address, 0), &*netif, true);
udp::socket sockRx(g_io);
udp::socket sockTx(g_io);
MulticastUdpTransport::openRxSocket(sockRx, remoteMcastEp, address);
- MulticastUdpTransport::openTxSocket(sockTx, udp::endpoint(address, txPort), nullptr, true);
+ MulticastUdpTransport::openTxSocket(sockTx, udp::endpoint(address, txPort), &*netif, true);
face = make_unique<Face>(make_unique<DummyLinkService>(),
make_unique<MulticastUdpTransport>(mcastEp, std::move(sockRx), std::move(sockTx),