diff --git a/Test/Components/DataSources/UDPStreamer/UDPStreamerTest.cpp b/Test/Components/DataSources/UDPStreamer/UDPStreamerTest.cpp index 279d868..819ff35 100644 --- a/Test/Components/DataSources/UDPStreamer/UDPStreamerTest.cpp +++ b/Test/Components/DataSources/UDPStreamer/UDPStreamerTest.cpp @@ -1559,6 +1559,7 @@ bool UDPStreamerTest::TestInitialise_MulticastMode_Valid() { ConfigurationDatabase cdb; cdb.Write("Port", 44710u); cdb.Write("MulticastGroup", "239.0.0.1"); + cdb.Write("Interface", "127.0.0.1"); cdb.Write("DataPort", 44711u); cdb.CreateRelative("Signals"); cdb.MoveToRoot(); @@ -1574,6 +1575,7 @@ bool UDPStreamerTest::TestInitialise_MulticastMode_DefaultDataPort() { ConfigurationDatabase cdb; cdb.Write("Port", 44712u); cdb.Write("MulticastGroup", "239.0.0.1"); + cdb.Write("Interface", "127.0.0.1"); /* DataPort intentionally omitted: should default to 44713 */ cdb.CreateRelative("Signals"); cdb.MoveToRoot(); @@ -1588,6 +1590,9 @@ bool UDPStreamerTest::TestInitialise_MulticastMode_InvalidDataPort() { ConfigurationDatabase cdb; cdb.Write("Port", 44714u); cdb.Write("MulticastGroup", "239.0.0.1"); + /* Interface is mandatory for multicast; supply it so the rejection below + * is provably caused by DataPort == Port and not by a missing Interface. */ + cdb.Write("Interface", "127.0.0.1"); cdb.Write("DataPort", 44714u); /* same as Port — must be rejected */ cdb.CreateRelative("Signals"); cdb.MoveToRoot(); @@ -1618,6 +1623,7 @@ bool UDPStreamerTest::TestPrepareNextState_Multicast() { " Class = UDPStreamer\n" " Port = 44716\n" " MulticastGroup = \"239.0.0.1\"\n" + " Interface = \"127.0.0.1\"\n" " DataPort = 44717\n" " MaxPayloadSize = 1400\n" " Signals = {\n" @@ -1695,6 +1701,7 @@ bool UDPStreamerTest::TestExecute_MulticastConnectDataDisconnect() { " Class = UDPStreamer\n" " Port = 44720\n" " MulticastGroup = \"239.0.0.1\"\n" + " Interface = \"127.0.0.1\"\n" " DataPort = 44721\n" " MaxPayloadSize = 1400\n" " Signals = {\n" @@ -1786,7 +1793,12 @@ bool UDPStreamerTest::TestExecute_MulticastConnectDataDisconnect() { ok = mcastReader.Listen(44721u); } if (ok) { - ok = mcastReader.Join("239.0.0.1"); + /* Join on the same interface the streamer sends from (Interface = + * 127.0.0.1 sets IP_MULTICAST_IF on the server's data socket). The + * single-argument Join() would pass INADDR_ANY, letting the kernel + * pick the default-route interface, and the datagram would never + * reach this socket. */ + ok = mcastReader.Join("239.0.0.1", "127.0.0.1"); } /* Step 4: Trigger Synchronise() to generate a DATA packet */