forked from mirrors/gecko-dev
bug 1453822 - TRR: add a mode for "explicitly turned off" r=mcmanus
... as opposed to off by default. MozReview-Commit-ID: EClrW33xGkb --HG-- extra : rebase_source : aa8de07950f0da41eb8136894b119308b0450319
This commit is contained in:
parent
1682e25e09
commit
9ad6beb28d
5 changed files with 17 additions and 11 deletions
|
|
@ -5318,7 +5318,7 @@ pref("network.captive-portal-service.backoffFactor", "5.0");
|
||||||
pref("network.captive-portal-service.enabled", false);
|
pref("network.captive-portal-service.enabled", false);
|
||||||
|
|
||||||
// DNS Trusted Recursive Resolver
|
// DNS Trusted Recursive Resolver
|
||||||
// 0 - off, 1 - race, 2 TRR first, 3 TRR only, 4 shadow
|
// 0 - default off, 1 - race, 2 TRR first, 3 TRR only, 4 shadow, 5 off by choice
|
||||||
pref("network.trr.mode", 0);
|
pref("network.trr.mode", 0);
|
||||||
// DNS-over-HTTP service to use, must be HTTPS://
|
// DNS-over-HTTP service to use, must be HTTPS://
|
||||||
pref("network.trr.uri", "");
|
pref("network.trr.uri", "");
|
||||||
|
|
|
||||||
|
|
@ -324,7 +324,7 @@ TRRService::Observe(nsISupports *aSubject,
|
||||||
void
|
void
|
||||||
TRRService::MaybeConfirm()
|
TRRService::MaybeConfirm()
|
||||||
{
|
{
|
||||||
if ((mMode == MODE_NATIVEONLY) || mConfirmer ||
|
if (TRR_DISABLED(mMode) || mConfirmer ||
|
||||||
mConfirmationState != CONFIRM_TRYING) {
|
mConfirmationState != CONFIRM_TRYING) {
|
||||||
LOG(("TRRService:MaybeConfirm mode=%d, mConfirmer=%p mConfirmationState=%d\n",
|
LOG(("TRRService:MaybeConfirm mode=%d, mConfirmer=%p mConfirmationState=%d\n",
|
||||||
(int)mMode, (void *)mConfirmer, (int)mConfirmationState));
|
(int)mMode, (void *)mConfirmer, (int)mConfirmationState));
|
||||||
|
|
@ -351,7 +351,7 @@ bool
|
||||||
TRRService::MaybeBootstrap(const nsACString &aPossible, nsACString &aResult)
|
TRRService::MaybeBootstrap(const nsACString &aPossible, nsACString &aResult)
|
||||||
{
|
{
|
||||||
MutexAutoLock lock(mLock);
|
MutexAutoLock lock(mLock);
|
||||||
if ((mMode == MODE_NATIVEONLY) || mBootstrapAddr.IsEmpty()) {
|
if (TRR_DISABLED(mMode) || mBootstrapAddr.IsEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -314,6 +314,9 @@ nsHostRecord::ResolveComplete()
|
||||||
case MODE_SHADOW:
|
case MODE_SHADOW:
|
||||||
AccumulateCategorical(Telemetry::LABELS_DNS_LOOKUP_ALGORITHM::trrShadow);
|
AccumulateCategorical(Telemetry::LABELS_DNS_LOOKUP_ALGORITHM::trrShadow);
|
||||||
break;
|
break;
|
||||||
|
case MODE_TRROFF:
|
||||||
|
AccumulateCategorical(Telemetry::LABELS_DNS_LOOKUP_ALGORITHM::trrOff);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mTRRUsed && !mTRRSuccess && mNativeSuccess && gTRRService) {
|
if (mTRRUsed && !mTRRSuccess && mNativeSuccess && gTRRService) {
|
||||||
|
|
@ -1267,12 +1270,12 @@ nsHostResolver::NameLookup(nsHostRecord *rec)
|
||||||
mode = MODE_NATIVEONLY;
|
mode = MODE_NATIVEONLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode != MODE_NATIVEONLY) {
|
if (!TRR_DISABLED(mode)) {
|
||||||
rv = TrrLookup(rec);
|
rv = TrrLookup(rec);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mode == MODE_PARALLEL) ||
|
if ((mode == MODE_PARALLEL) ||
|
||||||
(mode == MODE_NATIVEONLY) ||
|
TRR_DISABLED(mode) ||
|
||||||
(mode == MODE_SHADOW) ||
|
(mode == MODE_SHADOW) ||
|
||||||
((mode == MODE_TRRFIRST) && NS_FAILED(rv))) {
|
((mode == MODE_TRRFIRST) && NS_FAILED(rv))) {
|
||||||
rv = NativeLookup(rec);
|
rv = NativeLookup(rec);
|
||||||
|
|
|
||||||
|
|
@ -29,14 +29,17 @@ class nsResolveHostCallback;
|
||||||
namespace mozilla { namespace net {
|
namespace mozilla { namespace net {
|
||||||
class TRR;
|
class TRR;
|
||||||
enum ResolverMode {
|
enum ResolverMode {
|
||||||
MODE_NATIVEONLY, // TRR OFF
|
MODE_NATIVEONLY, // 0 - TRR OFF (by default)
|
||||||
MODE_PARALLEL, // race and use the first response
|
MODE_PARALLEL, // 1 - race and use the first response
|
||||||
MODE_TRRFIRST, // fallback to native on TRR failure
|
MODE_TRRFIRST, // 2 - fallback to native on TRR failure
|
||||||
MODE_TRRONLY, // don't even fallback
|
MODE_TRRONLY, // 3 - don't even fallback
|
||||||
MODE_SHADOW // race for stats, but always use native result
|
MODE_SHADOW, // 4 - race for stats, but always use native result
|
||||||
|
MODE_TRROFF // 5 - identical to MODE_NATIVEONLY but explicitly selected
|
||||||
};
|
};
|
||||||
} }
|
} }
|
||||||
|
|
||||||
|
#define TRR_DISABLED(x) (((x) == MODE_NATIVEONLY) || ((x) == MODE_TRROFF))
|
||||||
|
|
||||||
extern mozilla::Atomic<bool, mozilla::Relaxed> gNativeIsLocalhost;
|
extern mozilla::Atomic<bool, mozilla::Relaxed> gNativeIsLocalhost;
|
||||||
|
|
||||||
#define MAX_RESOLVER_THREADS_FOR_ANY_PRIORITY 3
|
#define MAX_RESOLVER_THREADS_FOR_ANY_PRIORITY 3
|
||||||
|
|
|
||||||
|
|
@ -3294,7 +3294,7 @@
|
||||||
"alert_emails": ["necko@mozilla.com", "dstenberg@mozilla.com"],
|
"alert_emails": ["necko@mozilla.com", "dstenberg@mozilla.com"],
|
||||||
"expires_in_version": "never",
|
"expires_in_version": "never",
|
||||||
"kind": "categorical",
|
"kind": "categorical",
|
||||||
"labels": ["nativeOnly", "trrRace", "trrFirst", "trrOnly", "trrShadow"],
|
"labels": ["nativeOnly", "trrRace", "trrFirst", "trrOnly", "trrShadow", "trrOff"],
|
||||||
"bug_numbers": [1434852],
|
"bug_numbers": [1434852],
|
||||||
"description": "DNS: lookup algorithm"
|
"description": "DNS: lookup algorithm"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue