Rush has submitted this change and it was merged.

Change subject: labs dnsrecursor metaldns: Don't return NXDOMAIN when we don't 
have a record of the right type but do recognise the domain
......................................................................


labs dnsrecursor metaldns: Don't return NXDOMAIN when we don't have a record of 
the right type but do recognise the domain

Bug: T139438
Change-Id: Ic1837c10788b52da10f5d0c4778e9dbb51fa058d
---
M modules/dnsrecursor/templates/metaldns.lua.erb
1 file changed, 8 insertions(+), 2 deletions(-)

Approvals:
  Rush: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/dnsrecursor/templates/metaldns.lua.erb 
b/modules/dnsrecursor/templates/metaldns.lua.erb
index 73c400b..459c703 100644
--- a/modules/dnsrecursor/templates/metaldns.lua.erb
+++ b/modules/dnsrecursor/templates/metaldns.lua.erb
@@ -16,13 +16,19 @@
 <% end -%>
 
 function nxdomain (remoteip, domain, qtype)
-    if (qtype == pdns.PTR and PTRRecords[domain]) then
+    if ((qtype == pdns.PTR or qtype == pdns.ANY) and PTRRecords[domain]) then
         return 0, {{qtype=pdns.PTR, content=(PTRRecords[domain]), ttl=300}}
     end
 
-    if (qtype == pdns.A and ARecords[domain]) then
+    if ((qtype == pdns.A or qtype == pdns.ANY) and ARecords[domain]) then
         return 0, {{qtype=pdns.A, content=(ARecords[domain]), ttl=300}}
     end
 
+    -- Prevent NXDOMAIN if the domain exists, we just don't have a record of 
the matching type.
+    if (ARecords[domain] or PTRRecords[domain]) then
+        -- There isn't really a way to provide a proper serial here, so I 
chose '1'.
+        return 0, {{qtype=pdns.SOA, content="labs-ns0.wikimedia.org. 
root.wmflabs.org. 1 3600 600 86400 3600", ttl=60}}
+    end
+
     return -1, {}
 end

-- 
To view, visit https://gerrit.wikimedia.org/r/299903
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic1837c10788b52da10f5d0c4778e9dbb51fa058d
Gerrit-PatchSet: 5
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Alex Monk <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: Andrew Bogott <[email protected]>
Gerrit-Reviewer: BBlack <[email protected]>
Gerrit-Reviewer: Rush <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to