Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dgram]socket.addMembership() does not add membership to every interface #1692

Closed
tberthe opened this issue May 13, 2015 · 3 comments · Fixed by #7244
Closed

[dgram]socket.addMembership() does not add membership to every interface #1692

tberthe opened this issue May 13, 2015 · 3 comments · Fixed by #7244
Labels
dgram Issues and PRs related to the dgram subsystem / UDP.

Comments

@tberthe
Copy link

tberthe commented May 13, 2015

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).

@brendanashworth brendanashworth added the dgram Issues and PRs related to the dgram subsystem / UDP. label May 13, 2015
@Trott
Copy link
Member

Trott commented Mar 9, 2016

Any chance you know if you're still experiencing this problem or not? I suspect that if you are, that the issue is in libuv but I'm having trouble replicating. What's the Wireshark filter you are using?

@jsdario
Copy link

jsdario commented Apr 6, 2016

I am still experiencing this problem ✋

When I type deamon.addMembership('239.0.16.18') I can receive messages from the ethernet interface (with ip 172.27.64.47), however if I force it on the wlan0 one, it works deamon.addMembership('239.0.16.18', '192.168.0.1').

So by the moment I have to bind to all interfaces in a loop.

@igierard
Copy link

I also experienced this having it only bind to one interface. On windows 10. Seemed to only bind to the VirtualBox host interface.

santigimeno added a commit to santigimeno/node that referenced this issue Jul 10, 2016
Adding membership using `IP_ADD_MEMBERSHIP` with interface address set
to `INADDR_ANY` for `IPv4` or as an index of `0` for `IPv6` leads to
using only one interface selected by the operating system.

Fixes: nodejs#1692
PR-URL: nodejs#7244
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
MylesBorins pushed a commit that referenced this issue Jul 11, 2016
Adding membership using `IP_ADD_MEMBERSHIP` with interface address set
to `INADDR_ANY` for `IPv4` or as an index of `0` for `IPv6` leads to
using only one interface selected by the operating system.

Fixes: #1692
PR-URL: #7244
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
MylesBorins pushed a commit that referenced this issue Jul 12, 2016
Adding membership using `IP_ADD_MEMBERSHIP` with interface address set
to `INADDR_ANY` for `IPv4` or as an index of `0` for `IPv6` leads to
using only one interface selected by the operating system.

Fixes: #1692
PR-URL: #7244
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
MylesBorins pushed a commit that referenced this issue Jul 12, 2016
Adding membership using `IP_ADD_MEMBERSHIP` with interface address set
to `INADDR_ANY` for `IPv4` or as an index of `0` for `IPv6` leads to
using only one interface selected by the operating system.

Fixes: #1692
PR-URL: #7244
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
MylesBorins pushed a commit that referenced this issue Jul 14, 2016
Adding membership using `IP_ADD_MEMBERSHIP` with interface address set
to `INADDR_ANY` for `IPv4` or as an index of `0` for `IPv6` leads to
using only one interface selected by the operating system.

Fixes: #1692
PR-URL: #7244
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
MylesBorins pushed a commit that referenced this issue Jul 14, 2016
Adding membership using `IP_ADD_MEMBERSHIP` with interface address set
to `INADDR_ANY` for `IPv4` or as an index of `0` for `IPv6` leads to
using only one interface selected by the operating system.

Fixes: #1692
PR-URL: #7244
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
evanlucas pushed a commit that referenced this issue Jul 15, 2016
Adding membership using `IP_ADD_MEMBERSHIP` with interface address set
to `INADDR_ANY` for `IPv4` or as an index of `0` for `IPv6` leads to
using only one interface selected by the operating system.

Fixes: #1692
PR-URL: #7244
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dgram Issues and PRs related to the dgram subsystem / UDP.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants