From 78b9a3a57c07af5832cae150afcb6dd646f081f1 Mon Sep 17 00:00:00 2001 From: Valentin Gosu Date: Fri, 18 Oct 2024 16:28:30 +0000 Subject: [PATCH] Bug 1924682 - Fix tier 3 builds by ifdefing nsINetworkLinkService::HasNonLocalIPv6Address r=necko-reviewers,kershaw Differential Revision: https://phabricator.services.mozilla.com/D226114 --- netwerk/dns/GetAddrInfo.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/netwerk/dns/GetAddrInfo.cpp b/netwerk/dns/GetAddrInfo.cpp index ee9bdd7d3f2f..715b08b49562 100644 --- a/netwerk/dns/GetAddrInfo.cpp +++ b/netwerk/dns/GetAddrInfo.cpp @@ -201,6 +201,15 @@ _DNSQuery_A_SingleLabel(const nsACString& aCanonHost, uint16_t aAddressFamily, // PORTABLE RUNTIME IMPLEMENTATION// //////////////////////////////////// +static bool SkipIPv6DNSLookup() { +#if defined(XP_WIN) || defined(XP_LINUX) || defined(XP_MACOSX) + return StaticPrefs::network_dns_skip_ipv6_when_no_addresses() && + !nsINetworkLinkService::HasNonLocalIPv6Address(); +#else + return false; +#endif +} + static MOZ_ALWAYS_INLINE nsresult _GetAddrInfo_Portable(const nsACString& aCanonHost, uint16_t aAddressFamily, nsIDNSService::DNSFlags aFlags, AddrInfo** aAddrInfo) { @@ -222,8 +231,7 @@ _GetAddrInfo_Portable(const nsACString& aCanonHost, uint16_t aAddressFamily, aAddressFamily = PR_AF_UNSPEC; } - if (StaticPrefs::network_dns_skip_ipv6_when_no_addresses() && - !nsINetworkLinkService::HasNonLocalIPv6Address()) { + if (SkipIPv6DNSLookup()) { // If the family was AF_UNSPEC initially, make it AF_INET // when there are no IPv6 addresses. // If the DNS request specified IPv6 specifically, let it