From 48840a82cdadc850606b0fbd18dd82c496c93912 Mon Sep 17 00:00:00 2001 From: Nihanth Subramanya Date: Sat, 6 Feb 2021 13:00:36 +0000 Subject: [PATCH] Bug 1688228 - Introduce TRR_NXDOMAIN skip reason and record it when an rcode value of 0x03 is received. r=valentin,necko-reviewers Differential Revision: https://phabricator.services.mozilla.com/D102774 --- netwerk/dns/DNSPacket.cpp | 3 ++- netwerk/dns/nsHostResolver.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/netwerk/dns/DNSPacket.cpp b/netwerk/dns/DNSPacket.cpp index 12f0018447d1..c3f94d00c81a 100644 --- a/netwerk/dns/DNSPacket.cpp +++ b/netwerk/dns/DNSPacket.cpp @@ -456,7 +456,8 @@ nsresult DNSPacket::DecodeInternal( LOG(("TRR Decode %s RCODE %d\n", aHost.get(), rcode)); if (rcode) { if (aReason == nsHostRecord::TRR_UNSET) { - aReason = nsHostRecord::TRR_RCODE_FAIL; + aReason = rcode == 0x03 ? nsHostRecord::TRR_NXDOMAIN + : nsHostRecord::TRR_RCODE_FAIL; } } diff --git a/netwerk/dns/nsHostResolver.h b/netwerk/dns/nsHostResolver.h index fe6ff3231c6d..f5054cd2cd9d 100644 --- a/netwerk/dns/nsHostResolver.h +++ b/netwerk/dns/nsHostResolver.h @@ -119,6 +119,7 @@ class nsHostRecord : public mozilla::LinkedListElement>, TRR_SERVER_RESPONSE_ERR = 27, // Server responded with non-200 code TRR_RCODE_FAIL = 28, // DNS response contains a non-NOERROR rcode TRR_NO_CONNECTIVITY = 29, // Not confirmed because of no connectivity + TRR_NXDOMAIN = 30, // DNS response contains NXDOMAIN rcode (0x03) }; // Records the first reason that caused TRR to be skipped or to fail.