<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[259690] branches/safari-609-branch/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/259690">259690</a></dd>
<dt>Author</dt> <dd>alancoon@apple.com</dd>
<dt>Date</dt> <dd>2020-04-07 17:32:31 -0700 (Tue, 07 Apr 2020)</dd>
</dl>

<h3>Log Message</h3>
<pre>Cherry-pick <a href="http://trac.webkit.org/projects/webkit/changeset/259338">r259338</a>. rdar://problem/61269727

    Support resolution of IPv6 STUN/TURN addresses
    https://bugs.webkit.org/show_bug.cgi?id=209808

    Reviewed by Eric Carlson.

    Source/WebCore:

    Add family access to IPAddress to support both IPv4 and IPv6.
    Store IPAddress internal value as IPv6 and cast them to IPv4 on demand.

    * platform/network/DNS.h:
    * platform/network/soup/DNSResolveQueueSoup.cpp:
    (WebCore::resolvedWithObserverCallback):

    Source/WebKit:

    Update code to support IPv6 addresses when doing DNS resolution of TURN/STUN servers.
    Refactor code to share more code between Cocoa ports and non Cocoa ports.
    Manually tested with external IPv6 TURN servers.

    * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
    (WebKit::NetworkRTCProvider::createResolver):
    * NetworkProcess/webrtc/NetworkRTCResolverCocoa.cpp:
    (WebKit::resolvedName):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259338 268f45cc-cd09-0410-ab3c-d52691b4dbfc</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari609branchSourceWebCoreChangeLog">branches/safari-609-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari609branchSourceWebCoreplatformnetworkDNSh">branches/safari-609-branch/Source/WebCore/platform/network/DNS.h</a></li>
