Commit Graph

752 Commits

Author SHA1 Message Date
16476ad1d2 Merge commit 'upstream-main' into master
Bug: 261600888
Test: none, build files to be updated in follow up cl
Change-Id: Ib520938290c6bbdee4a9f73b6419b6c947a96ec4
2022-12-27 23:04:04 -08:00
def85594ea Resolve TURN hostname specific to network family behind field trial.
Already implemented for STUN hostname resolution, but TURN port resolves hostnames separately. Reusing the field trial key reserved in bugs.webrtc.org/14334 but with a new parameter so as to not affect ongoing rollouts.

Bug: webrtc:14319, webrtc:14131
Change-Id: Idf771fb2f0de7849f8b701be8ee05a98b8d242f3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/285981
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Cr-Commit-Position: refs/heads/main@{#38811}
2022-12-05 13:34:57 +00:00
7eea667228 Fix bugs in discarding stun address
If mdns obfuscation is enabled, the stun address "MUST NOT be
considered redundant" when it is equal to local socket address.
Reference:
https://datatracker.ietf.org/doc/html/draft-ietf-mmusic-mdns-ice-candidates-03#section-3.1.2.2

This fixes

Bug: webrtc:13426
Change-Id: I28e981fd1b8818f6f8294bc3fedf23b8d9146819
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/285421
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38774}
2022-11-30 13:51:41 +00:00
e844aad41a Convert StreamInterfaceChannel to new API
Bug: webrtc:14632
Change-Id: I5c78fe6903680c65efde5d09a8988b97256a22ad
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/283526
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38642}
2022-11-16 10:01:28 +00:00
dd4c4068d9 Convert MemoryStream to use new StreamInterface
Bug: webrtc:14632
Change-Id: Id6a7e011a6102e829a14de246d07a9aab1e6934f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/283620
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38639}
2022-11-16 09:51:42 +00:00
11840ce684 Deprecate void* forms of StreamInterface::Read and ::Write
Updates the code to use the new interfaces

Bug: webrtc:14632
Change-Id: I33b2a25b5968de0251e3cbc84076afc013ecef6e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/282680
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38601}
2022-11-10 12:40:20 +00:00
3e7e15d240 Reland "move relay server priority assignment to port_allocator"
This is a reland of commit b395f5bd5c5be7a3b54fc85ca482759a56a0cd6e
Downstream project has been fixed.

Original change's description:
> move relay server priority assignment to port_allocator
>
> which knows more about the internals of ICE.
> Remove the relay server config priority field which was used to
> specify the relative priority of TURN servers. This is now handled
> internally by CreateRelayPortArgs without being exposed.
>
> Also rename BasicPortAllocator::AddTurnServer to
> BasicPortAllocator::AddTurnServerForTesting since it is a test-only
> method.
>
> BUG=webrtc:13195,webrtc:14539
>
> Change-Id: Id36cbf0187b7a84d1a9b53860f31994f3c7589f0
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/280224
> Commit-Queue: Philipp Hancke <phancke@microsoft.com>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#38520}

Bug: webrtc:13195,webrtc:14539
Change-Id: I617b611de97e4013c7286e3345073ca7589065c5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/281662
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Philipp Hancke <phancke@microsoft.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38543}
2022-11-03 12:16:08 +00:00
0487c5797a stats: implement candidate-pair lastPacket(Sent|Received)Timestamp
https://w3c.github.io/webrtc-stats/#dom-rtcicecandidatepairstats-lastpacketsenttimestamp
https://w3c.github.io/webrtc-stats/#dom-rtcicecandidatepairstats-lastpacketreceivedtimestamp

which are useful together with the ice-restart-necessary logic mentioned
in
  https://w3c.github.io/webrtc-pc/#dictionary-rtcofferoptions-members

BUG=webrtc:14619

Change-Id: I4a8ab00a37fbd4af8b948720c83787cbdfc6b9a3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/281281
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#38534}
2022-11-02 12:16:21 +00:00
936c1af16d Revert "move relay server priority assignment to port_allocator"
This reverts commit b395f5bd5c5be7a3b54fc85ca482759a56a0cd6e.

Reason for revert: Breaks downstream project. Jonas will help to reland this CL.

