monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[monit] protocols/dns.c patch - RRs not in answer section


From: Nick Osborn
Subject: [monit] protocols/dns.c patch - RRs not in answer section
Date: Thu, 27 May 2010 13:04:43 +0100

Hi,

It seems that some DNS servers respond to Monit's DNS check with RRs
in the authority section (Zerigo hosted DNS, I'm looking at you):

  $ dig @c.ns.zerigo.net +nocmd +nostats .
  ;; Got answer:
  ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18202
  ;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 13, ADDITIONAL: 0
  ;; WARNING: recursion requested but not available
  
  ;; QUESTION SECTION:
  ;.                            IN      A
  
  ;; AUTHORITY SECTION:
  .                     518400  IN      NS      a.root-servers.net.
  [snip]
  .                     518400  IN      NS      m.root-servers.net.

Patch below to cater for this.

Cheers
Nick


Index: protocols/dns.c
===================================================================
--- protocols/dns.c     (revision 197)
+++ protocols/dns.c     (working copy)
@@ -155,9 +155,11 @@
     return FALSE;
   }
 
-  /* Compare answer resource records count (it should not be zero): */
-  if (rc == 0 && response[6] == 0x00 && response[7] == 0x00) {
-    LogError("DNS: no answer records returned\n");
+  /* Compare answer and authority resource record counts (they should not both
+     be zero): */
+  if (rc == 0 && response[6] == 0x00 && response[7] == 0x00
+              && response[8] == 0x00 && response[9] == 0x00) {
+    LogError("DNS: no answer or authority records returned\n");
     return FALSE;
   }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]