<li><a href="#branchessafari609branchSourceWebCoreplatformnetworksoupDNSResolveQueueSoupcpp">branches/safari-609-branch/Source/WebCore/platform/network/soup/DNSResolveQueueSoup.cpp</a></li>
<li><a href="#branchessafari609branchSourceWebKitChangeLog">branches/safari-609-branch/Source/WebKit/ChangeLog</a></li>
<li><a href="#branchessafari609branchSourceWebKitNetworkProcesswebrtcNetworkRTCProvidercpp">branches/safari-609-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp</a></li>
<li><a href="#branchessafari609branchSourceWebKitNetworkProcesswebrtcNetworkRTCResolverCocoacpp">branches/safari-609-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCResolverCocoa.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari609branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-609-branch/Source/WebCore/ChangeLog (259689 => 259690)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/Source/WebCore/ChangeLog      2020-04-08 00:32:26 UTC (rev 259689)
+++ branches/safari-609-branch/Source/WebCore/ChangeLog 2020-04-08 00:32:31 UTC (rev 259690)
</span><span class="lines">@@ -1,5 +1,50 @@
</span><span class="cx"> 2020-04-07  Russell Epstein  <repstein@apple.com>
</span><span class="cx"> 
</span><ins>+        Cherry-pick r259338. rdar://problem/61269727
+
+    Support resolution of IPv6 STUN/TURN addresses
+    https://bugs.webkit.org/show_bug.cgi?id=209808
+    
+    Reviewed by Eric Carlson.
+    
+    Source/WebCore:
+    
+    Add family access to IPAddress to support both IPv4 and IPv6.
+    Store IPAddress internal value as IPv6 and cast them to IPv4 on demand.
+    
+    * platform/network/DNS.h:
+    * platform/network/soup/DNSResolveQueueSoup.cpp:
+    (WebCore::resolvedWithObserverCallback):
+    
+    Source/WebKit:
+    
+    Update code to support IPv6 addresses when doing DNS resolution of TURN/STUN servers.
+    Refactor code to share more code between Cocoa ports and non Cocoa ports.
+    Manually tested with external IPv6 TURN servers.
+    
+    * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
+    (WebKit::NetworkRTCProvider::createResolver):
+    * NetworkProcess/webrtc/NetworkRTCResolverCocoa.cpp:
+    (WebKit::resolvedName):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259338 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-04-01  youenn fablet  <youenn@apple.com>
+
+            Support resolution of IPv6 STUN/TURN addresses
+            https://bugs.webkit.org/show_bug.cgi?id=209808
+
+            Reviewed by Eric Carlson.
+
+            Add family access to IPAddress to support both IPv4 and IPv6.
+            Store IPAddress internal value as IPv6 and cast them to IPv4 on demand.
+
+            * platform/network/DNS.h:
+            * platform/network/soup/DNSResolveQueueSoup.cpp:
+            (WebCore::resolvedWithObserverCallback):
+
+2020-04-07  Russell Epstein  <repstein@apple.com>
+
</ins><span class="cx">         Cherry-pick r259316. rdar://problem/61269751
</span><span class="cx"> 
</span><span class="cx">     IndexedDB: destroy WebIDBServer when session is removed in network process
</span></span></pre></div>
<a id="branchessafari609branchSourceWebCoreplatformnetworkDNSh"></a>
<div class="modfile"><h4>Modified: branches/safari-609-branch/Source/WebCore/platform/network/DNS.h (259689 => 259690)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/Source/WebCore/platform/network/DNS.h 2020-04-08 00:32:26 UTC (rev 259689)
+++ branches/safari-609-branch/Source/WebCore/platform/network/DNS.h    2020-04-08 00:32:31 UTC (rev 259690)
</span><span class="lines">@@ -27,35 +27,56 @@
</span><span class="cx"> 
</span><span class="cx"> #if OS(WINDOWS)
</span><span class="cx"> #include <winsock2.h>
</span><ins>+#include <ws2tcpip.h>
</ins><span class="cx"> #else
</span><span class="cx"> #include <netinet/in.h>
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #include <wtf/Forward.h>
</span><ins>+#include <wtf/Optional.h>
+#include <wtf/Variant.h>
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-class WEBCORE_EXPORT IPAddress {
</del><ins>+class IPAddress {
</ins><span class="cx"> public:
</span><del>-    explicit IPAddress(const struct sockaddr_in& address)
</del><ins>+    static Optional<IPAddress> fromSockAddrIn6(const struct sockaddr_in6&);
+    explicit IPAddress(const struct in_addr& address)
+        : m_address(address)
</ins><span class="cx">     {
</span><del>-        memset(&m_address, 0, sizeof(struct sockaddr_in));
-        m_address = address;
</del><span class="cx">     }
</span><span class="cx"> 
</span><del>-    const struct in_addr& getSinAddr() { return m_address.sin_addr; };
</del><ins>+    explicit IPAddress(const struct in6_addr& address)
+        : m_address(address)
+    {
+    }
</ins><span class="cx"> 
</span><ins>+    bool isIPv4() const { return WTF::holds_alternative<struct in_addr>(m_address); }
+    bool isIPv6() const { return WTF::holds_alternative<struct in6_addr>(m_address); }
+
+    const struct in_addr& ipv4Address() const { return WTF::get<struct in_addr>(m_address); }
+    const struct in6_addr& ipv6Address() const { return WTF::get<struct in6_addr>(m_address); }
+
</ins><span class="cx"> private:
</span><del>-    struct sockaddr_in m_address;
</del><ins>+    Variant<struct in_addr, struct in6_addr> m_address;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> enum class DNSError { Unknown, CannotResolve, Cancelled };
</span><span class="cx"> 
</span><del>-using DNSAddressesOrError = Expected<Vector<WebCore::IPAddress>, DNSError>;
-using DNSCompletionHandler = WTF::CompletionHandler<void(DNSAddressesOrError&&)>;
</del><ins>+using DNSAddressesOrError = Expected<Vector<IPAddress>, DNSError>;
+using DNSCompletionHandler = CompletionHandler<void(DNSAddressesOrError&&)>;
</ins><span class="cx"> 
</span><span class="cx"> WEBCORE_EXPORT void prefetchDNS(const String& hostname);
</span><span class="cx"> WEBCORE_EXPORT void resolveDNS(const String& hostname, uint64_t identifier, DNSCompletionHandler&&);
</span><span class="cx"> WEBCORE_EXPORT void stopResolveDNS(uint64_t identifier);
</span><span class="cx"> 
</span><ins>+inline Optional<IPAddress> IPAddress::fromSockAddrIn6(const struct sockaddr_in6& address)
+{
+    if (address.sin6_family == AF_INET6)
+        return IPAddress { address.sin6_addr };
+    if (address.sin6_family == AF_INET)
+        return IPAddress {reinterpret_cast<const struct sockaddr_in&>(address).sin_addr };
+    return { };
</ins><span class="cx"> }
</span><ins>+
+}
</ins></span></pre></div>
<a id="branchessafari609branchSourceWebCoreplatformnetworksoupDNSResolveQueueSoupcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-609-branch/Source/WebCore/platform/network/soup/DNSResolveQueueSoup.cpp (259689 => 259690)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/Source/WebCore/platform/network/soup/DNSResolveQueueSoup.cpp  2020-04-08 00:32:26 UTC (rev 259689)
+++ branches/safari-609-branch/Source/WebCore/platform/network/soup/DNSResolveQueueSoup.cpp     2020-04-08 00:32:31 UTC (rev 259690)
</span><span class="lines">@@ -143,9 +143,16 @@
</span><span class="cx">     Vector<WebCore::IPAddress> addresses;
</span><span class="cx">     addresses.reserveInitialCapacity(1);
</span><span class="cx">     int len;
</span><del>-    auto* ipAddress = reinterpret_cast<const struct sockaddr_in*>(soup_address_get_sockaddr(address, &len));
-    for (unsigned i = 0; i < sizeof(*ipAddress) / len; i++)
-        addresses.uncheckedAppend(WebCore::IPAddress(ipAddress[i]));
</del><ins>+    // FIXME: Support multiple addresses, IPv6 and IPv4.
+    auto* ipAddress = soup_address_get_sockaddr(address, &len);
+    if (ipAddress) {
+        if (auto address = IPAddress::fromSockAddrIn6(reinterpret_cast<const struct sockaddr_in6&>(*ipAddress)))
+            addresses.uncheckedAppend(*address);
+    }
+    if (addresses.isEmpty()) {
+        completionHandler(makeUnexpected(WebCore::DNSError::CannotResolve));
+        return;
+    }
</ins><span class="cx"> 
</span><span class="cx">     completionHandler(addresses);
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchessafari609branchSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-609-branch/Source/WebKit/ChangeLog (259689 => 259690)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/Source/WebKit/ChangeLog       2020-04-08 00:32:26 UTC (rev 259689)
+++ branches/safari-609-branch/Source/WebKit/ChangeLog  2020-04-08 00:32:31 UTC (rev 259690)
</span><span class="lines">@@ -1,5 +1,52 @@
</span><span class="cx"> 2020-04-07  Russell Epstein  <repstein@apple.com>
</span><span class="cx"> 
</span><ins>+        Cherry-pick r259338. rdar://problem/61269727
+
+    Support resolution of IPv6 STUN/TURN addresses
+    https://bugs.webkit.org/show_bug.cgi?id=209808
+    
+    Reviewed by Eric Carlson.
+    
+    Source/WebCore:
+    
+    Add family access to IPAddress to support both IPv4 and IPv6.
+    Store IPAddress internal value as IPv6 and cast them to IPv4 on demand.
+    
+    * platform/network/DNS.h:
+    * platform/network/soup/DNSResolveQueueSoup.cpp:
+    (WebCore::resolvedWithObserverCallback):
+    
+    Source/WebKit:
+    
+    Update code to support IPv6 addresses when doing DNS resolution of TURN/STUN servers.
+    Refactor code to share more code between Cocoa ports and non Cocoa ports.
+    Manually tested with external IPv6 TURN servers.
+    
+    * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
+    (WebKit::NetworkRTCProvider::createResolver):
+    * NetworkProcess/webrtc/NetworkRTCResolverCocoa.cpp:
+    (WebKit::resolvedName):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259338 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-04-01  youenn fablet  <youenn@apple.com>
+
+            Support resolution of IPv6 STUN/TURN addresses
+            https://bugs.webkit.org/show_bug.cgi?id=209808
+
+            Reviewed by Eric Carlson.
+
+            Update code to support IPv6 addresses when doing DNS resolution of TURN/STUN servers.
+            Refactor code to share more code between Cocoa ports and non Cocoa ports.
+            Manually tested with external IPv6 TURN servers.
+
+            * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
+            (WebKit::NetworkRTCProvider::createResolver):
+            * NetworkProcess/webrtc/NetworkRTCResolverCocoa.cpp:
+            (WebKit::resolvedName):
+
+2020-04-07  Russell Epstein  <repstein@apple.com>
+
</ins><span class="cx">         Cherry-pick r259316. rdar://problem/61269751
</span><span class="cx"> 
</span><span class="cx">     IndexedDB: destroy WebIDBServer when session is removed in network process
</span></span></pre></div>
<a id="branchessafari609branchSourceWebKitNetworkProcesswebrtcNetworkRTCProvidercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-609-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp (259689 => 259690)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp    2020-04-08 00:32:26 UTC (rev 259689)
+++ branches/safari-609-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp       2020-04-08 00:32:31 UTC (rev 259690)
</span><span class="lines">@@ -201,11 +201,10 @@
</span><span class="cx">     NetworkRTCSocket(makeObjectIdentifier<LibWebRTCSocketIdentifierType>(decoder.destinationID()), *this).didReceiveMessage(connection, decoder);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if PLATFORM(COCOA)
</del><span class="cx"> 
</span><span class="cx"> void NetworkRTCProvider::createResolver(uint64_t identifier, const String& address)
</span><span class="cx"> {
</span><del>-    auto resolver = NetworkRTCResolver::create(identifier, [this, identifier](WebCore::DNSAddressesOrError&& result) mutable {
</del><ins>+    WebCore::DNSCompletionHandler completionHandler = [this, identifier](auto&& result) {
</ins><span class="cx">         if (!result.has_value()) {
</span><span class="cx">             if (result.error() != WebCore::DNSError::Cancelled)
</span><span class="cx">                 m_connection->connection().send(Messages::WebRTCResolver::ResolvedAddressError(1), identifier);
</span><span class="lines">@@ -212,50 +211,37 @@
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        auto addresses = WTF::map(result.value(), [] (auto& address) {
-            return RTCNetwork::IPAddress { rtc::IPAddress { address.getSinAddr() } };
-        });
</del><ins>+        Vector<RTCNetwork::IPAddress> ipAddresses;
+        ipAddresses.reserveInitialCapacity(result.value().size());
+        for (auto& address : result.value()) {
+            if (address.isIPv4())
+                ipAddresses.uncheckedAppend(rtc::IPAddress { address.ipv4Address() });
+            else if (address.isIPv6())
+                ipAddresses.uncheckedAppend(rtc::IPAddress { address.ipv6Address() });
+        }
</ins><span class="cx"> 
</span><del>-        m_connection->connection().send(Messages::WebRTCResolver::SetResolvedAddress(addresses), identifier);
-    });
</del><ins>+        m_connection->connection().send(Messages::WebRTCResolver::SetResolvedAddress(ipAddresses), identifier);
+    };
+
+#if PLATFORM(COCOA)
+    auto resolver = NetworkRTCResolver::create(identifier, WTFMove(completionHandler));
</ins><span class="cx">     resolver->start(address);
</span><span class="cx">     m_resolvers.add(identifier, WTFMove(resolver));
</span><ins>+#else
+    WebCore::resolveDNS(address, identifier.toUInt64(), WTFMove(completionHandler));
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void NetworkRTCProvider::stopResolver(uint64_t identifier)
</span><span class="cx"> {
</span><ins>+#if PLATFORM(COCOA)
</ins><span class="cx">     if (auto resolver = m_resolvers.take(identifier))
</span><span class="cx">         resolver->stop();
</span><del>-}
-
</del><span class="cx"> #else
</span><del>-
-void NetworkRTCProvider::createResolver(uint64_t identifier, const String& address)
-{
-    auto completionHandler = [this, identifier](WebCore::DNSAddressesOrError&& result) mutable {
-        if (!result.has_value()) {
-            if (result.error() != WebCore::DNSError::Cancelled)
-                m_connection->connection().send(Messages::WebRTCResolver::ResolvedAddressError(1), identifier);
-            return;
-        }
-
-        auto addresses = WTF::map(result.value(), [] (auto& address) {
-            return RTCNetwork::IPAddress { rtc::IPAddress { address.getSinAddr() } };
-        });
-
-        m_connection->connection().send(Messages::WebRTCResolver::SetResolvedAddress(addresses), identifier);
-    };
-
-    WebCore::resolveDNS(address, identifier, WTFMove(completionHandler));
</del><ins>+    WebCore::stopResolveDNS(identifier.toUInt64());
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkRTCProvider::stopResolver(uint64_t identifier)
-{
-    WebCore::stopResolveDNS(identifier);
-}
-
-#endif
-
</del><span class="cx"> void NetworkRTCProvider::closeListeningSockets(Function<void()>&& completionHandler)
</span><span class="cx"> {
</span><span class="cx">     if (!m_isListeningSocketAuthorized) {
</span></span></pre></div>
<a id="branchessafari609branchSourceWebKitNetworkProcesswebrtcNetworkRTCResolverCocoacpp"></a>
<div class="modfile"><h4>Modified: branches/safari-609-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCResolverCocoa.cpp (259689 => 259690)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCResolverCocoa.cpp       2020-04-08 00:32:26 UTC (rev 259689)
+++ branches/safari-609-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCResolverCocoa.cpp  2020-04-08 00:32:31 UTC (rev 259690)
</span><span class="lines">@@ -55,10 +55,8 @@
</span><span class="cx"> 
</span><span class="cx">     for (size_t index = 0; index < count; ++index) {
</span><span class="cx">         CFDataRef data = (CFDataRef)CFArrayGetValueAtIndex(resolvedAddresses, index);
</span><del>-        auto* address = reinterpret_cast<const struct sockaddr_in*>(CFDataGetBytePtr(data));
-        if (address->sin_family == AF_INET)
-            addresses.uncheckedAppend(WebCore::IPAddress(*address));
-        // FIXME: We should probably return AF_INET6 addresses as well.
</del><ins>+        if (auto address = IPAddress::fromSockAddrIn6(*reinterpret_cast<const struct sockaddr_in6*>(CFDataGetBytePtr(data))))
+            addresses.uncheckedAppend(*address);
</ins><span class="cx">     }
</span><span class="cx">     if (addresses.isEmpty()) {
</span><span class="cx">         resolver->completed(makeUnexpected(WebCore::DNSError::CannotResolve));
</span></span></pre>
</div>
</div>

</body>
</html>