Original change's description:
> move relay server priority assignment to port_allocator
>
> which knows more about the internals of ICE.
> Remove the relay server config priority field which was used to
> specify the relative priority of TURN servers. This is now handled
> internally by CreateRelayPortArgs without being exposed.
>
> Also rename BasicPortAllocator::AddTurnServer to
> BasicPortAllocator::AddTurnServerForTesting since it is a test-only
> method.
>
> BUG=webrtc:13195,webrtc:14539
>
> Change-Id: Id36cbf0187b7a84d1a9b53860f31994f3c7589f0
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/280224
> Commit-Queue: Philipp Hancke <phancke@microsoft.com>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#38520}

Bug: webrtc:13195,webrtc:14539
Change-Id: I7ca087a272793908f003cea6c32efe6214e54028
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/281340
Owners-Override: Artem Titov <titovartem@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#38524}
2022-11-01 13:29:28 +00:00
b395f5bd5c move relay server priority assignment to port_allocator
which knows more about the internals of ICE.
Remove the relay server config priority field which was used to
specify the relative priority of TURN servers. This is now handled
internally by CreateRelayPortArgs without being exposed.

Also rename BasicPortAllocator::AddTurnServer to
BasicPortAllocator::AddTurnServerForTesting since it is a test-only
method.

BUG=webrtc:13195,webrtc:14539

Change-Id: Id36cbf0187b7a84d1a9b53860f31994f3c7589f0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/280224
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38520}
2022-11-01 09:59:37 +00:00
fd91d02210 ice: include tiebreaker in computation of foundation attribute (tests)
split from the actual change for easier review and cherry-picking.

BUG=webrtc:14605

Change-Id: I7dbaf8e1f4a03f35a5d8c4da1a2784b00589bfc3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/280680
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38519}
2022-11-01 07:47:23 +00:00
08b882d762 ice: include tiebreaker in computation of foundation attribute
the foundation attribute is currently calculated as
  CRC32(baseaddress, protocol, relayprotocol)
which is a way to satisfy the requirements from
  https://www.rfc-editor.org/rfc/rfc5245#section-4.1.1.3

However, this leaks the base address which defeats the
MDNS obfuscation described in
  https://datatracker.ietf.org/doc/draft-ietf-mmusic-mdns-ice-candidates/
since the CRC32 can be reversed using a table lookup as shown in
  https://github.com/niespodd/webrtc-local-ip-leak/

To defeat that lookup, "seed" the CRC32 with the ICE tie-breaker which is a randomly picked unsigned 64 bit integer described in
  https://www.rfc-editor.org/rfc/rfc5245#section-5.2

The tie-breaker is not known to Javascript and adding it scopes the foundation within the peer connection as described in section 4.1.1.3

To manually test (preferably with a DCHECK for IceTiebreaker() in ComputeFoundation)
- gather candidates twice on https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/ and observe that the foundations are not the same after this change
- create two RTCPeerConnections with {iceCandidatePoolSize: 1}, create a datachannel, call setLocalDescription, inspect the candidates and observe that the foundations are not the same after this change.

Unit test changes have been split into a separate CL for easier integration.

BUG=webrtc:14605

Change-Id: I6bbad1635b48997b00ae74d251ae357bf8afd12f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/280621
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38485}
2022-10-27 15:50:02 +00:00
666c333625 Stop revalidating STUN packets with the wrong password
Investigation showed that a function is revalidating STUN packets
against the wrong password.
This CL also allows absl/strings/escape.h as #include.

Bug: chromium:1177125
Change-Id: Ie068d4c076a5462f2922a012f5e1de23aa6c0b06
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/279560
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38438}
2022-10-19 09:38:09 +00:00
d806705623 [TurnPort] Bring back stricter assumptions after recent fixes.
This also swithces lifetime management of entries to using
std::unique_ptr.

Bug: chromium:1374310
Change-Id: I5a2c89e9b3bcf7bceec2a4e5347750540ee21e1f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/279521
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38432}
2022-10-18 14:04:35 +00:00
98a9efaa98 [TurnPort] Keep track of connections in TurnEntry.
Track which connection instances are associated with with TurnEntry
instances. This fixes a bug whereby removing an entry by address that
more than one Connection instances had in common, caused operations
such as SendTo and HandleConnectionDestroyed to fail because no
entry could be found.

Also, as requested: A ham sandwich walks into a bar and orders a beer, bartender says “sorry, we don’t serve food here.”

Bug: chromium:1374310
Change-Id: Ie45a99346f8015b10a212d80fbd32255d1544669
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/279264
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38429}
2022-10-18 10:44:28 +00:00
f0e65bab0e Accept ArrayView in ICE agent interface where feasible.
Ownership does not need to cross the interface boundary, so ArrayView can be safely accepted in ForgetStateForConnections and PruneConnections.

