From 317310579c8a98b7b45514dbac683652bfa21f58 Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Sun, 24 Apr 2022 17:28:17 +0530 Subject: [PATCH] DnsServer: updated ProcessANAMEAsync() to set last used on value when returning authority records for ANAME response. --- DnsServerCore/Dns/DnsServer.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/DnsServerCore/Dns/DnsServer.cs b/DnsServerCore/Dns/DnsServer.cs index 336c90de..47c28e66 100644 --- a/DnsServerCore/Dns/DnsServer.cs +++ b/DnsServerCore/Dns/DnsServer.cs @@ -19,6 +19,7 @@ along with this program. If not, see . using DnsServerCore.ApplicationCommon; using DnsServerCore.Dns.Applications; +using DnsServerCore.Dns.ResourceRecords; using DnsServerCore.Dns.Trees; using DnsServerCore.Dns.ZoneManagers; using DnsServerCore.Dns.Zones; @@ -1794,9 +1795,19 @@ namespace DnsServerCore.Dns if (responseAnswer.Count == 0) { if (foundErrors) + { rcode = DnsResponseCode.ServerFailure; + } else + { authority = response.Authority; + + //update last used on + DateTime utcNow = DateTime.UtcNow; + + foreach (DnsResourceRecord record in authority) + record.GetRecordInfo().LastUsedOn = utcNow; + } } return new DnsDatagram(request.Identifier, true, DnsOpcode.StandardQuery, true, false, request.RecursionDesired, isRecursionAllowed, false, false, rcode, request.Question, responseAnswer, authority, null) { Tag = response.Tag };