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

Error: getaddrinfo ENOTFOUND ff05::2:1001%br-client #2073

Closed
anoymouserver opened this issue Jul 24, 2019 · 4 comments
Closed

Error: getaddrinfo ENOTFOUND ff05::2:1001%br-client #2073

anoymouserver opened this issue Jul 24, 2019 · 4 comments

Comments

@anoymouserver
Copy link

If I send to an udp6 dgram socket on the IPv6 multicast address ff05::2:1001 (site-local) I get the following error. But sending to ff02::2:1001 (link-local) works without any problems.

{ Error: getaddrinfo ENOTFOUND ff05::2:1001%br-client
     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:26)
  errno: 'ENOTFOUND',
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'ff05::2:1001%br-client' }

Do you have any idea what causes the error and how it could be resolved?

Full source code: hopglass-server/modules/receiver/announced.js#L80
Excerpt with the error output:

  var collector = dgram.createSocket('udp6')
  // [...]
  var req = Buffer.from('GET ' + stat)
  collector.setMulticastInterface('ff05::2:1001%br-client')
  collector.send(req, 0, req.length, 1001, 'ff05::2:1001%br-client', function (err) {
    if (err) console.error(err)
  })

Relates to hopglass/hopglass-server#107

@bnoordhuis
Copy link
Member

Node.js does not understand link-local addresses (the %br-client suffix), it treats them as a hostname to resolve over DNS.

More precisely: some functions (like dgram.Socket#setMulticastInterface()) understand them, but e.g. dgram.Socket#send() does not.

Teaching it to deal with link-local addresses may have security implications. Note for example that the WHATWG URL spec explicitly disallows them for security reasons.

@anoymouserver
Copy link
Author

Thx, that's good to know.
But if I omit the interface on send, how can I be sure that it will still only be sent to that interface?

@bnoordhuis
Copy link
Member

You can't right now.

@T-X
Copy link

T-X commented Sep 21, 2019

You can't right now.

@anoymouserver, @bnoordhuis: Actually, you can: You can set a more specific multicast route for the multicast group and interface you want to send it to. Usually this should work:

$ ip -6 route add ff05::2/128 dev bat0
$ ip -6 route add ff05::2/128 dev bat0 table local

Also see: https://stackoverflow.com/a/13149495

But if hopglass could add a configuration option to bind the network socket to a specific interface that would be the better solution. As that would allow multiple instances on the same host, too. (which the multicast route option probably will not work with)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants