Title: [289288] branches/safari-613-branch/Source/WebKit
Revision
289288
Author
[email protected]
Date
2022-02-07 18:54:15 -0800 (Mon, 07 Feb 2022)

Log Message

Cherry-pick r288296. rdar://problem/88593227

    Disable fallback path to WebRTC platform sockets
    https://bugs.webkit.org/show_bug.cgi?id=235402

    Reviewed by Eric Carlson.

    We should not fallback to the legacy WebRTC socket code path in Cocoa ports.
    Instead, if we cannot create the corresponding sockets (in case of ssltcp candidates for instance),
    we mark the socket as closed.
    Minor refactoring to show that NetworkRTCUDPSocketCocoa code path should always be successful.

    Manually tested on meet.google.com which can make use of ssltcp candidates.

    * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
    * NetworkProcess/webrtc/NetworkRTCProvider.h:
    * NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm:
    * NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm:

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288296 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-613-branch/Source/WebKit/ChangeLog (289287 => 289288)


--- branches/safari-613-branch/Source/WebKit/ChangeLog	2022-02-08 02:54:12 UTC (rev 289287)
+++ branches/safari-613-branch/Source/WebKit/ChangeLog	2022-02-08 02:54:15 UTC (rev 289288)
@@ -1,5 +1,48 @@
 2022-02-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r288296. rdar://problem/88593227
+
+    Disable fallback path to WebRTC platform sockets
+    https://bugs.webkit.org/show_bug.cgi?id=235402
+    
+    Reviewed by Eric Carlson.
+    
+    We should not fallback to the legacy WebRTC socket code path in Cocoa ports.
+    Instead, if we cannot create the corresponding sockets (in case of ssltcp candidates for instance),
+    we mark the socket as closed.
+    Minor refactoring to show that NetworkRTCUDPSocketCocoa code path should always be successful.
+    
+    Manually tested on meet.google.com which can make use of ssltcp candidates.
+    
+    * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
+    * NetworkProcess/webrtc/NetworkRTCProvider.h:
+    * NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm:
+    * NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288296 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-20  Youenn Fablet  <[email protected]>
+
+            Disable fallback path to WebRTC platform sockets
+            https://bugs.webkit.org/show_bug.cgi?id=235402
+
+            Reviewed by Eric Carlson.
+
+            We should not fallback to the legacy WebRTC socket code path in Cocoa ports.
+            Instead, if we cannot create the corresponding sockets (in case of ssltcp candidates for instance),
+            we mark the socket as closed.
+            Minor refactoring to show that NetworkRTCUDPSocketCocoa code path should always be successful.
+
+            Manually tested on meet.google.com which can make use of ssltcp candidates.
+
+            * NetworkProcess/webrtc/NetworkRTCProvider.cpp:
+            * NetworkProcess/webrtc/NetworkRTCProvider.h:
+            * NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm:
+            * NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm:
+
+2022-02-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r288185. rdar://problem/87709485
 
     [Cocoa] Do not change preferred AudioSession buffer size when VPIO is running

Modified: branches/safari-613-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp (289287 => 289288)


--- branches/safari-613-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp	2022-02-08 02:54:12 UTC (rev 289287)
+++ branches/safari-613-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp	2022-02-08 02:54:15 UTC (rev 289288)
@@ -168,10 +168,9 @@
 
 #if PLATFORM(COCOA)
     if (m_platformUDPSocketsEnabled) {
-        if (auto socket = NetworkRTCUDPSocketCocoa::createUDPSocket(identifier, *this, address.value, minPort, maxPort, m_ipcConnection.copyRef(), String(attributedBundleIdentifierFromPageIdentifier(pageIdentifier)), isFirstParty, isRelayDisabled, WTFMove(domain))) {
-            addSocket(identifier, WTFMove(socket));
-            return;
-        }
+        auto socket = makeUnique<NetworkRTCUDPSocketCocoa>(identifier, *this, address.value, m_ipcConnection.copyRef(), String(attributedBundleIdentifierFromPageIdentifier(pageIdentifier)), isFirstParty, isRelayDisabled, WTFMove(domain));
+        addSocket(identifier, WTFMove(socket));
+        return;
     }
 #endif
 
@@ -187,7 +186,7 @@
             return;
 
         if (!m_isListeningSocketAuthorized) {
-            m_connection->connection().send(Messages::LibWebRTCNetwork::SignalClose(identifier, 1), 0);
+            signalSocketIsClosed(identifier);
             return;
         }
 
@@ -211,10 +210,12 @@
 
 #if PLATFORM(COCOA)
     if (m_platformTCPSocketsEnabled) {
-        if (auto socket = NetworkRTCTCPSocketCocoa::createClientTCPSocket(identifier, *this, remoteAddress.value, options, attributedBundleIdentifierFromPageIdentifier(pageIdentifier), isFirstParty, isRelayDisabled, domain, m_ipcConnection.copyRef())) {
+        auto socket = NetworkRTCTCPSocketCocoa::createClientTCPSocket(identifier, *this, remoteAddress.value, options, attributedBundleIdentifierFromPageIdentifier(pageIdentifier), isFirstParty, isRelayDisabled, domain, m_ipcConnection.copyRef());
+        if (socket)
             addSocket(identifier, WTFMove(socket));
-            return;
-        }
+        else
+            signalSocketIsClosed(identifier);
+        return;
     }
 #endif
 
