- Timestamp:
- Aug 25, 2008, 1:27:07 AM (16 years ago)
- Location:
- trunk/packages/sipb-xen-dns
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/sipb-xen-dns/code/dnsserver.py
r913 r922 57 57 ttl = 900 58 58 name = name.lower() 59 60 # XXX hack for the transition to two separate dev/prod clusters 61 if 'dev.xvm.mit.edu' in self.domains and name.endswith('prod.xvm.mit.edu'): 62 # import time, sys 63 # print time.localtime(), 'handling prod request', name 64 # sys.stdout.flush() 65 66 # Point the client in the right direction for prod requests. 67 authority = dns.RRHeader('prod.xvm.mit.edu', dns.NS, dns.IN, 3600, 68 dns.Record_NS(name='ns1.prod.xvm.mit.edu', ttl=3600), auth=True) 69 additional = dns.RRHeader('ns1.prod.xvm.mit.edu', dns.A, dns.IN, 3600, 70 dns.Record_A(address='0.0.0.0', ttl=3600), auth=True) 71 return defer.succeed(([], [authority], [additional])) 72 59 73 if name in self.domains: 60 74 domain = name 61 75 else: 62 # This works because domain will remain bound after breaking out of the loop 76 # Look for the longest-matching domain. (This works because domain 77 # will remain bound after breaking out of the loop.) 78 best_domain = '' 63 79 for domain in self.domains: 64 if name.endswith('.'+domain) :65 b reak66 else: #Not us80 if name.endswith('.'+domain) and len(domain) > len(best_domain): 81 best_domain = domain 82 if best_domain == '': 67 83 return defer.fail(failure.Failure(dns.DomainError(name))) 84 domain = best_domain 68 85 results = [] 69 86 authority = [] … … 71 88 authority.append(dns.RRHeader(domain, dns.NS, dns.IN, 72 89 3600, self.ns, auth=True)) 90 73 91 if cls == dns.IN: 74 92 host = name[:-len(domain)-1] 75 if not host: 93 if not host: # Request for the domain itself. 76 94 if type in (dns.A, dns.ALL_RECORDS): 77 95 record = dns.Record_A(config.dns.nameservers[0].ip, ttl) … … 85 103 results.append(dns.RRHeader(domain, dns.SOA, dns.IN, 86 104 ttl, self.soa, auth=True)) 87 else: 105 else: # Request for a subdomain. 88 106 if 'passup' in dir(config.dns) and host in config.dns.passup: 89 107 record = dns.Record_CNAME('%s.%s' % (host, config.dns.parent), ttl) … … 92 110 [], [])) 93 111 94 if host:95 value = invirt.database.Machine.get_by(name=host)96 if value is None or not value.nics:97 return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name)))98 ip = value.nics[0].ip99 if ip is None: #Deactivated?100 return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name))) 112 value = invirt.database.Machine.get_by(name=host) 113 if value is None or not value.nics: 114 return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name))) 115 ip = value.nics[0].ip 116 if ip is None: #Deactivated? 117 return defer.fail(failure.Failure(dns.AuthoritativeDomainError(name))) 118 101 119 if type in (dns.A, dns.ALL_RECORDS): 102 120 record = dns.Record_A(ip, ttl) -
trunk/packages/sipb-xen-dns/debian/changelog
r851 r922 1 sipb-xen-dns (1.04) unstable; urgency=low 2 3 * Search for longest-matching domain name instead of first-matching. 4 * ns1.prod.xvm.mit.edu (0.0.0.0) is the primary nameserver for the prod 5 zone. 6 7 -- Yang Zhang <y_z@mit.edu> Mon, 25 Aug 2008 01:01:17 -0400 8 9 sipb-xen-dns (1.03) unstable; urgency=low 10 11 * debian/ 12 13 -- Yang Zhang <y_z@mit.edu> Sun, 24 Aug 2008 16:37:16 -0400 14 1 15 sipb-xen-dns (1.02) unstable; urgency=low 2 16
Note: See TracChangeset
for help on using the changeset viewer.