зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1671164 - Rename nsHostResolver::Blacklisted to Blocklisted r=necko-reviewers,dragana
Differential Revision: https://phabricator.services.mozilla.com/D93491
This commit is contained in:
Родитель
72941695c0
Коммит
1a306ee2c7
|
@ -184,13 +184,13 @@ nsDNSRecord::GetNextAddr(uint16_t port, NetAddr* addr) {
|
|||
} else {
|
||||
mIter++;
|
||||
}
|
||||
} while (iter() && mHostRecord->Blacklisted(iter()));
|
||||
} while (iter() && mHostRecord->Blocklisted(iter()));
|
||||
|
||||
if (!iter() && startedFresh) {
|
||||
// If everything was blacklisted we want to reset the blacklist (and
|
||||
// If everything was blocklisted we want to reset the blocklist (and
|
||||
// likely relearn it) and return the first address. That is better
|
||||
// than nothing.
|
||||
mHostRecord->ResetBlacklist();
|
||||
mHostRecord->ResetBlocklist();
|
||||
mIter = mAddrInfo->Addresses().begin();
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ nsDNSRecord::GetAddresses(nsTArray<NetAddr>& aAddressArray) {
|
|||
mHostRecord->addr_info_lock.Lock();
|
||||
if (mHostRecord->addr_info) {
|
||||
for (const auto& address : mHostRecord->addr_info->Addresses()) {
|
||||
if (mHostRecord->Blacklisted(&address)) {
|
||||
if (mHostRecord->Blocklisted(&address)) {
|
||||
continue;
|
||||
}
|
||||
NetAddr* addr = aAddressArray.AppendElement(address);
|
||||
|
@ -329,7 +329,7 @@ nsDNSRecord::Rewind() {
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsDNSRecord::ReportUnusable(uint16_t aPort) {
|
||||
// right now we don't use the port in the blacklist
|
||||
// right now we don't use the port in the blocklist
|
||||
|
||||
MutexAutoLock lock(mHostRecord->addr_info_lock);
|
||||
|
||||
|
|
|
@ -292,21 +292,20 @@ AddrHostRecord::AddrHostRecord(const nsHostKey& key)
|
|||
mResolveAgain(false),
|
||||
mTrrAUsed(INIT),
|
||||
mTrrAAAAUsed(INIT),
|
||||
mTrrLock("AddrHostRecord.mTrrLock"),
|
||||
mBlacklistedCount(0) {}
|
||||
mTrrLock("AddrHostRecord.mTrrLock") {}
|
||||
|
||||
AddrHostRecord::~AddrHostRecord() {
|
||||
mCallbacks.clear();
|
||||
Telemetry::Accumulate(Telemetry::DNS_BLACKLIST_COUNT, mBlacklistedCount);
|
||||
Telemetry::Accumulate(Telemetry::DNS_BLACKLIST_COUNT, mUnusableCount);
|
||||
}
|
||||
|
||||
bool AddrHostRecord::Blacklisted(const NetAddr* aQuery) {
|
||||
bool AddrHostRecord::Blocklisted(const NetAddr* aQuery) {
|
||||
// must call locked
|
||||
LOG(("Checking blacklist for host [%s], host record [%p].\n", host.get(),
|
||||
LOG(("Checking unusable list for host [%s], host record [%p].\n", host.get(),
|
||||
this));
|
||||
|
||||
// skip the string conversion for the common case of no blacklist
|
||||
if (!mBlacklistedItems.Length()) {
|
||||
// skip the string conversion for the common case of no blocklist
|
||||
if (!mUnusableItems.Length()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -316,9 +315,9 @@ bool AddrHostRecord::Blacklisted(const NetAddr* aQuery) {
|
|||
}
|
||||
nsDependentCString strQuery(buf);
|
||||
|
||||
for (uint32_t i = 0; i < mBlacklistedItems.Length(); i++) {
|
||||
if (mBlacklistedItems.ElementAt(i).Equals(strQuery)) {
|
||||
LOG(("Address [%s] is blacklisted for host [%s].\n", buf, host.get()));
|
||||
for (uint32_t i = 0; i < mUnusableItems.Length(); i++) {
|
||||
if (mUnusableItems.ElementAt(i).Equals(strQuery)) {
|
||||
LOG(("Address [%s] is blocklisted for host [%s].\n", buf, host.get()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -329,27 +328,27 @@ bool AddrHostRecord::Blacklisted(const NetAddr* aQuery) {
|
|||
void AddrHostRecord::ReportUnusable(const NetAddr* aAddress) {
|
||||
// must call locked
|
||||
LOG(
|
||||
("Adding address to blacklist for host [%s], host record [%p]."
|
||||
("Adding address to blocklist for host [%s], host record [%p]."
|
||||
"used trr=%d\n",
|
||||
host.get(), this, mTRRSuccess));
|
||||
|
||||
++mBlacklistedCount;
|
||||
++mUnusableCount;
|
||||
|
||||
char buf[kIPv6CStrBufSize];
|
||||
if (aAddress->ToStringBuffer(buf, sizeof(buf))) {
|
||||
LOG(
|
||||
("Successfully adding address [%s] to blacklist for host "
|
||||
("Successfully adding address [%s] to blocklist for host "
|
||||
"[%s].\n",
|
||||
buf, host.get()));
|
||||
mBlacklistedItems.AppendElement(nsCString(buf));
|
||||
mUnusableItems.AppendElement(nsCString(buf));
|
||||
}
|
||||
}
|
||||
|
||||
void AddrHostRecord::ResetBlacklist() {
|
||||
void AddrHostRecord::ResetBlocklist() {
|
||||
// must call locked
|
||||
LOG(("Resetting blacklist for host [%s], host record [%p].\n", host.get(),
|
||||
LOG(("Resetting blocklist for host [%s], host record [%p].\n", host.get(),
|
||||
this));
|
||||
mBlacklistedItems.Clear();
|
||||
mUnusableItems.Clear();
|
||||
}
|
||||
|
||||
size_t AddrHostRecord::SizeOfIncludingThis(MallocSizeOf mallocSizeOf) const {
|
||||
|
@ -361,9 +360,9 @@ size_t AddrHostRecord::SizeOfIncludingThis(MallocSizeOf mallocSizeOf) const {
|
|||
n += addr_info ? addr_info->SizeOfIncludingThis(mallocSizeOf) : 0;
|
||||
n += mallocSizeOf(addr.get());
|
||||
|
||||
n += mBlacklistedItems.ShallowSizeOfExcludingThis(mallocSizeOf);
|
||||
for (size_t i = 0; i < mBlacklistedItems.Length(); i++) {
|
||||
n += mBlacklistedItems[i].SizeOfExcludingThisIfUnshared(mallocSizeOf);
|
||||
n += mUnusableItems.ShallowSizeOfExcludingThis(mallocSizeOf);
|
||||
for (size_t i = 0; i < mUnusableItems.Length(); i++) {
|
||||
n += mUnusableItems[i].SizeOfExcludingThisIfUnshared(mallocSizeOf);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
@ -1133,12 +1132,12 @@ nsresult nsHostResolver::ResolveHost(const nsACString& aHost,
|
|||
rec->CopyExpirationTimesAndFlagsFrom(unspecRec);
|
||||
} else if (addrUnspecRec->addr_info) {
|
||||
// Search for any valid address in the AF_UNSPEC entry
|
||||
// in the cache (not blacklisted and from the right
|
||||
// in the cache (not blocklisted and from the right
|
||||
// family).
|
||||
nsTArray<NetAddr> addresses;
|
||||
for (const auto& addr : addrUnspecRec->addr_info->Addresses()) {
|
||||
if ((af == addr.inet.family) &&
|
||||
!addrUnspecRec->Blacklisted(&addr)) {
|
||||
!addrUnspecRec->Blocklisted(&addr)) {
|
||||
addresses.AppendElement(addr);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ class nsHostRecord : public mozilla::LinkedListElement<RefPtr<nsHostRecord>>,
|
|||
TRR_NOT_CONFIRMED = 14, // TRR confirmation is not done yet
|
||||
TRR_DID_NOT_MAKE_QUERY = 15, // TrrLookup exited without doing a TRR query
|
||||
TRR_UNKNOWN_CHANNEL_FAILURE = 16, // unknown channel failure reason
|
||||
TRR_HOST_BLOCKED_TEMPORARY = 17, // host blacklisted
|
||||
TRR_HOST_BLOCKED_TEMPORARY = 17, // host blocklisted
|
||||
TRR_SEND_FAILED = 18, // The call to TRR::SendHTTPRequest failed
|
||||
TRR_NET_RESET = 19, // NS_ERROR_NET_RESET
|
||||
TRR_NET_TIMEOUT = 20, // NS_ERROR_NET_TIMEOUT
|
||||
|
@ -244,9 +244,9 @@ class AddrHostRecord final : public nsHostRecord {
|
|||
RefPtr<mozilla::net::AddrInfo> addr_info;
|
||||
mozilla::UniquePtr<mozilla::net::NetAddr> addr;
|
||||
|
||||
// hold addr_info_lock when calling the blacklist functions
|
||||
bool Blacklisted(const mozilla::net::NetAddr* query);
|
||||
void ResetBlacklist();
|
||||
// hold addr_info_lock when calling the blocklist functions
|
||||
bool Blocklisted(const mozilla::net::NetAddr* query);
|
||||
void ResetBlocklist();
|
||||
void ReportUnusable(const mozilla::net::NetAddr* aAddress);
|
||||
|
||||
size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const override;
|
||||
|
@ -311,12 +311,12 @@ class AddrHostRecord final : public nsHostRecord {
|
|||
|
||||
// The number of times ReportUnusable() has been called in the record's
|
||||
// lifetime.
|
||||
uint32_t mBlacklistedCount;
|
||||
uint32_t mUnusableCount = 0;
|
||||
|
||||
// a list of addresses associated with this record that have been reported
|
||||
// as unusable. the list is kept as a set of strings to make it independent
|
||||
// of gencnt.
|
||||
nsTArray<nsCString> mBlacklistedItems;
|
||||
nsTArray<nsCString> mUnusableItems;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(AddrHostRecord, ADDRHOSTRECORD_IID)
|
||||
|
|
|
@ -215,9 +215,7 @@ avoid-blacklist-and-whitelist:
|
|||
- netwerk/base/nsURLHelper.cpp
|
||||
- netwerk/cache/nsDiskCacheDeviceSQL.cpp
|
||||
- netwerk/cookie/CookieCommons.h
|
||||
- netwerk/dns/nsDNSService2.cpp
|
||||
- netwerk/dns/nsHostResolver.cpp
|
||||
- netwerk/dns/nsHostResolver.h
|
||||
- netwerk/dns/nsIDNService.cpp
|
||||
- netwerk/dns/nsIDNService.h
|
||||
- netwerk/dns/TRR.cpp
|
||||
|
|
Загрузка…
Ссылка в новой задаче