"""
# Make having just one rdataset at the node fast.
if len(self.rdatasets) > 0:
- if rdataset.rdtype == dns.rdatatype.CNAME:
+ # We don't want adding RRSIG(CNAME) to delete CNAMEs,
+ # so we treat it as expressing "CNAME intent" for classifying
+ # the node as a CNAME node, even if we haven't added the CNAME
+ # yet.
+ if rdataset.rdtype == dns.rdatatype.CNAME or \
+ (rdataset.rdtype == dns.rdatatype.RRSIG and
+ rdataset.covers == dns.rdatatype.CNAME):
self.rdatasets = [rds for rds in self.rdatasets
if rds.ok_for_cname()]
else:
_ok_for_cname = {
- (dns.rdatatype.CNAME, dns.rdatatype.NONE),
- (dns.rdatatype.RRSIG, dns.rdatatype.CNAME),
- (dns.rdatatype.NSEC, dns.rdatatype.NONE),
- (dns.rdatatype.RRSIG, dns.rdatatype.NSEC),
- (dns.rdatatype.NSEC3, dns.rdatatype.NONE),
- (dns.rdatatype.RRSIG, dns.rdatatype.NSEC3),
+ dns.rdatatype.CNAME,
+ dns.rdatatype.NSEC, # RFC 4035 section 2.5
+ dns.rdatatype.NSEC3, # This is not likely to happen, but not impossible!
+ dns.rdatatype.KEY, # RFC 4035 section 2.5, RFC 3007
}
_delete_for_other_data = {
(dns.rdatatype.RRSIG, dns.rdatatype.CNAME),
}
+
class Rdataset(dns.set.Set):
"""A DNS rdataset."""
def ok_for_cname(self):
"""Is this rdataset compatible with a CNAME node?"""
- return (self.rdtype, self.covers) in _ok_for_cname
+ return self.rdtype in _ok_for_cname or \
+ (self.rdtype == dns.rdatatype.RRSIG and
+ self.covers in _ok_for_cname)
def ok_for_other_data(self):
"""Is this rdataset compatible with an 'other data' (i.e. not CNAME)