[WebRTC] ICE candidates should be filtered according a policy
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Feb 2017 21:29:01 +0000 (21:29 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Feb 2017 21:29:01 +0000 (21:29 +0000)
commitc65158e0fe6d05d3aac448b9ea2979736b43b158
tree697142774c7456fcb94281d7b563f72724c239cc
parentc7c4968d2083c0387b4874062d96f7af6ad6be5d
[WebRTC] ICE candidates should be filtered according a policy
https://bugs.webkit.org/show_bug.cgi?id=168348

Patch by Youenn Fablet <youenn@apple.com> on 2017-02-21
Reviewed by Alex Christensen.

Source/WebCore:

Covered by manual tests. Should be covered in the future by layout tests with dedicated internals API.

Adding support for ICE candidate filtering at RTCPeerConnection level.
If ICE candidate filtering is on (by default), host candidates are stored and not sent immediately.
Reflexive candidates are purged from raddr information to not leak the host IP address.

Stored candidates may be advertised to the JS layer if RTCController is notified of a change of filtering policy.
To implement that, PeerConnectionBackend stores all filtered out candidates and RTCPeerConnection register
themselves to RTCController to get notifications of filtering policy changes.

Making RTCPeerConnection use setPendingActivity throughout its lifetime.
This ensures it does not get collected until the page is off or close() is called on the object.

Adding support for enumerating or not all interfaces at libwebrtc level.
This choice is done at creation of the peer connection.

* Modules/mediastream/PeerConnectionBackend.cpp:
(WebCore::PeerConnectionBackend::enableICECandidateFiltering):
(WebCore::PeerConnectionBackend::disableICECandidateFiltering):
(WebCore::filterICECandidate):
(WebCore::PeerConnectionBackend::newICECandidate):
* Modules/mediastream/PeerConnectionBackend.h:
* Modules/mediastream/RTCController.cpp: Added.
(WebCore::RTCController::remove):
(WebCore::RTCController::add):
(WebCore::RTCController::disableICECandidateFiltering):
(WebCore::RTCController::enableICECandidateFiltering):
* Modules/mediastream/RTCController.h: Added.
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::create):
(WebCore::RTCPeerConnection::close):
(WebCore::RTCPeerConnection::rtcController):
(WebCore::RTCPeerConnection::registerToController):
(WebCore::RTCPeerConnection::unregisterFromController):
* Modules/mediastream/RTCPeerConnection.h:
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::OnIceCandidate):
* WebCore.xcodeproj/project.pbxproj:
* page/Page.h:
(WebCore::Page::rtcController):
* platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
(WebCore::LibWebRTCProvider::createPeerConnection):
* platform/mediastream/libwebrtc/LibWebRTCProvider.h:

Source/WebKit2:

Adding the possibility for the UI process to control the ICE candidate filtering and whether libwebrtc can
enumerate all interfaces or not.

Disabling ICE candidate filtering for the moment.
Enabling to enumerate all interfaces for the moment.

In the future, ICE candidate filtering should be tied to getUserMedia.
Interface enumeration should be disabled with the default configuration.
We should do that once we have sufficient testing in various network infrastructures.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::initializeWebPage):
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::disableICECandidateFiltering):
(WebKit::WebPage::enableICECandidateFiltering):
(WebKit::WebPage::disableEnumeratingAllNetworkInterfaces):
(WebKit::WebPage::enableEnumeratingAllNetworkInterfaces):
* WebProcess/WebPage/WebPage.messages.in:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212745 268f45cc-cd09-0410-ab3c-d52691b4dbfc
21 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/PeerConnectionBackend.cpp
Source/WebCore/Modules/mediastream/PeerConnectionBackend.h
Source/WebCore/Modules/mediastream/RTCController.cpp [new file with mode: 0644]
Source/WebCore/Modules/mediastream/RTCController.h [new file with mode: 0644]
Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp
Source/WebCore/Modules/mediastream/RTCPeerConnection.h
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/inspector/InspectorOverlay.cpp
Source/WebCore/page/Page.h
Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp
Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPageCreationParameters.cpp
Source/WebKit2/Shared/WebPageCreationParameters.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in