Skip to content

EINVAL and EHOSTDOWN #21

@esavini

Description

@esavini

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

> ad@0.0.0 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! ad@0.0.0 start: `node server.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ad@0.0.0 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions