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 DnsServer _dnsServer;
|
||||||
readonly bool _skipDnsAppAuthoritativeRequestHandlers;
|
readonly bool _skipDnsAppAuthoritativeRequestHandlers;
|
||||||
|
readonly bool _skipConditionalForwardingResolution;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region constructor
|
#region constructor
|
||||||
|
|
||||||
public ResolverDnsCache(DnsServer dnsServer, bool skipDnsAppAuthoritativeRequestHandlers)
|
public ResolverDnsCache(DnsServer dnsServer, bool skipDnsAppAuthoritativeRequestHandlers, bool skipConditionalForwardingResolution = false)
|
||||||
{
|
{
|
||||||
_dnsServer = dnsServer;
|
_dnsServer = dnsServer;
|
||||||
_skipDnsAppAuthoritativeRequestHandlers = skipDnsAppAuthoritativeRequestHandlers;
|
_skipDnsAppAuthoritativeRequestHandlers = skipDnsAppAuthoritativeRequestHandlers;
|
||||||
|
_skipConditionalForwardingResolution = skipConditionalForwardingResolution;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -121,7 +123,7 @@ namespace DnsServerCore.Dns
|
|||||||
advancedForwardingClientSubnet = requestECS.AdvancedForwardingClientSubnet;
|
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);
|
return _dnsServer.PriorityConditionalForwarderResolveAsync(question, eDnsClientSubnet, advancedForwardingClientSubnet, dnsCache, _skipDnsAppAuthoritativeRequestHandlers, conditionalForwarders);
|
||||||
}
|
}
|
||||||
@@ -207,6 +209,7 @@ namespace DnsServerCore.Dns
|
|||||||
return cacheResponse;
|
return cacheResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_skipConditionalForwardingResolution)
|
||||||
{
|
{
|
||||||
DnsResourceRecord authResponseFirstAuthority = authResponse.FindFirstAuthorityRecord();
|
DnsResourceRecord authResponseFirstAuthority = authResponse.FindFirstAuthorityRecord();
|
||||||
if (authResponseFirstAuthority.Type == DnsResourceRecordType.FWD)
|
if (authResponseFirstAuthority.Type == DnsResourceRecordType.FWD)
|
||||||
|
|||||||
Reference in New Issue
Block a user