Files
UA-.NETStandard/tests
MarcandCopilot 60945ce559 Send UDP multicast on the network interface the transport joins
UdpDatagramTransport joined multicast groups on the resolved network
interface (the connection address's NetworkInterface, the
PreferredNetworkInterface option, or the first operational interface), but
it never set IP_MULTICAST_IF / IPV6_MULTICAST_IF. Multicast data and
discovery announcements therefore left through the operating system's
default multicast route. On a computer with several network interfaces, a
publisher configured for one network sent on another, and subscribers on
the configured network missed the messages (OPC 10000-14 7.3.2.2,
NetworkAddressDataType.NetworkInterface).

ConfigureSocket now sets the multicast send interface to the resolved
interface for IPv4 and IPv6 sockets, including the separate socket that
sends discovery announcements for loopback-bound connections. A failure is
logged at Debug level, like the other socket options.

Behavior change: without a configured interface, multicast now leaves
through the first operational non-loopback interface, which is the
interface that subscribers join on, instead of the default multicast route.

Tests (UdpDatagramTransportMulticastInterfaceTests):
- The IPv4 and IPv6 egress options equal the resolved interface. Before the
  fix they were 0.0.0.0 and 0.
- A publisher and subscriber pinned to the loopback interface exchange a
  payload; a raw control sender distinguishes a host without loopback
  multicast from a publisher that sends elsewhere. Red on Linux before the
  fix. Windows also delivers local copies sent on other interfaces, so there
  the test only confirms the exchange.

Validation: Opc.Ua.PubSub.Udp.Tests net10.0 237/237 (Windows and a Linux
container), net48 232/232; Opc.Ua.PubSub.Tests net10.0 1490 passed,
1 skipped; Release build of Opc.Ua.PubSub.Udp for all target frameworks
with 0 warnings. The one-computer exchange in docs/PubSub.md delivers
DataSets with the documented warning once, verified together with the
separate sample KeyNonce fix that master currently needs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-09 12:20:52 +02:00
..