diff --git a/DnsServerCore/Dns/Zones/ForwarderZone.cs b/DnsServerCore/Dns/Zones/ForwarderZone.cs index 196ead01..ef236bd0 100644 --- a/DnsServerCore/Dns/Zones/ForwarderZone.cs +++ b/DnsServerCore/Dns/Zones/ForwarderZone.cs @@ -17,6 +17,8 @@ along with this program. If not, see . */ +using System; +using System.Collections.Generic; using TechnitiumLibrary.Net.Dns; using TechnitiumLibrary.Net.Dns.ResourceRecords; @@ -41,5 +43,41 @@ namespace DnsServerCore.Dns.Zones } #endregion + + #region public + + public override void SetRecords(DnsResourceRecordType type, IReadOnlyList records) + { + switch (type) + { + case DnsResourceRecordType.CNAME: + throw new InvalidOperationException("Cannot set CNAME record to zone root."); + + case DnsResourceRecordType.NS: + throw new InvalidOperationException("Cannot set NS record to forwarder zone root."); + + case DnsResourceRecordType.SOA: + throw new InvalidOperationException("Cannot set SOA record to forwarder zone root."); + + default: + base.SetRecords(type, records); + break; + } + } + + public override void AddRecord(DnsResourceRecord record) + { + switch (record.Type) + { + case DnsResourceRecordType.NS: + throw new InvalidOperationException("Cannot add NS record at forwarder zone root."); + + default: + base.AddRecord(record); + break; + } + } + + #endregion } }