Bug: webrtc:14131
Change-Id: I18a739aea1dc47976d17925e9bca3461225bf803
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/278629
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38418}
2022-10-17 15:03:33 +00:00
44874d1944 Remove TurnAddMultiMapping experiment.
Bug: webrtc:10350
Change-Id: I4991e6bd9f1d4b04863c684c6d01ca264b296aad
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/279284
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38414}
2022-10-17 12:32:49 +00:00
3c5a1bf8f3 [TurnPort] Update CreateOrRefreshEntry function, step 2.
This removes the deprecated method in favor of the new one
introduced in
https://webrtc-review.googlesource.com/c/src/+/279440

Bug: chromium:1374310
Change-Id: I662d5cad9a48d18d9425e4d2754a966df68f7056
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/279441
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38411}
2022-10-17 09:46:10 +00:00
a92ba28922 [TurnPort] Fix error return value in TurnPort::SendTo
While looking into chromium:1374310 I noticed that the function was
returning 0 in a particular case. 0 isn't a valid return value as per
this shortened snippet from connection.cc [1] specifically meant to
catch this:

  int sent = port_->SendTo(...);
  if (sent <= 0) {
    RTC_DCHECK(sent < 0);
    error_ = port_->GetError();
    ...

[1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/p2p/base/connection.cc;l=1687

Also propagating the socket error value in case of failure.

Bug: chromium:1374310
Change-Id: Ie00f60388d53d4127c1d419ab0352e0574044485
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/279282
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38408}
2022-10-17 07:18:28 +00:00
9c606497d1 [TurnPort] Check if turn entry was found when deleting a connection.
This is a simple way to avoid crashing, but the underlying issue
of why the entry has been removed, is a bit more complex to fix
and will be fixed in a follow-up CL.

Bug: chromium:1374310
Change-Id: I9dc0cf9e1acdcc3b3a205104346cc835b3f79c1b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/279283
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38405}
2022-10-16 21:59:13 +00:00
ee0766fcc7 [TurnPort] Update CreateOrRefreshEntry function, step 1.
TurnEntry objects need to be more aware of which specific connection
instances are associated with an entry so that entries don't get
removed only based on the address while connection instances remain.

Bug: chromium:1374310
Change-Id: I8a5d9f70ef9e74497a01e2e2cba924d5e6f518a8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/279440
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38404}
2022-10-16 20:58:04 +00:00
47627626dd STUN: Avoid ICE message revalidation wherever possible.
Also call out the places where it happens explicitly - these are places
that need to be redesigned.

Bug: chromium:1177125
Change-Id: I3237d028dbb22380e8fbf7cedb03e965d1fcf2aa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/279022
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38384}
2022-10-13 10:55:31 +00:00
5c9b7da038 Add missing dependencies.
Bug: b/251890128
Change-Id: Ia9312797a5552ad1ceb4a80968014b849121a1b9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/278580
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Christoffer Jansson <jansson@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38333}
2022-10-10 10:18:37 +00:00
7b3d61ccf0 Add test coverage for P2PTransportChannel refactor (#8/8)
This converts all P2PTransportChannel unit tests to parameterized tests, with a string parameter for the field_trials which is used to enable the refactor. This adds a variation of each existing test using the refactored code path.

Tests are initialized twice, once for legacy and refactored path each, to strike a balance between file name length and descriptiveness.

Bug: webrtc:14367, webrtc:14131
Change-Id: I0469550d571ed389804eb486fe5bd22504e59373
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/275303
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38162}
2022-09-21 16:49:02 +00:00
cbad8add12 Delete rtc::Message and rtc::MessageHandler
Bug: webrtc:9702
Change-Id: I5b9a42264b2a84acce9096b21102233b4ed2f5ce
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/276261
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38160}
2022-09-21 15:15:30 +00:00
52dd1a566a Reland "Add an active ICE controller that wraps a legacy controller (#7/n)"
This is a reland of commit 6326c9c201c7331d68c9beb0a93f6f6e21063cd2

