Fix DNS domain name case preservation and DNS 0x20 encoding issues.

Fixed DNS 0x20 encoding bug in worker threads and removed automatic lowercasing in DNS buffer parsing to preserve case from authoritative sources. Implemented case-insensitive lookups for cache and blockchain while ensuring restoration of the original client query case in all response paths instead of returning randomized DNS 0x20 case from upstream servers.
This commit is contained in:
Revertron
2025-10-28 13:11:56 +01:00
parent b10402ee1e
commit a29a6190fb
9 changed files with 108 additions and 28 deletions
+3 -1
View File
@@ -230,9 +230,11 @@ impl BlockchainFilter {
impl DnsFilter for BlockchainFilter {
fn lookup(&self, qname: &str, qtype: QueryType, recursive: bool) -> Option<DnsPacket> {
// Lowercase for case-insensitive lookup (blockchain stores domains as lowercase)
let qname_lower = qname.to_lowercase();
let top_domain;
let subdomain;
let parts: Vec<&str> = qname.rsplitn(3, '.').collect();
let parts: Vec<&str> = qname_lower.rsplitn(3, '.').collect();
match parts.len() {
1 => {
let mut packet = DnsPacket::new();