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;
   }
 


--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general

Reply via email to