2014-09-21 02:10:18 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "GetAddrInfo.h"
|
|
|
|
#include "mozilla/net/DNS.h"
|
|
|
|
#include "prnetdb.h"
|
|
|
|
#include "nsHostResolver.h"
|
|
|
|
#include "nsError.h"
|
|
|
|
#include "mozilla/Mutex.h"
|
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "mozilla/StaticPtr.h"
|
|
|
|
#include "MainThreadUtils.h"
|
|
|
|
#include "mozilla/DebugOnly.h"
|
|
|
|
#include "mozilla/net/DNS.h"
|
2014-09-22 05:52:28 +04:00
|
|
|
#include <algorithm>
|
2015-02-19 08:14:00 +03:00
|
|
|
#include "prerror.h"
|
|
|
|
|
2015-05-19 21:15:34 +03:00
|
|
|
#include "mozilla/Logging.h"
|
2014-09-21 02:10:18 +04:00
|
|
|
|
2018-02-01 12:20:49 +03:00
|
|
|
#ifdef DNSQUERY_AVAILABLE
|
2014-10-01 12:58:30 +04:00
|
|
|
// There is a bug in windns.h where the type of parameter ppQueryResultsSet for
|
2014-09-21 02:10:18 +04:00
|
|
|
// DnsQuery_A is dependent on UNICODE being set. It should *always* be
|
|
|
|
// PDNS_RECORDA, but if UNICODE is set it is PDNS_RECORDW. To get around this
|
|
|
|
// we make sure that UNICODE is unset.
|
|
|
|
#undef UNICODE
|
|
|
|
#include <ws2tcpip.h>
|
|
|
|
#undef GetAddrInfo
|
2014-10-01 12:58:30 +04:00
|
|
|
#include <windns.h>
|
2014-09-21 02:10:18 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
|
2015-11-03 07:35:29 +03:00
|
|
|
static LazyLogModule gGetAddrInfoLog("GetAddrInfo");
|
|
|
|
#define LOG(msg, ...) \
|
|
|
|
MOZ_LOG(gGetAddrInfoLog, LogLevel::Debug, ("[DNS]: " msg, ##__VA_ARGS__))
|
|
|
|
#define LOG_WARNING(msg, ...) \
|
|
|
|
MOZ_LOG(gGetAddrInfoLog, LogLevel::Warning, ("[DNS]: " msg, ##__VA_ARGS__))
|
|
|
|
|
2018-02-01 12:20:49 +03:00
|
|
|
#ifdef DNSQUERY_AVAILABLE
|
2014-09-21 02:10:18 +04:00
|
|
|
////////////////////////////
|
|
|
|
// WINDOWS IMPLEMENTATION //
|
|
|
|
////////////////////////////
|
|
|
|
|
|
|
|
// Ensure consistency of PR_* and AF_* constants to allow for legacy usage of
|
|
|
|
// PR_* constants with this API.
|
|
|
|
static_assert(PR_AF_INET == AF_INET && PR_AF_INET6 == AF_INET6
|
|
|
|
&& PR_AF_UNSPEC == AF_UNSPEC, "PR_AF_* must match AF_*");
|
|
|
|
|
|
|
|
// We intentionally leak this mutex. This is because we can run into a
|
|
|
|
// situation where the worker threads are still running until the process
|
|
|
|
// is actually fully shut down, and at any time one of those worker
|
|
|
|
// threads can access gDnsapiInfoLock.
|
|
|
|
static OffTheBooksMutex* gDnsapiInfoLock = nullptr;
|
|
|
|
|
|
|
|
struct DnsapiInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(DnsapiInfo);
|
|
|
|
|
|
|
|
HMODULE mLibrary;
|
|
|
|
decltype(&DnsQuery_A) mDnsQueryFunc;
|
|
|
|
decltype(&DnsFree) mDnsFreeFunc;
|
|
|
|
|
|
|
|
private:
|
|
|
|
// This will either be called during shutdown of the GetAddrInfo module, or
|
|
|
|
// when a worker thread is done doing a lookup (ie: within
|
|
|
|
// _GetAddrInfo_Windows). Note that the lock must be held when this is
|
|
|
|
// called.
|
|
|
|
~DnsapiInfo()
|
|
|
|
{
|
|
|
|
if (gDnsapiInfoLock) {
|
|
|
|
gDnsapiInfoLock->AssertCurrentThreadOwns();
|
|
|
|
} else {
|
|
|
|
MOZ_ASSERT_UNREACHABLE("No mutex available during GetAddrInfo "
|
|
|
|
"shutdown.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
LOG("Freeing Dnsapi.dll");
|
|
|
|
MOZ_ASSERT(mLibrary);
|
|
|
|
DebugOnly<BOOL> rv = FreeLibrary(mLibrary);
|
2016-09-01 08:01:16 +03:00
|
|
|
NS_WARNING_ASSERTION(rv, "Failed to free Dnsapi.dll.");
|
2014-09-21 02:10:18 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static StaticRefPtr<DnsapiInfo> gDnsapiInfo;
|
|
|
|
|
|
|
|
static MOZ_ALWAYS_INLINE nsresult
|
|
|
|
_GetAddrInfoInit_Windows()
|
|
|
|
{
|
|
|
|
// This is necessary to ensure strict thread safety because if two threads
|
|
|
|
// run this function at the same time they can potentially create two
|
|
|
|
// mutexes.
|
|
|
|
MOZ_ASSERT(NS_IsMainThread(),
|
|
|
|
"Do not initialize GetAddrInfo off main thread!");
|
|
|
|
|
|
|
|
if (!gDnsapiInfoLock) {
|
|
|
|
gDnsapiInfoLock = new OffTheBooksMutex("GetAddrInfo.cpp::gDnsapiInfoLock");
|
|
|
|
}
|
|
|
|
OffTheBooksMutexAutoLock lock(*gDnsapiInfoLock);
|
|
|
|
|
|
|
|
if (gDnsapiInfo) {
|
|
|
|
MOZ_ASSERT_UNREACHABLE("GetAddrInfo is being initialized multiple times!");
|
|
|
|
return NS_ERROR_ALREADY_INITIALIZED;
|
|
|
|
}
|
|
|
|
|
|
|
|
HMODULE library = LoadLibraryA("Dnsapi.dll");
|
|
|
|
if (NS_WARN_IF(!library)) {
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
FARPROC dnsQueryFunc = GetProcAddress(library, "DnsQuery_A");
|
|
|
|
FARPROC dnsFreeFunc = GetProcAddress(library, "DnsFree");
|
|
|
|
if (NS_WARN_IF(!dnsQueryFunc) || NS_WARN_IF(!dnsFreeFunc)) {
|
|
|
|
DebugOnly<BOOL> rv = FreeLibrary(library);
|
2016-09-01 08:01:16 +03:00
|
|
|
NS_WARNING_ASSERTION(rv, "Failed to free Dnsapi.dll.");
|
2014-09-21 02:10:18 +04:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
DnsapiInfo* info = new DnsapiInfo;
|
|
|
|
info->mLibrary = library;
|
|
|
|
info->mDnsQueryFunc = (decltype(info->mDnsQueryFunc)) dnsQueryFunc;
|
|
|
|
info->mDnsFreeFunc = (decltype(info->mDnsFreeFunc)) dnsFreeFunc;
|
|
|
|
gDnsapiInfo = info;
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static MOZ_ALWAYS_INLINE nsresult
|
|
|
|
_GetAddrInfoShutdown_Windows()
|
|
|
|
{
|
|
|
|
OffTheBooksMutexAutoLock lock(*gDnsapiInfoLock);
|
|
|
|
|
|
|
|
if (NS_WARN_IF(!gDnsapiInfo) || NS_WARN_IF(!gDnsapiInfoLock)) {
|
|
|
|
MOZ_ASSERT_UNREACHABLE("GetAddrInfo not initialized!");
|
|
|
|
return NS_ERROR_NOT_INITIALIZED;
|
|
|
|
}
|
|
|
|
|
|
|
|
gDnsapiInfo = nullptr;
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2015-05-01 16:49:00 +03:00
|
|
|
// If successful, returns in aResult a TTL value that is smaller or
|
|
|
|
// equal with the one already there. Gets the TTL value by calling
|
|
|
|
// to dnsapi->mDnsQueryFunc and iterating through the returned
|
|
|
|
// records to find the one with the smallest TTL value.
|
2014-09-21 02:10:18 +04:00
|
|
|
static MOZ_ALWAYS_INLINE nsresult
|
2015-05-01 16:49:00 +03:00
|
|
|
_GetMinTTLForRequestType_Windows(DnsapiInfo * dnsapi, const char* aHost,
|
|
|
|
uint16_t aRequestType, unsigned int* aResult)
|
2014-09-21 02:10:18 +04:00
|
|
|
{
|
2015-05-01 16:49:00 +03:00
|
|
|
MOZ_ASSERT(dnsapi);
|
2014-09-21 02:10:18 +04:00
|
|
|
MOZ_ASSERT(aHost);
|
|
|
|
MOZ_ASSERT(aResult);
|
|
|
|
|
|
|
|
PDNS_RECORDA dnsData = nullptr;
|
|
|
|
DNS_STATUS status = dnsapi->mDnsQueryFunc(
|
2015-05-01 16:49:00 +03:00
|
|
|
aHost,
|
|
|
|
aRequestType,
|
|
|
|
(DNS_QUERY_STANDARD | DNS_QUERY_NO_NETBT | DNS_QUERY_NO_HOSTS_FILE
|
|
|
|
| DNS_QUERY_NO_MULTICAST | DNS_QUERY_ACCEPT_TRUNCATED_RESPONSE
|
|
|
|
| DNS_QUERY_DONT_RESET_TTL_VALUES),
|
|
|
|
nullptr,
|
|
|
|
&dnsData,
|
|
|
|
nullptr);
|
2014-09-21 02:10:18 +04:00
|
|
|
if (status == DNS_INFO_NO_RECORDS || status == DNS_ERROR_RCODE_NAME_ERROR
|
|
|
|
|| !dnsData) {
|
2015-05-01 16:49:00 +03:00
|
|
|
LOG("No DNS records found for %s. status=%X. aRequestType = %X\n",
|
|
|
|
aHost, status, aRequestType);
|
|
|
|
return NS_ERROR_FAILURE;
|
2014-09-21 02:10:18 +04:00
|
|
|
} else if (status != NOERROR) {
|
|
|
|
LOG_WARNING("DnsQuery_A failed with status %X.\n", status);
|
2015-05-01 16:49:00 +03:00
|
|
|
return NS_ERROR_UNEXPECTED;
|
2014-09-21 02:10:18 +04:00
|
|
|
}
|
|
|
|
|
2015-05-01 16:49:00 +03:00
|
|
|
for (PDNS_RECORDA curRecord = dnsData; curRecord; curRecord = curRecord->pNext) {
|
2014-09-21 02:10:18 +04:00
|
|
|
// Only records in the answer section are important
|
|
|
|
if (curRecord->Flags.S.Section != DnsSectionAnswer) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2015-05-01 16:49:00 +03:00
|
|
|
if (curRecord->wType == aRequestType) {
|
|
|
|
*aResult = std::min<unsigned int>(*aResult, curRecord->dwTtl);
|
|
|
|
} else {
|
|
|
|
LOG("Received unexpected record type %u in response for %s.\n",
|
|
|
|
curRecord->wType, aHost);
|
2014-09-21 02:10:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dnsapi->mDnsFreeFunc(dnsData, DNS_FREE_TYPE::DnsFreeRecordList);
|
2015-05-01 16:49:00 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static MOZ_ALWAYS_INLINE nsresult
|
2018-06-15 02:15:13 +03:00
|
|
|
_GetTTLData_Windows(const nsACString& aHost, uint32_t* aResult, uint16_t aAddressFamily)
|
2015-05-01 16:49:00 +03:00
|
|
|
{
|
2018-06-15 02:15:13 +03:00
|
|
|
MOZ_ASSERT(!aHost.IsEmpty());
|
2015-05-01 16:49:00 +03:00
|
|
|
MOZ_ASSERT(aResult);
|
|
|
|
if (aAddressFamily != PR_AF_UNSPEC &&
|
|
|
|
aAddressFamily != PR_AF_INET &&
|
|
|
|
aAddressFamily != PR_AF_INET6) {
|
|
|
|
return NS_ERROR_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<DnsapiInfo> dnsapi = nullptr;
|
2015-05-01 16:49:00 +03:00
|
|
|
{
|
|
|
|
OffTheBooksMutexAutoLock lock(*gDnsapiInfoLock);
|
|
|
|
dnsapi = gDnsapiInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!dnsapi) {
|
|
|
|
LOG_WARNING("GetAddrInfo has been shutdown or has not been initialized.");
|
|
|
|
return NS_ERROR_NOT_INITIALIZED;
|
|
|
|
}
|
|
|
|
|
|
|
|
// In order to avoid using ANY records which are not always implemented as a
|
|
|
|
// "Gimme what you have" request in hostname resolvers, we should send A
|
|
|
|
// and/or AAAA requests, based on the address family requested.
|
2017-09-29 01:47:43 +03:00
|
|
|
unsigned int ttl = (unsigned int)-1;
|
2015-05-01 16:49:00 +03:00
|
|
|
if (aAddressFamily == PR_AF_UNSPEC || aAddressFamily == PR_AF_INET) {
|
2018-06-15 02:15:13 +03:00
|
|
|
_GetMinTTLForRequestType_Windows(dnsapi, aHost.BeginReading(), DNS_TYPE_A, &ttl);
|
2015-05-01 16:49:00 +03:00
|
|
|
}
|
|
|
|
if (aAddressFamily == PR_AF_UNSPEC || aAddressFamily == PR_AF_INET6) {
|
2018-06-15 02:15:13 +03:00
|
|
|
_GetMinTTLForRequestType_Windows(dnsapi, aHost.BeginReading(), DNS_TYPE_AAAA, &ttl);
|
2015-05-01 16:49:00 +03:00
|
|
|
}
|
2014-09-21 02:10:18 +04:00
|
|
|
|
|
|
|
{
|
|
|
|
// dnsapi's destructor is not thread-safe, so we release explicitly here
|
|
|
|
OffTheBooksMutexAutoLock lock(*gDnsapiInfoLock);
|
|
|
|
dnsapi = nullptr;
|
|
|
|
}
|
|
|
|
|
2017-09-29 01:47:43 +03:00
|
|
|
if (ttl == (unsigned int)-1) {
|
2014-09-21 02:10:18 +04:00
|
|
|
LOG("No useable TTL found.");
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
*aResult = ttl;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
////////////////////////////////////
|
|
|
|
// PORTABLE RUNTIME IMPLEMENTATION//
|
|
|
|
////////////////////////////////////
|
|
|
|
|
|
|
|
static MOZ_ALWAYS_INLINE nsresult
|
2018-06-15 02:15:13 +03:00
|
|
|
_GetAddrInfo_Portable(const nsACString& aCanonHost, uint16_t aAddressFamily,
|
2018-05-16 23:05:03 +03:00
|
|
|
uint16_t aFlags, AddrInfo** aAddrInfo)
|
2014-09-21 02:10:18 +04:00
|
|
|
{
|
2018-06-15 02:15:13 +03:00
|
|
|
MOZ_ASSERT(!aCanonHost.IsEmpty());
|
2017-12-04 18:02:59 +03:00
|
|
|
MOZ_ASSERT(aAddrInfo);
|
2014-09-21 02:10:18 +04:00
|
|
|
|
|
|
|
// We accept the same aFlags that nsHostResolver::ResolveHost accepts, but we
|
|
|
|
// need to translate the aFlags into a form that PR_GetAddrInfoByName
|
|
|
|
// accepts.
|
|
|
|
int prFlags = PR_AI_ADDRCONFIG;
|
|
|
|
if (!(aFlags & nsHostResolver::RES_CANON_NAME)) {
|
|
|
|
prFlags |= PR_AI_NOCANONNAME;
|
|
|
|
}
|
|
|
|
|
|
|
|
// We need to remove IPv4 records manually because PR_GetAddrInfoByName
|
|
|
|
// doesn't support PR_AF_INET6.
|
|
|
|
bool disableIPv4 = aAddressFamily == PR_AF_INET6;
|
|
|
|
if (disableIPv4) {
|
|
|
|
aAddressFamily = PR_AF_UNSPEC;
|
|
|
|
}
|
|
|
|
|
2018-06-15 02:15:13 +03:00
|
|
|
PRAddrInfo* prai = PR_GetAddrInfoByName(aCanonHost.BeginReading(), aAddressFamily, prFlags);
|
2014-09-21 02:10:18 +04:00
|
|
|
|
|
|
|
if (!prai) {
|
|
|
|
return NS_ERROR_UNKNOWN_HOST;
|
|
|
|
}
|
|
|
|
|
2018-06-15 02:15:13 +03:00
|
|
|
nsAutoCString canonName;
|
2014-09-21 02:10:18 +04:00
|
|
|
if (aFlags & nsHostResolver::RES_CANON_NAME) {
|
2018-06-15 02:15:13 +03:00
|
|
|
canonName.Assign(PR_GetCanonNameFromAddrInfo(prai));
|
2014-09-21 02:10:18 +04:00
|
|
|
}
|
|
|
|
|
2015-05-08 21:18:20 +03:00
|
|
|
bool filterNameCollision = !(aFlags & nsHostResolver::RES_ALLOW_NAME_COLLISION);
|
2018-06-15 02:15:13 +03:00
|
|
|
nsAutoPtr<AddrInfo> ai(new AddrInfo(aCanonHost, prai, disableIPv4,
|
|
|
|
filterNameCollision, canonName));
|
2014-09-21 02:10:18 +04:00
|
|
|
PR_FreeAddrInfo(prai);
|
|
|
|
if (ai->mAddresses.isEmpty()) {
|
|
|
|
return NS_ERROR_UNKNOWN_HOST;
|
|
|
|
}
|
|
|
|
|
2017-12-04 18:02:59 +03:00
|
|
|
*aAddrInfo = ai.forget();
|
2014-09-21 02:10:18 +04:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//////////////////////////////////////
|
|
|
|
// COMMON/PLATFORM INDEPENDENT CODE //
|
|
|
|
//////////////////////////////////////
|
|
|
|
nsresult
|
|
|
|
GetAddrInfoInit() {
|
|
|
|
LOG("Initializing GetAddrInfo.\n");
|
|
|
|
|
2018-02-01 12:20:49 +03:00
|
|
|
#ifdef DNSQUERY_AVAILABLE
|
2014-09-21 02:10:18 +04:00
|
|
|
return _GetAddrInfoInit_Windows();
|
|
|
|
#else
|
|
|
|
return NS_OK;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
GetAddrInfoShutdown() {
|
|
|
|
LOG("Shutting down GetAddrInfo.\n");
|
|
|
|
|
2018-02-01 12:20:49 +03:00
|
|
|
#ifdef DNSQUERY_AVAILABLE
|
2014-09-21 02:10:18 +04:00
|
|
|
return _GetAddrInfoShutdown_Windows();
|
|
|
|
#else
|
|
|
|
return NS_OK;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2018-06-15 02:15:13 +03:00
|
|
|
GetAddrInfo(const nsACString& aHost, uint16_t aAddressFamily, uint16_t aFlags,
|
2018-05-16 23:05:03 +03:00
|
|
|
AddrInfo** aAddrInfo, bool aGetTtl)
|
2014-09-21 02:10:18 +04:00
|
|
|
{
|
2018-06-15 02:15:13 +03:00
|
|
|
if (NS_WARN_IF(aHost.IsEmpty()) || NS_WARN_IF(!aAddrInfo)) {
|
2014-09-21 02:10:18 +04:00
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
|
|
|
|
2018-02-01 12:20:49 +03:00
|
|
|
#ifdef DNSQUERY_AVAILABLE
|
2014-09-21 02:10:18 +04:00
|
|
|
// The GetTTLData needs the canonical name to function properly
|
|
|
|
if (aGetTtl) {
|
|
|
|
aFlags |= nsHostResolver::RES_CANON_NAME;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-06-15 02:15:13 +03:00
|
|
|
nsAutoCString host(aHost);
|
2018-02-01 12:20:49 +03:00
|
|
|
if (gNativeIsLocalhost) {
|
|
|
|
// pretend we use the given host but use IPv4 localhost instead!
|
2018-06-15 02:15:13 +03:00
|
|
|
host = NS_LITERAL_CSTRING("localhost");
|
2018-02-01 12:20:49 +03:00
|
|
|
aAddressFamily = PR_AF_INET;
|
|
|
|
}
|
|
|
|
|
2017-12-04 18:02:59 +03:00
|
|
|
*aAddrInfo = nullptr;
|
2018-06-15 02:15:13 +03:00
|
|
|
nsresult rv = _GetAddrInfo_Portable(host, aAddressFamily, aFlags,
|
2018-05-16 23:05:03 +03:00
|
|
|
aAddrInfo);
|
2014-09-21 02:10:18 +04:00
|
|
|
|
2018-02-01 12:20:49 +03:00
|
|
|
#ifdef DNSQUERY_AVAILABLE
|
2014-09-21 02:10:18 +04:00
|
|
|
if (aGetTtl && NS_SUCCEEDED(rv)) {
|
|
|
|
// Figure out the canonical name, or if that fails, just use the host name
|
|
|
|
// we have.
|
2018-06-15 02:15:13 +03:00
|
|
|
nsAutoCString name;
|
2017-11-30 10:30:27 +03:00
|
|
|
if (*aAddrInfo != nullptr && !(*aAddrInfo)->mCanonicalName.IsEmpty()) {
|
2018-06-15 02:15:13 +03:00
|
|
|
name = (*aAddrInfo)->mCanonicalName;
|
2014-09-21 02:10:18 +04:00
|
|
|
} else {
|
2018-06-15 02:15:13 +03:00
|
|
|
name = host;
|
2014-09-21 02:10:18 +04:00
|
|
|
}
|
|
|
|
|
2018-06-15 02:15:13 +03:00
|
|
|
LOG("Getting TTL for %s (cname = %s).", host.get(), name.get());
|
2017-11-09 23:43:00 +03:00
|
|
|
uint32_t ttl = 0;
|
2015-05-01 16:49:00 +03:00
|
|
|
nsresult ttlRv = _GetTTLData_Windows(name, &ttl, aAddressFamily);
|
2014-09-21 02:10:18 +04:00
|
|
|
if (NS_SUCCEEDED(ttlRv)) {
|
2017-12-04 18:02:59 +03:00
|
|
|
(*aAddrInfo)->ttl = ttl;
|
2018-06-15 02:15:13 +03:00
|
|
|
LOG("Got TTL %u for %s (name = %s).", ttl, host.get(), name.get());
|
2014-09-21 02:10:18 +04:00
|
|
|
} else {
|
2018-06-15 02:15:13 +03:00
|
|
|
LOG_WARNING("Could not get TTL for %s (cname = %s).", host.get(), name.get());
|
2014-09-21 02:10:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace net
|
|
|
|
} // namespace mozilla
|