@@ -224,7 +225,7 @@
 
         auto* session = m_connection->networkSession();
         if (!session) {
-            m_connection->connection().send(Messages::LibWebRTCNetwork::SignalClose(identifier, 1), 0);
+            signalSocketIsClosed(identifier);
             return;
         }
         callOnRTCNetworkThread([this, identifier, localAddress = RTCNetwork::isolatedCopy(localAddress.value), remoteAddress = RTCNetwork::isolatedCopy(remoteAddress.value), proxyInfo = proxyInfoFromSession(remoteAddress, *session), userAgent = WTFMove(userAgent).isolatedCopy(), options]() mutable {
@@ -429,6 +430,11 @@
     m_rtcNetworkThread.Post(RTC_FROM_HERE, this, 1, new NetworkMessageData(*this, WTFMove(callback)));
 }
 
+void NetworkRTCProvider::signalSocketIsClosed(LibWebRTCSocketIdentifier identifier)
+{
+    m_connection->connection().send(Messages::LibWebRTCNetwork::SignalClose(identifier, 1), 0);
+}
+
 #undef RTC_RELEASE_LOG
 #undef RTC_RELEASE_LOG_ERROR
 

Modified: branches/safari-613-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.h (289287 => 289288)


--- branches/safari-613-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.h	2022-02-08 02:54:12 UTC (rev 289287)
+++ branches/safari-613-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.h	2022-02-08 02:54:15 UTC (rev 289288)
@@ -149,6 +149,7 @@
 #if PLATFORM(COCOA)
     const String& attributedBundleIdentifierFromPageIdentifier(WebPageProxyIdentifier);
 #endif
+    void signalSocketIsClosed(WebCore::LibWebRTCSocketIdentifier);
 
     static constexpr size_t maxSockets { 256 };
 

Modified: branches/safari-613-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm (289287 => 289288)


--- branches/safari-613-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm	2022-02-08 02:54:12 UTC (rev 289287)
+++ branches/safari-613-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm	2022-02-08 02:54:15 UTC (rev 289288)
@@ -53,9 +53,7 @@
 
 std::unique_ptr<NetworkRTCProvider::Socket> NetworkRTCTCPSocketCocoa::createClientTCPSocket(LibWebRTCSocketIdentifier identifier, NetworkRTCProvider& rtcProvider, const rtc::SocketAddress& remoteAddress, int tcpOptions, const String& attributedBundleIdentifier, bool isFirstParty, bool isRelayDisabled, const WebCore::RegistrableDomain& domain, Ref<IPC::Connection>&& connection)
 {
-    // FIXME: We should migrate ssltcp candidates, maybe support OPT_TLS_INSECURE as well.
-    if ((tcpOptions & rtc::PacketSocketFactory::OPT_TLS_FAKE) || (tcpOptions & rtc::PacketSocketFactory::OPT_TLS_INSECURE))
-        return nullptr;
+    // FIXME: We should support ssltcp candidates, maybe support OPT_TLS_INSECURE as well.
     return makeUnique<NetworkRTCTCPSocketCocoa>(identifier, rtcProvider, remoteAddress, tcpOptions, attributedBundleIdentifier, isFirstParty, isRelayDisabled, domain, WTFMove(connection));
 }
 

Modified: branches/safari-613-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm (289287 => 289288)


--- branches/safari-613-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm	2022-02-08 02:54:12 UTC (rev 289287)
+++ branches/safari-613-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm	2022-02-08 02:54:15 UTC (rev 289288)
@@ -102,11 +102,6 @@
     return queue;
 }
 
-std::unique_ptr<NetworkRTCProvider::Socket> NetworkRTCUDPSocketCocoa::createUDPSocket(WebCore::LibWebRTCSocketIdentifier identifier, NetworkRTCProvider& rtcProvider, const rtc::SocketAddress& address, uint16_t minPort, uint16_t maxPort, Ref<IPC::Connection>&& connection, String&& attributedBundleIdentifier, bool isFirstParty, bool isRelayDisabled, const WebCore::RegistrableDomain& domain)
-{
-    return makeUnique<NetworkRTCUDPSocketCocoa>(identifier, rtcProvider, address, WTFMove(connection), WTFMove(attributedBundleIdentifier), isFirstParty, isRelayDisabled, domain);
-}
-
 NetworkRTCUDPSocketCocoa::NetworkRTCUDPSocketCocoa(WebCore::LibWebRTCSocketIdentifier identifier, NetworkRTCProvider& rtcProvider, const rtc::SocketAddress& address, Ref<IPC::Connection>&& connection, String&& attributedBundleIdentifier, bool isFirstParty, bool isRelayDisabled, const WebCore::RegistrableDomain& domain)
     : m_rtcProvider(rtcProvider)
     , m_identifier(identifier)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to