summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-05-13 03:34:42 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-05-13 03:34:42 +0200
commitff56fd8a3fa79b23fc18c4aa2d7f2983d5230096 (patch)
treef817be2070897f499a155143bdc92b0f1a30075e
parentc83ea03c635387e8bd0f50f62c6e6ff7895c82df (diff)
downloadmdns-resolver-ff56fd8a3fa79b23fc18c4aa2d7f2983d5230096.tar
mdns-resolver-ff56fd8a3fa79b23fc18c4aa2d7f2983d5230096.zip
Add NS records to ANY answer
-rwxr-xr-xmdns-resolver7
1 files changed, 4 insertions, 3 deletions
diff --git a/mdns-resolver b/mdns-resolver
index 608232d..762f8d9 100755
--- a/mdns-resolver
+++ b/mdns-resolver
@@ -10,7 +10,7 @@ $domain = 'mesh.ffhl'
$port = 53
$ttl = 0
$ns = ['mesh.ffhl. 3600 IN NS paul.ffhl.']
-$soa = 'mesh.ffhl. 0 IN SOA paul.ffhl. freifunk\.luebeck.asta.uni-luebeck.de. 1 3600 180 600 60'
+$soa = 'mesh.ffhl. 3600 IN SOA paul.ffhl. freifunk\.luebeck.asta.uni-luebeck.de. 1 3600 180 600 60'
### Config end ###
@@ -87,8 +87,9 @@ while run do
packet.question.each do |q|
next unless q.qClass.to_i == Net::DNS::IN
- if q.qName == $domain+'.' and (q.qType.to_i == Net::DNS::SOA or q.qType.to_i == Net::DNS::ANY)
- packet.answer << soaRecord
+ if q.qName == $domain+'.'
+ packet.answer << soaRecord if q.qType.to_i == Net::DNS::SOA or q.qType.to_i == Net::DNS::ANY
+ $ns.each { |line| packet.answer << Net::DNS::RR::NS.new(line) } if q.qType.to_i == Net::DNS::NS or q.qType.to_i == Net::DNS::ANY
else
host, qdomain = q.qName.split('.', 2)
next unless qdomain == $domain+'.'