Original change's description:
> Add an active ICE controller that wraps a legacy controller (#7/n)
>
> The wrapping ICE controller will allow existing ICE controller implementations to migrate to the active interface, and eventually deprecate the legacy interface.
>
> Follow-up CL has unit tests for P2PTransportChannel using the new wrapping controller.
>
> Bug: webrtc:14367, webrtc:14131
> Change-Id: I6c517449ff1e503e8268a7ef91afda793723fdeb
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/275302
> Reviewed-by: Per Kjellander <perkj@webrtc.org>
> Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
> Commit-Queue: Sameer Vijaykar <samvi@google.com>
> Cr-Commit-Position: refs/heads/main@{#38130}

Bug: webrtc:14367, webrtc:14131
Change-Id: I5662595db1df8c06b3acac9b39749f236906fa7e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/276044
Auto-Submit: Sameer Vijaykar <samvi@google.com>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38149}
2022-09-21 11:02:26 +00:00
50a2a73ed9 Revert "Add an active ICE controller that wraps a legacy controller (#7/n)"
This reverts commit 6326c9c201c7331d68c9beb0a93f6f6e21063cd2.

Reason for revert: breaks upstream project

Original change's description:
> Add an active ICE controller that wraps a legacy controller (#7/n)
>
> The wrapping ICE controller will allow existing ICE controller implementations to migrate to the active interface, and eventually deprecate the legacy interface.
>
> Follow-up CL has unit tests for P2PTransportChannel using the new wrapping controller.
>
> Bug: webrtc:14367, webrtc:14131
> Change-Id: I6c517449ff1e503e8268a7ef91afda793723fdeb
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/275302
> Reviewed-by: Per Kjellander <perkj@webrtc.org>
> Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
> Commit-Queue: Sameer Vijaykar <samvi@google.com>
> Cr-Commit-Position: refs/heads/main@{#38130}

Bug: webrtc:14367, webrtc:14131
Change-Id: I61dd98de62657852068c7566b55f19f662df9ff4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/276043
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Auto-Submit: Sameer Vijaykar <samvi@google.com>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#38131}
2022-09-20 14:37:49 +00:00
6326c9c201 Add an active ICE controller that wraps a legacy controller (#7/n)
The wrapping ICE controller will allow existing ICE controller implementations to migrate to the active interface, and eventually deprecate the legacy interface.

Follow-up CL has unit tests for P2PTransportChannel using the new wrapping controller.

Bug: webrtc:14367, webrtc:14131
Change-Id: I6c517449ff1e503e8268a7ef91afda793723fdeb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/275302
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Cr-Commit-Position: refs/heads/main@{#38130}
2022-09-20 13:52:24 +00:00
1adcde9dfe Use active ICE controller in P2PTransportChannel with an adapter (#6/n)
Controlled by a field trial, P2PTransportChannel can now use an active ICE controller instead of a legacy ICE controller.

P2PTransportChannel unit tests need non-trivial changes to exercise the refactored code path, so the testing changes are added in a follow-up CL.

Bug: webrtc:14367, webrtc:14131
Change-Id: I00d4930a5692c7d6d331ea9d6c2a2199304e363c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/274701
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38114}
2022-09-19 09:41:30 +00:00
282de03603 Fix P2PTransportChannel unit tests to not rely on connections ordering
Tests currently rely on the sorted order of connections held within the ICE controller, which sorts the connections by usability. The internal ordering is not part of the ICE controller contract.

Tests use the ordering as a proxy for certain expectations, so changed the tests to explicitly test the expectations.

Bug: webrtc:14367, webrtc:1413
Change-Id: Iaf33c61f6eb968c2c93a0265b6c48ad6218e23a8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/275304
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Cr-Commit-Position: refs/heads/main@{#38088}
2022-09-15 08:15:47 +00:00
a01e7275c2 Fix race at destruction in StunServerTests and reenable them on tsan
Bug: webrtc:2517
Change-Id: I3d4c65f250fe5048def68cbae45b5637a9ce68a1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/275483
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38087}
2022-09-15 08:04:37 +00:00
64edb15e1e Make P2PTransportChannel implement IceAgentInterface (#5/n)
This functionally no-op change adds the methods to allow an active ICE controller to manipulate the connection used by the ICE transport. Most methods reuse existing code, this will be explicitly marked for cleanup with a follow-up CL which adds active ICE controller support.

Non-trivial changes are needed for P2PTransportChannel unit tests to cover the new code, and these are also being added in a follow-up CL.

Bug: webrtc:14367, webrtc:14131
Change-Id: I4f012efcd8cb5766eb8c6f0872de50f8375f3a73
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/275301
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Cr-Commit-Position: refs/heads/main@{#38081}
2022-09-14 14:18:46 +00:00
18408391ad Keep state internally of connections added to P2PTransportChannel (#4/n)
P2PTransportChannel currently relies on the ICE controller to keep track of this, even though P2PTransportChannel is actually supposed to hold the mutable connections.

Reading connections from the ICE controller also leaks some internal state from the ICE controller through the ordering of connections, which isn't strictly part of the interface. This change is a step towards fixing this.

This change is functionally no-op for now. The internal state will be used behind a field-trial in a future CL. That is also when some tests will be updated to work with the new internal state.

Bug: webrtc:14367, webrtc:1413
Change-Id: I6f8c5d805c780411fe940926f192fd2d6ce86d29
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/275081
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38080}
2022-09-14 14:11:09 +00:00
6fa8a759b4 Add an active ICE controller factory to IceTransportInit (#3/n)
P2PTransportChannel can then use either of the ICE controller factories configured with field trials.

Bug: webrtc:14367, webrtc:14131
Change-Id: I09ab99673d6ef81f56abe88987f5b67d84c24cb5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/271292
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Cr-Commit-Position: refs/heads/main@{#38076}
2022-09-14 11:40:36 +00:00
094ee30504 Add an active ICE controller interface (#2/n)
This interface will be implemented by "new" ICE controllers that actively manage the connection used by the transport.

Bug: webrtc:14367, webrtc:14131
Change-Id: I0858884b0decd2a17ae9ca8617a043a085c61d54
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/271291
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38066}
2022-09-13 07:45:39 +00:00
b88c3b5e02 Add an ICE agent interface (#1/n)
This interface will be implemented by P2PTransportChannel in a follow-up CL. It will allow an ICE controller to request actions to manipulate the connection used by the transport.

Bug: webrtc:14367, webrtc:1413
Change-Id: I5cd171bd09c8dfc88588f8fc06e87d74a90b5216
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/271290
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Cr-Commit-Position: refs/heads/main@{#38062}
2022-09-12 14:00:27 +00:00
4bed30c37f Remove sigslot signals from TurnPort
Bug: webrtc:11943
Change-Id: If07749a4fa47bd06a2a11be9d334a4a39a1026b1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/272651
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37998}
2022-09-02 15:37:13 +00:00
2e70294b7c Ship family-specific STUN hostname resolution behind field trial param.
Since multiple fixes are bundled behind the WebRTC-IPv6NetworkResolutionFixes
field trial, this allows more flexibility if the launch is found to cause any
issues.

Bug: webrtc:14334, webrtc:14131
Change-Id: I2e73b8984db1f3d292cecab98e29c53cfac1c070
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/273903
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Auto-Submit: Sameer Vijaykar <samvi@google.com>
Cr-Commit-Position: refs/heads/main@{#37995}
2022-09-02 14:01:31 +00:00
a5d80a7646 Add PreferGlobalIPv6Address param to IPv6NetworkResolutionFixes field trial string.
Bug: webrtc:14334
Change-Id: Iedbc18d2ebd77b4fedd4e7936a5aa4da35279328
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/273101
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Sameer Vijaykar <samvi@google.com>
Reviewed-by: Diep Bui <diepbp@webrtc.org>
Commit-Queue: Diep Bui <diepbp@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37991}
2022-09-02 10:39:58 +00:00
9068f456a3 Improve IPv6 selection logic when gathering candidates.
- If there are more than 5 IPv6 networks, then diversify IPv6 interface types selection.
- Passing field_trial from peer_connection_factory.cc when creating BasicPortAllocator object.

Bug: webrtc:14334
Change-Id: I7d100d944f4e60414e3421f422997bc3f168cc24
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/271581
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Diep Bui <diepbp@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37924}
2022-08-29 10:51:28 +00:00
b7da81621c Replace RTCCertificateGeneratorCallback interface with an AnyInvocable
follow up of the https://webrtc-review.googlesource.com/c/src/+/272402

Bug: None
Change-Id: Ie47aff9fccdb4037c1f560801c780dd549b373ae
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/272553
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37870}
2022-08-22 16:53:14 +00:00
34f6d1c06d Migrate cricket::Port asynchronous calls to TaskQueueBase interface
Bug: webrtc:9702
Change-Id: I13e05ced190ca64a217961d74ee92dd9c15ed8ce
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/271641
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37849}
2022-08-19 21:35:47 +00:00
4a3b5ccfd5 Reland "dtls: allow dtls role to change during DTLS restart"
This is a reland of commit 02b5f3c9c12cddf3fc6e9125238b77ddb44f3b53
without making SetRemoteFingerprint private (but adding a deprecation warning)

Original change's description:
> dtls: allow dtls role to change during DTLS restart
>
> which is characterized by a change in remote fingerprint and
> causes a new DTLS handshake. This allows renegotiating the
> client/server role as well.
> Spec guidance is provided by
>   https://www.rfc-editor.org/rfc/rfc5763#section-6.6
>
> BUG=webrtc:5768
>
> Change-Id: I0e8630c0c5907cc92720762a4320ad21a6190d28
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/271680
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Philipp Hancke <phancke@microsoft.com>
> Cr-Commit-Position: refs/heads/main@{#37821}

Bug: webrtc:5768
Change-Id: I8dd674db8b683160013e1b4aa7776775d130978f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/272221
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#37838}
2022-08-19 10:55:47 +00:00
4d715385e1 Remove rtc::MessageHandler usage in pseudo tcp unittests
Bug: webrtc:11988
Change-Id: Iac41f18410828333b40012d4876db23673d198d8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/272283
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37834}
2022-08-19 09:19:46 +00:00
fb5fc4307d Revert "dtls: allow dtls role to change during DTLS restart"
This reverts commit 02b5f3c9c12cddf3fc6e9125238b77ddb44f3b53.

Reason for revert: SetRemoteFingerprint called by downstream code.

Original change's description:
> dtls: allow dtls role to change during DTLS restart
>
> which is characterized by a change in remote fingerprint and
> causes a new DTLS handshake. This allows renegotiating the
> client/server role as well.
> Spec guidance is provided by
>   https://www.rfc-editor.org/rfc/rfc5763#section-6.6
>
> BUG=webrtc:5768
>
> Change-Id: I0e8630c0c5907cc92720762a4320ad21a6190d28
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/271680
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Philipp Hancke <phancke@microsoft.com>
> Cr-Commit-Position: refs/heads/main@{#37821}

Bug: webrtc:5768
Change-Id: I266b7fdc9cc0b6dc9d3fa732fca37407b98e0816
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/272220
Owners-Override: Björn Terelius <terelius@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37822}
2022-08-18 11:49:56 +00:00
02b5f3c9c1 dtls: allow dtls role to change during DTLS restart
which is characterized by a change in remote fingerprint and
causes a new DTLS handshake. This allows renegotiating the
client/server role as well.
Spec guidance is provided by
  https://www.rfc-editor.org/rfc/rfc5763#section-6.6

BUG=webrtc:5768

Change-Id: I0e8630c0c5907cc92720762a4320ad21a6190d28
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/271680
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#37821}
2022-08-18 11:23:16 +00:00
e51918f9ce Cleanup TurnServer
Use TimeDelta type instead of raw ints
Remove usage of rtc::MessageHandler and RTC_FROM_HERE
Reduce usage of sigslots
Simplify storage for Channels and Permissions.
Classes that were previously self deleted are now deleted by their owner

Bug: webrtc:9702, webrtc:11318, webrtc:11943
Change-Id: I32c63c11c16c42ae58a65020b1c20a03b21a5abb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/271298
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37808}
2022-08-17 08:55:13 +00:00
cca884d1cc Migrate away from rtc::MessageHandler in p2p unittests
Bug: webrtc:9702, webrtc:11318
Change-Id: Ifde789af67f9761fc4a88b398d250bd83eba94de
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/271287
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37796}
2022-08-16 13:14:25 +00:00
2aaef45876 Replace Invoke in tests with SendTask test helper
Bug: webrtc:11318
Change-Id: I14e3fbc694d41c785a61c88d8207005c681576c4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/271540
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37774}
2022-08-12 23:42:16 +00:00
71434ae614 Rename PreferGlobalIPv6ToLinkLocal field trial to group IPv6 fixes.
This combines the below IPv6 fixes into the field trial
WebRTC-IPv6NetworkResolutionFixes:
1. Prefer global IPv6 address over link local
2. Use address family when resolving STUN hostname

WebRTC-PreferGlobalIPv6ToLinkLocal is currently in Dev but will be
rolled back temporarily.

Bug: webrtc:14334, webrtc:14131
Change-Id: I1fb3f55c4c5f3c5c0b441ece30e72cf393e074d0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/271340
Reviewed-by: Diep Bui <diepbp@webrtc.org>
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37754}
2022-08-11 16:24:12 +00:00