From ba7b053bf07c7f794cf1d38981bf4ae496fbc191 Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Sun, 11 Apr 2021 17:40:23 +0530 Subject: [PATCH] refactored NameError to NxDomain --- DnsServerCore/Dns/StatsManager.cs | 56 +++++++++---------- .../Dns/ZoneManagers/AuthZoneManager.cs | 2 +- .../Dns/ZoneManagers/CacheZoneManager.cs | 2 +- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/DnsServerCore/Dns/StatsManager.cs b/DnsServerCore/Dns/StatsManager.cs index a36a76d7..887acc4b 100644 --- a/DnsServerCore/Dns/StatsManager.cs +++ b/DnsServerCore/Dns/StatsManager.cs @@ -35,7 +35,7 @@ namespace DnsServerCore.Dns { NoError = 1, ServerFailure = 2, - NameError = 3, + NxDomain = 3, Refused = 4 } @@ -527,8 +527,8 @@ namespace DnsServerCore.Dns responseCode = StatsResponseCode.ServerFailure; break; - case DnsResponseCode.NameError: - responseCode = StatsResponseCode.NameError; + case DnsResponseCode.NxDomain: + responseCode = StatsResponseCode.NxDomain; break; case DnsResponseCode.Refused: @@ -564,7 +564,7 @@ namespace DnsServerCore.Dns List> totalQueriesPerInterval = new List>(60); List> totalNoErrorPerInterval = new List>(60); List> totalServerFailurePerInterval = new List>(60); - List> totalNameErrorPerInterval = new List>(60); + List> totalNxDomainPerInterval = new List>(60); List> totalRefusedPerInterval = new List>(60); List> totalAuthHitPerInterval = new List>(60); @@ -590,7 +590,7 @@ namespace DnsServerCore.Dns totalQueriesPerInterval.Add(new KeyValuePair(label, statCounter.TotalQueries)); totalNoErrorPerInterval.Add(new KeyValuePair(label, statCounter.TotalNoError)); totalServerFailurePerInterval.Add(new KeyValuePair(label, statCounter.TotalServerFailure)); - totalNameErrorPerInterval.Add(new KeyValuePair(label, statCounter.TotalNameError)); + totalNxDomainPerInterval.Add(new KeyValuePair(label, statCounter.TotalNxDomain)); totalRefusedPerInterval.Add(new KeyValuePair(label, statCounter.TotalRefused)); totalAuthHitPerInterval.Add(new KeyValuePair(label, statCounter.TotalAuthoritative)); @@ -605,7 +605,7 @@ namespace DnsServerCore.Dns totalQueriesPerInterval.Add(new KeyValuePair(label, 0)); totalNoErrorPerInterval.Add(new KeyValuePair(label, 0)); totalServerFailurePerInterval.Add(new KeyValuePair(label, 0)); - totalNameErrorPerInterval.Add(new KeyValuePair(label, 0)); + totalNxDomainPerInterval.Add(new KeyValuePair(label, 0)); totalRefusedPerInterval.Add(new KeyValuePair(label, 0)); totalAuthHitPerInterval.Add(new KeyValuePair(label, 0)); @@ -625,7 +625,7 @@ namespace DnsServerCore.Dns stats.Add(new KeyValuePair("totalQueries", totalStatCounter.TotalQueries)); stats.Add(new KeyValuePair("totalNoError", totalStatCounter.TotalNoError)); stats.Add(new KeyValuePair("totalServerFailure", totalStatCounter.TotalServerFailure)); - stats.Add(new KeyValuePair("totalNameError", totalStatCounter.TotalNameError)); + stats.Add(new KeyValuePair("totalNxDomain", totalStatCounter.TotalNxDomain)); stats.Add(new KeyValuePair("totalRefused", totalStatCounter.TotalRefused)); stats.Add(new KeyValuePair("totalAuthoritative", totalStatCounter.TotalAuthoritative)); @@ -641,7 +641,7 @@ namespace DnsServerCore.Dns data.Add("totalQueriesPerInterval", totalQueriesPerInterval); data.Add("totalNoErrorPerInterval", totalNoErrorPerInterval); data.Add("totalServerFailurePerInterval", totalServerFailurePerInterval); - data.Add("totalNameErrorPerInterval", totalNameErrorPerInterval); + data.Add("totalNxDomainPerInterval", totalNxDomainPerInterval); data.Add("totalRefusedPerInterval", totalRefusedPerInterval); data.Add("totalAuthHitPerInterval", totalAuthHitPerInterval); @@ -682,7 +682,7 @@ namespace DnsServerCore.Dns List> totalQueriesPerInterval = new List>(); List> totalNoErrorPerInterval = new List>(); List> totalServerFailurePerInterval = new List>(); - List> totalNameErrorPerInterval = new List>(); + List> totalNxDomainPerInterval = new List>(); List> totalRefusedPerInterval = new List>(); List> totalAuthHitPerInterval = new List>(); @@ -716,7 +716,7 @@ namespace DnsServerCore.Dns totalQueriesPerInterval.Add(new KeyValuePair(label, monthlyStatCounter.TotalQueries)); totalNoErrorPerInterval.Add(new KeyValuePair(label, monthlyStatCounter.TotalNoError)); totalServerFailurePerInterval.Add(new KeyValuePair(label, monthlyStatCounter.TotalServerFailure)); - totalNameErrorPerInterval.Add(new KeyValuePair(label, monthlyStatCounter.TotalNameError)); + totalNxDomainPerInterval.Add(new KeyValuePair(label, monthlyStatCounter.TotalNxDomain)); totalRefusedPerInterval.Add(new KeyValuePair(label, monthlyStatCounter.TotalRefused)); totalAuthHitPerInterval.Add(new KeyValuePair(label, monthlyStatCounter.TotalAuthoritative)); @@ -735,7 +735,7 @@ namespace DnsServerCore.Dns stats.Add(new KeyValuePair("totalQueries", totalStatCounter.TotalQueries)); stats.Add(new KeyValuePair("totalNoError", totalStatCounter.TotalNoError)); stats.Add(new KeyValuePair("totalServerFailure", totalStatCounter.TotalServerFailure)); - stats.Add(new KeyValuePair("totalNameError", totalStatCounter.TotalNameError)); + stats.Add(new KeyValuePair("totalNxDomain", totalStatCounter.TotalNxDomain)); stats.Add(new KeyValuePair("totalRefused", totalStatCounter.TotalRefused)); stats.Add(new KeyValuePair("totalAuthoritative", totalStatCounter.TotalAuthoritative)); @@ -751,7 +751,7 @@ namespace DnsServerCore.Dns data.Add("totalQueriesPerInterval", totalQueriesPerInterval); data.Add("totalNoErrorPerInterval", totalNoErrorPerInterval); data.Add("totalServerFailurePerInterval", totalServerFailurePerInterval); - data.Add("totalNameErrorPerInterval", totalNameErrorPerInterval); + data.Add("totalNxDomainPerInterval", totalNxDomainPerInterval); data.Add("totalRefusedPerInterval", totalRefusedPerInterval); data.Add("totalAuthHitPerInterval", totalAuthHitPerInterval); @@ -786,7 +786,7 @@ namespace DnsServerCore.Dns List> totalQueriesPerInterval = new List>(); List> totalNoErrorPerInterval = new List>(); List> totalServerFailurePerInterval = new List>(); - List> totalNameErrorPerInterval = new List>(); + List> totalNxDomainPerInterval = new List>(); List> totalRefusedPerInterval = new List>(); List> totalAuthHitPerInterval = new List>(); @@ -809,7 +809,7 @@ namespace DnsServerCore.Dns totalQueriesPerInterval.Add(new KeyValuePair(label, hourlyStatCounter.TotalQueries)); totalNoErrorPerInterval.Add(new KeyValuePair(label, hourlyStatCounter.TotalNoError)); totalServerFailurePerInterval.Add(new KeyValuePair(label, hourlyStatCounter.TotalServerFailure)); - totalNameErrorPerInterval.Add(new KeyValuePair(label, hourlyStatCounter.TotalNameError)); + totalNxDomainPerInterval.Add(new KeyValuePair(label, hourlyStatCounter.TotalNxDomain)); totalRefusedPerInterval.Add(new KeyValuePair(label, hourlyStatCounter.TotalRefused)); totalAuthHitPerInterval.Add(new KeyValuePair(label, hourlyStatCounter.TotalAuthoritative)); @@ -828,7 +828,7 @@ namespace DnsServerCore.Dns stats.Add(new KeyValuePair("totalQueries", totalStatCounter.TotalQueries)); stats.Add(new KeyValuePair("totalNoError", totalStatCounter.TotalNoError)); stats.Add(new KeyValuePair("totalServerFailure", totalStatCounter.TotalServerFailure)); - stats.Add(new KeyValuePair("totalNameError", totalStatCounter.TotalNameError)); + stats.Add(new KeyValuePair("totalNxDomain", totalStatCounter.TotalNxDomain)); stats.Add(new KeyValuePair("totalRefused", totalStatCounter.TotalRefused)); stats.Add(new KeyValuePair("totalAuthoritative", totalStatCounter.TotalAuthoritative)); @@ -844,7 +844,7 @@ namespace DnsServerCore.Dns data.Add("totalQueriesPerInterval", totalQueriesPerInterval); data.Add("totalNoErrorPerInterval", totalNoErrorPerInterval); data.Add("totalServerFailurePerInterval", totalServerFailurePerInterval); - data.Add("totalNameErrorPerInterval", totalNameErrorPerInterval); + data.Add("totalNxDomainPerInterval", totalNxDomainPerInterval); data.Add("totalRefusedPerInterval", totalRefusedPerInterval); data.Add("totalAuthHitPerInterval", totalAuthHitPerInterval); @@ -875,7 +875,7 @@ namespace DnsServerCore.Dns List> totalQueriesPerInterval = new List>(); List> totalNoErrorPerInterval = new List>(); List> totalServerFailurePerInterval = new List>(); - List> totalNameErrorPerInterval = new List>(); + List> totalNxDomainPerInterval = new List>(); List> totalRefusedPerInterval = new List>(); List> totalAuthHitPerInterval = new List>(); @@ -896,7 +896,7 @@ namespace DnsServerCore.Dns totalQueriesPerInterval.Add(new KeyValuePair(label, dailyStatCounter.TotalQueries)); totalNoErrorPerInterval.Add(new KeyValuePair(label, dailyStatCounter.TotalNoError)); totalServerFailurePerInterval.Add(new KeyValuePair(label, dailyStatCounter.TotalServerFailure)); - totalNameErrorPerInterval.Add(new KeyValuePair(label, dailyStatCounter.TotalNameError)); + totalNxDomainPerInterval.Add(new KeyValuePair(label, dailyStatCounter.TotalNxDomain)); totalRefusedPerInterval.Add(new KeyValuePair(label, dailyStatCounter.TotalRefused)); totalAuthHitPerInterval.Add(new KeyValuePair(label, dailyStatCounter.TotalAuthoritative)); @@ -915,7 +915,7 @@ namespace DnsServerCore.Dns stats.Add(new KeyValuePair("totalQueries", totalStatCounter.TotalQueries)); stats.Add(new KeyValuePair("totalNoError", totalStatCounter.TotalNoError)); stats.Add(new KeyValuePair("totalServerFailure", totalStatCounter.TotalServerFailure)); - stats.Add(new KeyValuePair("totalNameError", totalStatCounter.TotalNameError)); + stats.Add(new KeyValuePair("totalNxDomain", totalStatCounter.TotalNxDomain)); stats.Add(new KeyValuePair("totalRefused", totalStatCounter.TotalRefused)); stats.Add(new KeyValuePair("totalAuthoritative", totalStatCounter.TotalAuthoritative)); @@ -931,7 +931,7 @@ namespace DnsServerCore.Dns data.Add("totalQueriesPerInterval", totalQueriesPerInterval); data.Add("totalNoErrorPerInterval", totalNoErrorPerInterval); data.Add("totalServerFailurePerInterval", totalServerFailurePerInterval); - data.Add("totalNameErrorPerInterval", totalNameErrorPerInterval); + data.Add("totalNxDomainPerInterval", totalNxDomainPerInterval); data.Add("totalRefusedPerInterval", totalRefusedPerInterval); data.Add("totalAuthHitPerInterval", totalAuthHitPerInterval); @@ -1241,7 +1241,7 @@ namespace DnsServerCore.Dns int _totalQueries; int _totalNoError; int _totalServerFailure; - int _totalNameError; + int _totalNxDomain; int _totalRefused; int _totalAuthoritative; @@ -1277,7 +1277,7 @@ namespace DnsServerCore.Dns _totalQueries = bR.ReadInt32(); _totalNoError = bR.ReadInt32(); _totalServerFailure = bR.ReadInt32(); - _totalNameError = bR.ReadInt32(); + _totalNxDomain = bR.ReadInt32(); _totalRefused = bR.ReadInt32(); if (version >= 3) @@ -1393,8 +1393,8 @@ namespace DnsServerCore.Dns Interlocked.Increment(ref _totalServerFailure); break; - case StatsResponseCode.NameError: - Interlocked.Increment(ref _totalNameError); + case StatsResponseCode.NxDomain: + Interlocked.Increment(ref _totalNxDomain); break; case StatsResponseCode.Refused: @@ -1434,7 +1434,7 @@ namespace DnsServerCore.Dns _totalQueries += statCounter._totalQueries; _totalNoError += statCounter._totalNoError; _totalServerFailure += statCounter._totalServerFailure; - _totalNameError += statCounter._totalNameError; + _totalNxDomain += statCounter._totalNxDomain; _totalRefused += statCounter._totalRefused; _totalAuthoritative += statCounter._totalAuthoritative; @@ -1469,7 +1469,7 @@ namespace DnsServerCore.Dns bW.Write(_totalQueries); bW.Write(_totalNoError); bW.Write(_totalServerFailure); - bW.Write(_totalNameError); + bW.Write(_totalNxDomain); bW.Write(_totalRefused); bW.Write(_totalAuthoritative); @@ -1608,8 +1608,8 @@ namespace DnsServerCore.Dns public int TotalServerFailure { get { return _totalServerFailure; } } - public int TotalNameError - { get { return _totalNameError; } } + public int TotalNxDomain + { get { return _totalNxDomain; } } public int TotalRefused { get { return _totalRefused; } } diff --git a/DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs b/DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs index 71286803..affa9abd 100644 --- a/DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs +++ b/DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs @@ -927,7 +927,7 @@ namespace DnsServerCore.Dns.ZoneManagers if (authority.Count == 0) { if (!hasSubDomains) - rCode = DnsResponseCode.NameError; + rCode = DnsResponseCode.NxDomain; authority = authZone.GetRecords(DnsResourceRecordType.SOA); } diff --git a/DnsServerCore/Dns/ZoneManagers/CacheZoneManager.cs b/DnsServerCore/Dns/ZoneManagers/CacheZoneManager.cs index 24518d31..575af65f 100644 --- a/DnsServerCore/Dns/ZoneManagers/CacheZoneManager.cs +++ b/DnsServerCore/Dns/ZoneManagers/CacheZoneManager.cs @@ -268,7 +268,7 @@ namespace DnsServerCore.Dns.ZoneManagers if (soaRecord != null) authority = new DnsResourceRecord[] { soaRecord }; - return new DnsDatagram(request.Identifier, true, DnsOpcode.StandardQuery, false, false, request.RecursionDesired, true, false, false, DnsResponseCode.NameError, request.Question, null, authority); + return new DnsDatagram(request.Identifier, true, DnsOpcode.StandardQuery, false, false, request.RecursionDesired, true, false, false, DnsResponseCode.NxDomain, request.Question, null, authority); } if (answers[0].RDATA is DnsFailureRecord)