Description
I have 3 network interfaces on my computer (2 ethernet + 1 virtual for VirtualBox) connected to different independent networks.
With Wireshark I inspected the packets generated when calling socket.addMembership() without specifying a multicast interface and I noticed the Membership Report / Join group
request is only sent on 1 interface (the default route) but not on the others.
Here is a simple program demonstrating the problem:
var dgram = require('dgram');
var s = dgram.createSocket('udp4');
var MULTICAST_IP = "225.0.0.1"
s.bind(8001, function() {
s.addMembership(MULTICAST_IP);
console.log("listening on all addresses");
});
s.on("message", function (msg, rinfo) {
console.log("server got: " + msg + " from " +
rinfo.address + ":" + rinfo.port);
});
But if I specify every interface when calling socket.addMembership()
, the proper Membership Report / Join group
requests are sent and the multicast messages sent on any network is received.
Both network interfaces are up and support broadcast and multicast, they have the following IP:
-enp2s0: 10.80.10.28 (default route)
-enp6s0: 172.20.3.26
-virbr0: 192.168.122.1 (NAT / virtual box)
The problem has been reproduced with io.js 1.6.4 and 2.0.1 (linux x64).