Bug 706 - 4.1.4 don't listen on 53 port
4.1.4 don't listen on 53 port
Status: RESOLVED FIXED
Product: NSD
Classification: Unclassified
Component: NSD Code
4.1.x
x86_64 Linux
: P5 critical
Assigned To: NSD team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2015-09-12 09:39 CEST by Vladimir
Modified: 2015-09-22 05:42 CEST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir 2015-09-12 09:39:08 CEST
I have a server with Archlinux x86_64. Recently I updated that server and then NSD stopped to work. On that system I do
  drill vl-lomov.ru @IP
and gets
  Error: error sending query: Could not send or receive, because of network error

after a while. nmap scan shows that nothing is listen on 53 port.

On the same system the 4.1.3 version works fine.
Comment 1 Wouter Wijngaards 2015-09-14 08:25:54 CEST
Hi Vladimir,

reuseport: no
in nsd.conf, does that solve the problem?

If so, what kernel version is that, what does a verbosity 4 log show (errors at startup?).  The linux kernel should report not-implemented for the REUSEPORT socket option (it does for other versions) and NSD then should stop using the socket option.

Best regards, Wouter
Comment 2 Vladimir 2015-09-14 10:57:59 CEST
Hello Wouter,

> reuseport: no
> in nsd.conf, does that solve the problem?

Unfortunately, no. I installed NSD of 4.1.4 ver. and set that option in /etc/nsd/nsd.conf, restarted nsd and got the same response from drill.

> If so, what kernel version is that,

kernel:
$ uname -a
Linux vl-lomov.ru 4.1.6-1-ARCH #1 SMP PREEMPT Mon Aug 17 08:52:28 CEST 2015 x86_64 GNU/Linux

> what does a verbosity 4 log show (errors at startup?).

It shows nothing suspicious:

sudo /usr/bin/nsd -d -c /etc/nsd/nsd.conf
[2015-09-14 11:40:39.373] nsd[4625]: info: zonefile vl-lomov.forward is not modified
[2015-09-14 11:40:39.373] nsd[4625]: notice: nsd started (NSD 4.1.4), pid 4624

In /etc/nsd/nsd.conf I have:

server:
  server-count: 1
  identity: "VL-LOMOV.RU DNS MASTER"
  reuseport: no
  verbosity: 4
  zonesdir: "//etc/nsd"

> The linux kernel should report not-implemented for the REUSEPORT socket  option (it does for other versions) and NSD then should stop using the socket option.

dmesg don't show anything related.
Comment 3 Wouter Wijngaards 2015-09-21 09:28:44 CEST
Hi Vladimir,

Now that I see your configuration, the reuseport thing is not the issue, it is not applied.  I do not know why it is not listening on port 53.  There have been code edits to the socket code, but it should normally still listen on port 53...

So, you start NSD, then do  drill @127.0.0.1 mydomainname.com   and it fails?  I am trying to get more information about what is going wrong, because it does not seem to be related to the reuseport feature.

NSD consists of multiple processes.  The one listed in the pidfile does indeed not listen on port 53, there is another process that does that (or two processes).

Best regards, Wouter
Comment 4 Wouter Wijngaards 2015-09-21 10:15:00 CEST
Hi Vladimir,

Thank you for the report!   It turns out the hints for getaddrinfo were not properly initialised (because of the change that had no more interface number limits).  This is the fix (also in code repository for the upcoming release).

Best regards, Wouter

Index: nsd.c
===================================================================
--- nsd.c        (revision 4501)
+++ nsd.c        (working copy)
@@ -447,6 +447,8 @@
         memset(&hints, 0, sizeof(*hints)*2);
         hints[0].ai_family = DEFAULT_AI_FAMILY;
         hints[0].ai_flags = AI_PASSIVE;
+        hints[1].ai_family = DEFAULT_AI_FAMILY;
+        hints[1].ai_flags = AI_PASSIVE;
         nsd.identity    = 0;
         nsd.version     = VERSION;
         nsd.username    = 0;
Comment 5 Vladimir 2015-09-22 05:42:42 CEST
Hello Wouter,

thank you, the patch for nsd.c fixes the problem, now nsd listens on 53 port and drill work fine.