diff --git a/Apps/Dns64App/App.cs b/Apps/Dns64App/App.cs index 8d2b0dae..d9851244 100644 --- a/Apps/Dns64App/App.cs +++ b/Apps/Dns64App/App.cs @@ -20,6 +20,7 @@ along with this program. If not, see . using DnsServerCore.ApplicationCommon; using System; using System.Collections.Generic; +using System.Linq; using System.Net; using System.Net.Sockets; using System.Text.Json; @@ -123,22 +124,34 @@ namespace Dns64 List newAnswer = new List(response.Answer.Count); bool synthesizeAAAA = true; + bool anyExclusions = group.ExcludedIpv6.Any(); foreach (DnsResourceRecord answer in response.Answer) { + //If this isn't an AAAA, include it in the new answer as we don't need to mess with it if (answer.Type != DnsResourceRecordType.AAAA) { newAnswer.Add(answer); continue; } - + + //If there aren't any exclusions, and we have an AAAA already, we can just accept that AAAA and not synthesize anything + if (answer.Type == DnsResourceRecordType.AAAA && !anyExclusions) + { + newAnswer.Add(answer); + synthesizeAAAA = false; + continue; + } + + //At this point, we have an AAAA and we have at least one exclusion. We need to check the AAAA against the exclusion list + IPAddress ipv6Address = (answer.RDATA as DnsAAAARecordData).Address; foreach (NetworkAddress excludedIpv6 in group.ExcludedIpv6) { if (!excludedIpv6.Contains(ipv6Address)) { - //found non-excluded AAAA record so no need to synthesize AAAA + //This AAAA is not excluded and so we can just accept it and not synthesize anything newAnswer.Add(answer); synthesizeAAAA = false; } diff --git a/README.md b/README.md index 1cc38f6e..d67ea2cd 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ Be it a home network or an organization's network, having a locally running DNS # Sponsored By

Altha Technology - Censorship Resistant Data Services + Macarne - Worldwide Bare Metal Solutions

# Features