|
@@ -83,11 +83,18 @@ class IPSubnet(models.Model):
|
|
|
if conflicting:
|
|
|
raise ValidationError('Subnet must not intersect with existing subnets.\nIntersected subnets: {}.'.format(conflicting))
|
|
|
|
|
|
+ def validate_reverse_dns(self):
|
|
|
+ """Check that reverse DNS entries, if any, are included in the subnet"""
|
|
|
+ incorrect = [str(rev.ip) for rev in self.reversednsentry_set.all() if not rev.ip in self.inet]
|
|
|
+ if incorrect:
|
|
|
+ raise ValidationError('Some reverse DNS entries are not in the subnet: {}.'.format(incorrect))
|
|
|
+
|
|
|
def clean(self):
|
|
|
if not self.inet:
|
|
|
self.allocate()
|
|
|
else:
|
|
|
self.validate_inclusion()
|
|
|
+ self.validate_reverse_dns()
|
|
|
|
|
|
def __unicode__(self):
|
|
|
return str(self.inet)
|