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

EINVAL and EHOSTDOWN #21

Open
esavini opened this issue Apr 18, 2017 · 4 comments
Open

EINVAL and EHOSTDOWN #21

esavini opened this issue Apr 18, 2017 · 4 comments

Comments

@esavini
Copy link

esavini commented Apr 18, 2017

Hi,
I've created a simple server, but if I make requests from the local machine (OS X El Capitan, dig command) always is ok, if I make requests from another computer in the same LAN (Windows 10, Chrome) always I get EHOSTDOWN or EINVAL errors.

The code I used is this.

var named = require('node-named')
var dns = require('dns')

var dnsServer = named.createServer()

dnsServer.on('query', (query) => {

  switch(query.type()) {

    case 'A':
      dns.resolve(query.name(), 'A', (err, addresses) => {

        if(err)
          return

        for(var i = 0; i < addresses.length; i++)
          query.addAnswer(query.name(), new named.ARecord(addresses[i]), 0)

        dnsServer.send(query)
      })

      break

  }
})

dnsServer.on('uncaughtException', (e) => console.log('LOG0'))
dnsServer.on('after', (e) => console.log('LOG1'))
dnsServer.on('clientError', (e) => console.log('LOG2'));

dnsServer.listen(process.env.DNS_PORT || 53, () => {
  console.log('DNS server started.')
})

Console output is this

imac-di-edoardo:ad Edoardo$ sudo npm start

> [email protected] start /Users/Edoardo/Desktop/FLRAuth/ad
> node server.js

DNS server started.
{ Error: send EHOSTDOWN ::ffff:192.168.1.4:61551
    at Object.exports._errnoException (util.js:1018:11)
    at exports._exceptionWithHostPort (util.js:1041:20)
    at SendWrap.afterSend [as oncomplete] (dgram.js:406:11)
  code: 'EHOSTDOWN',
  errno: 'EHOSTDOWN',
  syscall: 'send',
  address: '::ffff:192.168.1.4',
  port: 61551 }
{"name":"named","hostname":"imac-di-edoardo.local","pid":1081,"component":"agent","level":40,"adddress":"::ffff:192.168.1.4","port":61551,"err":{"message":"send EHOSTDOWN ::ffff:192.168.1.4:61551","name":"Error","stack":"Error: send EHOSTDOWN ::ffff:192.168.1.4:61551\n    at Object.exports._errnoException (util.js:1018:11)\n    at exports._exceptionWithHostPort (util.js:1041:20)\n    at SendWrap.afterSend [as oncomplete] (dgram.js:406:11)","code":"EHOSTDOWN","errno":"EHOSTDOWN","syscall":"send","address":"::ffff:192.168.1.4","port":61551},"msg":"send: unable to send response","time":"2017-04-18T16:45:12.387Z","v":0}

events.js:160
      throw er; // Unhandled 'error' event
      ^
ExceptionError: function () {
                return msg || name;
        }
    at SendWrap.callback (/Users/Edoardo/Desktop/FLRAuth/ad/node_modules/node-named/lib/server.js:137:44)
    at SendWrap.afterSend [as oncomplete] (dgram.js:411:8)

npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.10.1
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `node server.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script 'node server.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ad package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs ad
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls ad
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Edoardo/Desktop/FLRAuth/ad/npm-debug.log

My node version is 6.10.1.

Thank you in advance.

@trevoro
Copy link
Owner

trevoro commented Apr 28, 2017

Ah you are indeed correct.
This is a pretty old issue, actually as it appears to have been introduced when there was a change to the way that node address binding worked.

I'll submit a patch shortly.

@tsndr
Copy link

tsndr commented Jul 24, 2018

When will it get patched?

@gbrian
Copy link

gbrian commented Oct 5, 2018

@tsndr there you go #33
Thanks @trevoro for this project, helped me a lot! 😉

@A-312
Copy link

A-312 commented Aug 5, 2019

Do we get a fix ?

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

5 participants