mirror of
https://github.com/fergalmoran/DnsServer.git
synced 2025-12-22 09:29:50 +00:00
ResolverDnsCache: implemented skipConditionalForwardingResolution option to prevent stack overflow cases.
This commit is contained in:
@@ -35,15 +35,17 @@ namespace DnsServerCore.Dns
|
||||
|
||||
readonly DnsServer _dnsServer;
|
||||
readonly bool _skipDnsAppAuthoritativeRequestHandlers;
|
||||
readonly bool _skipConditionalForwardingResolution;
|
||||
|
||||
#endregion
|
||||
|
||||
#region constructor
|
||||
|
||||
public ResolverDnsCache(DnsServer dnsServer, bool skipDnsAppAuthoritativeRequestHandlers)
|
||||
public ResolverDnsCache(DnsServer dnsServer, bool skipDnsAppAuthoritativeRequestHandlers, bool skipConditionalForwardingResolution = false)
|
||||
{
|
||||
_dnsServer = dnsServer;
|
||||
_skipDnsAppAuthoritativeRequestHandlers = skipDnsAppAuthoritativeRequestHandlers;
|
||||
_skipConditionalForwardingResolution = skipConditionalForwardingResolution;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -121,7 +123,7 @@ namespace DnsServerCore.Dns
|
||||
advancedForwardingClientSubnet = requestECS.AdvancedForwardingClientSubnet;
|
||||
}
|
||||
|
||||
ResolverPrefetchDnsCache dnsCache = new ResolverPrefetchDnsCache(_dnsServer, _skipDnsAppAuthoritativeRequestHandlers, question);
|
||||
ResolverDnsCache dnsCache = new ResolverDnsCache(_dnsServer, _skipDnsAppAuthoritativeRequestHandlers, true);
|
||||
|
||||
return _dnsServer.PriorityConditionalForwarderResolveAsync(question, eDnsClientSubnet, advancedForwardingClientSubnet, dnsCache, _skipDnsAppAuthoritativeRequestHandlers, conditionalForwarders);
|
||||
}
|
||||
@@ -207,6 +209,7 @@ namespace DnsServerCore.Dns
|
||||
return cacheResponse;
|
||||
}
|
||||
|
||||
if (!_skipConditionalForwardingResolution)
|
||||
{
|
||||
DnsResourceRecord authResponseFirstAuthority = authResponse.FindFirstAuthorityRecord();
|
||||
if (authResponseFirstAuthority.Type == DnsResourceRecordType.FWD)
|
||||
|
||||
Reference in New Issue
Block a user