955 Commits

Author SHA1 Message Date
Danil Chapovalov
4b2176aa86 Refactor P2PTransportChannel unittests to propagate field trials
Propagate field trials using Environment with intent to change various types, BasicPortAllocator in particular, to take Environment at construction.

Bug: webrtc:42220378
Change-Id: I488aa82aa606e38f16aa22a032c60f4d191ede72
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/377040
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43887}
2025-02-13 21:41:17 -08:00
Danil Chapovalov
7a0b955223 Delete one of BasicPortAllocator constructors as unused
Bug: webrtc:42232556
Change-Id: Ia0a461d646fa1773099e11cbb03851381642bec0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/376560
Auto-Submit: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43859}
2025-02-08 01:07:31 -08:00
Jonas Oreland
4b39cb3eb6 Reland "Move piggybacking controller from P2PTC to DTLS transport"
This reverts commit 4de5839c1117e5bb96148c8575a74a69bde02768.

Reason for revert: Bug fixed + DCHECK added

Original change's description:
> Revert "Move piggybacking controller from P2PTC to DTLS transport"
>
> This reverts commit 29e639e0a495a537c610182ab9b04aed8cf10426.
>
> Reason for revert: found bug accessing variable after it has been moved.
>
> Original change's description:
> > Move piggybacking controller from P2PTC to DTLS transport
> >
> > The DTLS-STUN piggybacking controller is associated with both the DTLS
> > transport and the ICE transport (P2PTransportChannel). It turned out to
> > be more closely associated with the DTLS transport and requires less
> > plumbing when moved there.
> >
> > The config option to enable the feature remains as part of the ICE
> > transport config since the ICE transport does not know its "upstream"
> > DTLS transport and hence can not query the config from it.
> >
> > BUG=webrtc:367395350
> >
> > Change-Id: Iafd5abd8b65855bcf32bf840414d96513d8e6300
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/375283
> > Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
> > Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#43823}
>
> Bug: webrtc:367395350
> Change-Id: I2d83de8890b0aa230dd9e21cb5ce2eb03c8d3564
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/375861
> Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#43824}

Bug: webrtc:367395350
Change-Id: I4b4acccf15de565736b072ca2de88a1551a6378e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/375862
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43825}
2025-01-30 02:51:41 -08:00
Jonas Oreland
4de5839c11 Revert "Move piggybacking controller from P2PTC to DTLS transport"
This reverts commit 29e639e0a495a537c610182ab9b04aed8cf10426.

Reason for revert: found bug accessing variable after it has been moved.

Original change's description:
> Move piggybacking controller from P2PTC to DTLS transport
>
> The DTLS-STUN piggybacking controller is associated with both the DTLS
> transport and the ICE transport (P2PTransportChannel). It turned out to
> be more closely associated with the DTLS transport and requires less
> plumbing when moved there.
>
> The config option to enable the feature remains as part of the ICE
> transport config since the ICE transport does not know its "upstream"
> DTLS transport and hence can not query the config from it.
>
> BUG=webrtc:367395350
>
> Change-Id: Iafd5abd8b65855bcf32bf840414d96513d8e6300
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/375283
> Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
> Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#43823}

Bug: webrtc:367395350
Change-Id: I2d83de8890b0aa230dd9e21cb5ce2eb03c8d3564
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/375861
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43824}
2025-01-30 00:26:07 -08:00
Philipp Hancke
29e639e0a4 Move piggybacking controller from P2PTC to DTLS transport
The DTLS-STUN piggybacking controller is associated with both the DTLS
transport and the ICE transport (P2PTransportChannel). It turned out to
be more closely associated with the DTLS transport and requires less
plumbing when moved there.

The config option to enable the feature remains as part of the ICE
transport config since the ICE transport does not know its "upstream"
DTLS transport and hence can not query the config from it.

BUG=webrtc:367395350

Change-Id: Iafd5abd8b65855bcf32bf840414d96513d8e6300
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/375283
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43823}
2025-01-29 23:27:14 -08:00
Jonas Oreland
3155346f66 Reland "Remove rtc_p2p"
This reverts commit c6278957d11fc63c6acc3791ef31672744ced623.

Reason for revert: importer fixed.

Original change's description:
> Revert "Remove rtc_p2p"
>
> This reverts commit a05ad63aa336b22850387dafdcb5f7fcb00c7fb3.
>
> Reason for revert: breaks importer :(
>
> Original change's description:
> > Remove rtc_p2p
> >
> > This completes the task of removing the rtc_p2p target.
> >
> > Bug: webrtc:42226155
> > Change-Id: I2cd145fe250fc2e572b4cacc0982520dbf2250b8
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/375660
> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> > Auto-Submit: Jonas Oreland <jonaso@webrtc.org>
> > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#43817}
>
> Bug: webrtc:42226155
> Change-Id: If0ba5c78c376ed31a8cae48ea0fee7162f70d5ff
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/375720
> Auto-Submit: Jonas Oreland <jonaso@webrtc.org>
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
> Cr-Commit-Position: refs/heads/main@{#43819}

Bug: webrtc:42226155
Change-Id: I9d958507f235c7f9b4c455c4dccd81644ffa4363
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/375741
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43820}
2025-01-29 00:40:03 -08:00
Jonas Oreland
c6278957d1 Revert "Remove rtc_p2p"
This reverts commit a05ad63aa336b22850387dafdcb5f7fcb00c7fb3.

Reason for revert: breaks importer :(

Original change's description:
> Remove rtc_p2p
>
> This completes the task of removing the rtc_p2p target.
>
> Bug: webrtc:42226155
> Change-Id: I2cd145fe250fc2e572b4cacc0982520dbf2250b8
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/375660
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Auto-Submit: Jonas Oreland <jonaso@webrtc.org>
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#43817}

Bug: webrtc:42226155
Change-Id: If0ba5c78c376ed31a8cae48ea0fee7162f70d5ff
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/375720
Auto-Submit: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#43819}
2025-01-28 22:47:44 -08:00
Jonas Oreland
a05ad63aa3 Remove rtc_p2p
This completes the task of removing the rtc_p2p target.

Bug: webrtc:42226155
Change-Id: I2cd145fe250fc2e572b4cacc0982520dbf2250b8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/375660
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Auto-Submit: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43817}
2025-01-28 13:51:57 -08:00
Harald Alvestrand
406d195d16 Move the rtc_p2p file last in its BUILD file
This will cause automation to not pick it up when searching for
headers.

Bug: webrtc:42226155
Change-Id: I4e93cd4eca13af32f76201df784b20a80ac9baed
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/375581
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43816}
2025-01-28 09:58:56 -08:00
Philipp Hancke
589acd56d0 dtls-stun piggybacking: make it compatible with DTLS 1.3
DTLS 1.3 encrypts more parts of the handshake so we move from
deep packet inspection to looking at the state of DTLS to
decide whether to intercept the packet.

BUG=webrtc:367395350

Change-Id: Idb1eda0437f24002f48381af5d6a167a4a153381
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374501
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43794}
2025-01-24 03:11:19 -08:00
Evan Shrubsole
0bebca526a Remove gunit.h EXPECT/ASSERT..WAIT macros
Bug: webrtc:381524905
Change-Id: I01dff16f7ec26fa4075a9ef659dee3f0844db041
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374881
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43785}
2025-01-22 00:33:15 -08:00
Evan Shrubsole
2a858e21f6 Migrate last uses of gunit.h macros
Bug: webrtc:381524905
Change-Id: I9bf00a61dfcc00355e81fea34625119ef3ac61b6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374860
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43769}
2025-01-20 02:06:48 -08:00
Evan Shrubsole
b0038dd14a Replace gunit.h macros with WaitUntil in P2P
Bug: webrtc:381524905
Change-Id: Ia2614729b17a40cd2f5f226e351b3f82c2038977
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374181
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43758}
2025-01-17 06:53:50 -08:00
Philipp Hancke
3cc17eed68 dtls-stun-piggybacking: add missing configuration guard
the lack of this led to a DTLS restart in the default case.
Also reduce the log level from "ERROR" to "INFO".

BUG=webrtc:367395350

Change-Id: I52cd74f508ca4b4c28b11220ea82d95081558eee
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374503
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43752}
2025-01-16 23:49:38 -08:00
Jeremy Leconte
0e642639a9 Add 'rtc_p2p_unittests' missing dependencies.
This is a follow up of https://webrtc-review.googlesource.com/c/src/+/362480.

Change-Id: Idba0153f3770a3de50d82b2dac62b345e3e2c9c8
Bug: None
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374480
Auto-Submit: Jeremy Leconte <jleconte@webrtc.org>
Reviewed-by: Christoffer Dewerin <jansson@webrtc.org>
Commit-Queue: Christoffer Dewerin <jansson@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43747}
2025-01-16 05:11:41 -08:00
Philipp Hancke
bce57cda1e Piggyback DTLS handshake in initial STUN packets
This change puts the DTLS handshake as payload of STUN packets with a custom STUN attribute (registered with the IANA) and starts the DTLS handshake before the ICE transport becomes writable. Effectively, STUN acts as a transport layer for DTLS during the handshake phase.

This will theoretically reduce the call setup time by one RTT for aggressive nomination or two RTTs for regular nomination.

The latest DTLS packet (flight) is cached and sent on every STUN request or response. DTLS packets are extracted from every authenticated STUN request or response and handled to the DTLS layer for processing.
The caching also increases the resilience to packet loss as STUN pacing is more aggressive (every 20ms) than the exponential backoff used by DTLS which should reduce call setup time in lossy networks.

If the other side of the connection does not support this feature the fallback to normal DTLS happens as soon as the ICE transport becomes writable. This also handles edge-cases like fragmentation of the DTLS handshake.

The feature is only supported when ECDSA certificates are used since RSA certificates are too large to transport as STUN attributes. The observed attributes for the server and client flights with the certificates were around 600 to 650 bytes. This may be further reduced by using raw public keys defined in RFC 7250.

This feature is disabled by default and guarded by the field trial
  WebRTC-IceHandshakeDtls
and requires experimentation and standardization before roll-out in the browser.

Parts of this landed in
  https://webrtc-review.googlesource.com/c/src/+/370679

BUG=webrtc:367395350

Change-Id: I4809438b2a267c4690a9b2bd6f1766d2f959500d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/362480
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43742}
2025-01-15 07:54:23 -08:00
Philipp Hancke
11edd41c04 dtls_utils: skip over DTLSCiphertext from DTLS 1.3
where we can not extract any message_seq for piggybacking.

BUG=webrtc:367395350

Change-Id: I2e42d3b1304b5cf204c34bc8a136f17c363e011c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/372881
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43731}
2025-01-14 03:37:29 -08:00
Boris Tsirkin
c6b7acb9cd Format p2p/base files
I ran the formatter on everything to make find leftovers, and these are
the last files.
git ls-files | grep -E '^.*\.(h|cc|mm|c|m)$' | xargs clang-format -i

No-Iwyu: Includes didn't change and it isn't related to formatting
Bug: webrtc:42225392
Change-Id: I8bbe8bd3c97b76c691e38b8ca290417202a61b6c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374161
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43720}
2025-01-13 05:09:52 -08:00
Jonas Oreland
12574a315f DTLS 1.3 - patch 4
This patchs adds a field trial for enabling DTLS1.3, WebRTC-ForceDtls13
- "Enabled" set max version to DTLS1.3
- "Only" set min & max version to DTLS1.3

Wireup a FieldTrialsView so that this does not
use the global string.

Also convert the WebRTC-DisableTlsSessionTicketKillswitch
from global string to FieldTrialsView.

BUG=webrtc:383141571

Change-Id: Ia775efc1dcbffd01bfddb6030490438cb8de89d7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/372261
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43616}
2024-12-19 07:37:19 -08:00
Jonas Oreland
35f73ddca4 DTLS 1.3 - patch 3
Modify openssl_stream_adapter to check/set
timer regardless of dtls state. This is needed for DTLS1.3
orelse handshake will never complete if last client
packet is lost (e.g if retransmit is not triggered after
writable) as show by TestHandshakeLoseSecondClientPacket.

TestHandshakeLoseSecondClientPacket works with/without this
patch if using DTLS1.2.

BUG=webrtc:383141571

Change-Id: I2757783c9e79686d1fbe0eff12341ab9e3863fdd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/372201
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43610}
2024-12-19 03:36:52 -08:00
Philipp Hancke
f0ca2dc934 Implement DTLS-STUN piggybacking controller
which implements the handshaking logic of the DTLS-STUN piggybacking.

Not wired up yet, split from
  https://webrtc-review.googlesource.com/c/src/+/362480

BUG=webrtc:367395350

Change-Id: I9ee8ff17af4ec96fb891d9852ac50825155735a8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/370679
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43606}
2024-12-18 23:06:06 -08:00
Jonas Oreland
ac40185001 DTLS 1.3 - patch 2
- add DTLS1.3 ciphers (without KeyType)
- remove code in dtls_transport.cc that tries to parse DTLS packet
- cleanup some test
- start on test for packet loss during dtls handshake (more to come!)

After this patch is submitted, it is possible
to set max version = dtls1.3 and it will active
but DON'T do it yet.

BUG=webrtc:383141571

Change-Id: I6f9a120c53415ccee7a560ea83bd0c2636702997
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/371300
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43595}
2024-12-18 02:26:22 -08:00
Philipp Hancke
e500d46600 Clean up p2p:rtc_p2p target and remove webrtc dependency
removing the last vestiges of the p2p/ dependencies and stop depending
on them for the "webrtc" static library.

BUG=webrtc:42226155

Change-Id: I0b6ac36c0a22054c229a94f55fa6690580b9d47f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/371342
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Cr-Commit-Position: refs/heads/main@{#43581}
2024-12-16 11:42:23 -08:00
Philipp Hancke
8898459ed2 Clean up p2p:rtc_p2p target
removing the webrtc need for having sources in it.

BUG=webrtc:42226155

Change-Id: I40fbde9064f4fa629c7c6b0cf99f23ab1726da75
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/370820
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43540}
2024-12-11 14:59:08 -08:00
Philipp Hancke
740d726739 Move DTLS related code from p2p/base to p2p/dtls
BUG=webrtc:367395350

Change-Id: I3fd1551f974705ce6b10e2c757f4d406a520a2c1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/370460
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Cr-Commit-Position: refs/heads/main@{#43528}
2024-12-10 15:55:26 +00:00
Mirko Bonadei
414706543d Revert "Remove stun_prober"
This reverts commit 03f56d75d5a4bbbc6b6fe93e119f73c69ff98267.

Reason for revert: Breaks downstream project.

Original change's description:
> Remove stun_prober
>
> The STUN prober shows the old RFC 3489 way of determining the NAT type
> by pinging two different servers. This is known to be faulty as pointed
> out by
>   https://datatracker.ietf.org/doc/html/rfc5389#section-2
>
> Chromium dependency removed in
>   https://chromium-review.googlesource.com/c/chromium/src/+/6036622
>
> BUG=None
>
> Change-Id: I2b61dfe2ff899ce71ec9d2253dc836c5908cf8c6
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/368182
> Commit-Queue: Philipp Hancke <phancke@meta.com>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#43503}

Bug: None
Change-Id: I08d01d4c9d882aca883e1c889aed8bddbca65b91
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/370540
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Jeremy Leconte <jleconte@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43506}
2024-12-06 10:25:39 +00:00
Philipp Hancke
03f56d75d5 Remove stun_prober
The STUN prober shows the old RFC 3489 way of determining the NAT type
by pinging two different servers. This is known to be faulty as pointed
out by
  https://datatracker.ietf.org/doc/html/rfc5389#section-2

Chromium dependency removed in
  https://chromium-review.googlesource.com/c/chromium/src/+/6036622

BUG=None

Change-Id: I2b61dfe2ff899ce71ec9d2253dc836c5908cf8c6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/368182
Commit-Queue: Philipp Hancke <phancke@meta.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43503}
2024-12-06 03:10:43 +00:00
Philipp Hancke
cab60a0842 Provide default implementation of IceTransportInternal::config()
to be deleted when downstream consumers are upgraded

BUG=webrtc:367395350

Change-Id: I35f1fefdc6535ad443b86176ea600455c2361834
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/370284
Commit-Queue: Philipp Hancke <phancke@meta.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43502}
2024-12-06 02:44:34 +00:00
Philipp Hancke
89b0f2ef71 Introduce p2p DTLS utils
for (partially) parsing DTLS packets and extracting the msg_seqs

BUG=webrtc:367395350

Change-Id: Ieb0fc121c6dc82118ced5939c1a9ebe2d72e3cb3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/370181
Commit-Queue: Philipp Hancke <phancke@meta.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43501}
2024-12-05 17:08:59 +00:00
Philipp Hancke
1cf342a321 Add IceConfig getter to IceTransportInternal(Interface)
and misc cleanup

BUG=webrtc:367395350
No-Iwyu: remaining IWYU failure is deep inside gtest which is unrelated to the changes and needs to be investigated separately

Change-Id: I5c2b7a6cc6b15fc5474c55eb98635cb9145b7373
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/370180
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Cr-Commit-Position: refs/heads/main@{#43498}
2024-12-05 09:13:32 +00:00
Philipp Hancke
4060745995 spanify SSLStreamAdapter::SetPeerCertificateDigest
BUG=webrtc:357776213

Change-Id: Ie6189ac21b9f76f7ce5ddb3e4208c08793df73ff
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/368220
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43462}
2024-11-27 06:13:28 +00:00
Tommi
924dc088dc Use 16bit unsigned for channel id for TURN
Bug: webrtc:345518625
Change-Id: I0ee879e9a35cd9831e035a661d54201dc6defac9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/353901
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43447}
2024-11-24 22:47:10 +00:00
Dor Hen
da7b7ca1c1 Comment unused variables in implemented functions 15\n
Bug: webrtc:370878648
Change-Id: I4529c17f54c653864cca27097e44c843210b9c52
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/368061
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Dor Hen <dorhen@meta.com>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43429}
2024-11-20 11:50:20 +00:00
Per Kjellander
906deafff4 Add support for sending packets with ECT(1) based on packet options in native WebRTC.
With L4S in WebRTC, only RTP packets are supposed to be send with ECT(1)

Bug: webrtc:42225697
Change-Id: If10bf74a867d3ea04fd1fb931cdc2a6380176270
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/367220
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43343}
2024-11-01 07:48:19 +00:00
Philipp Hancke
0e5d73510d DTLS: cleanup extension permutation
which shipped in M129.

BUG=webrtc:42225803

Change-Id: I5021c7878069a1cd0eafd078b73fa57c5b9b2155
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/364360
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Cr-Commit-Position: refs/heads/main@{#43313}
2024-10-28 10:04:37 +00:00
Philipp Hancke
ba957e486c Clean up deprecated variant of DTLS-SRTP key exporter
follow-up from
  https://webrtc-review.googlesource.com/c/src/+/364521 (reland as
  https://webrtc-review.googlesource.com/c/src/+/365180)

BUG=webrtc:357776213

Change-Id: I4f59d53407f41d903bca6664d85bd2c72d4ff1eb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/365020
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Cr-Commit-Position: refs/heads/main@{#43295}
2024-10-24 07:59:26 +00:00
Tom Sepez
7085a884aa Avoid string duplication when returning StringBuilder strings
The const-ref result of .str() must be copied into the returned
value, whereas the result of .Release() can be moved.

Bug: webrtc:374845009
Change-Id: I3abc98be30ce9947127c7664f5ffa6846b772ea2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/366480
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43288}
2024-10-23 07:54:18 +00:00
Dor Hen
6d58a43413 Comment unused variables in implemented functions 3\n
Bug: webrtc:370878648
Change-Id: I40251cc529cc20fbf2b034fa25798965b91dbd88
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/364683
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Dor Hen <dorhen@meta.com>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43278}
2024-10-22 11:58:48 +00:00
Philipp Hancke
03b2c9f6fc Let ZeroOnFreeBuffer do the memcpy for DTLS-SRTP key extraction
and use uint8_t instead of unsigned char. Follow-up from
  https://webrtc-review.googlesource.com/c/src/+/365274

BUG=webrtc:357776213

Change-Id: Ibc97e5cc85316ba69b4133b7f3c42e3afbdd7abd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/365540
Commit-Queue: Philipp Hancke <phancke@meta.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Jeremy Leconte <jleconte@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43263}
2024-10-18 11:18:21 +00:00
Philipp Hancke
6caca655d8 Reland "Spanify SRTP key export"
This is a reland of commit 65ae3245f9380e46b1d755f3f452ba63ab6cdf8d
with more backward compat which also fixes the off-by-one issue which caused wrong SRTP keys to be extracted.

Original change's description:
> Spanify SRTP key export
>
> and simplify the interface used as this is only used for exporting
> SRTP keys and passing arcane OpenSSL arguments around does not make
> much sense.
>
> BUG=webrtc:357776213
>
> Change-Id: I9e5a94fe368b77975e48b6dd5ab6a2d2575d6382
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/364521
> Commit-Queue: Philipp Hancke <phancke@meta.com>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Reviewed-by: Florent Castelli <orphis@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#43198}

Bug: webrtc:357776213
Change-Id: I5d43dc23f90ef630834fb400751979fcc5e18203
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/365180
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Jeremy Leconte <jleconte@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Cr-Commit-Position: refs/heads/main@{#43225}
2024-10-11 19:39:28 +00:00
Jeremy Leconte
32590ef877 Revert "Spanify SRTP key export"
This reverts commit 65ae3245f9380e46b1d755f3f452ba63ab6cdf8d.

Reason for revert: breaks downstream compilation

Original change's description:
> Spanify SRTP key export
>
> and simplify the interface used as this is only used for exporting
> SRTP keys and passing arcane OpenSSL arguments around does not make
> much sense.
>
> BUG=webrtc:357776213
>
> Change-Id: I9e5a94fe368b77975e48b6dd5ab6a2d2575d6382
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/364521
> Commit-Queue: Philipp Hancke <phancke@meta.com>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Reviewed-by: Florent Castelli <orphis@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#43198}

Bug: webrtc:357776213
Change-Id: I03ffcda3d6821718f355b243ce78a9c54b4036f3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/365062
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Jeremy Leconte <jleconte@webrtc.org>
Owners-Override: Jeremy Leconte <jleconte@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43202}
2024-10-09 08:51:23 +00:00
Philipp Hancke
65ae3245f9 Spanify SRTP key export
and simplify the interface used as this is only used for exporting
SRTP keys and passing arcane OpenSSL arguments around does not make
much sense.

BUG=webrtc:357776213

Change-Id: I9e5a94fe368b77975e48b6dd5ab6a2d2575d6382
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/364521
Commit-Queue: Philipp Hancke <phancke@meta.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43198}
2024-10-08 19:05:40 +00:00
Philipp Hancke
4f732f4847 Constify transport stats
BUG=None

Change-Id: I441a46dea97d9a9022b96aaadef1d7348c6f90ee
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/364124
Commit-Queue: Philipp Hancke <phancke@meta.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43148}
2024-10-02 14:41:09 +00:00
Harald Alvestrand
d259a754a8 Remove deprecated variant of StreamInterface::WriteAll
This has been deprecated since November 2022.

Bug: None
Change-Id: Ia547489b1f703d0744ab7ffc096eeadbb937974a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/364381
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Auto-Submit: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43140}
2024-10-02 11:57:16 +00:00
Philipp Hancke
1831184330 Unify TLS cipher suite name handling
Move it away from the "proprietary" SSL_CIPHER_get_id and looking up the cipher based on that towards SSL_CIPHER_standard_name.

SSL_CIPHER_get_id and the associated GetSslCipherSuite API is kept around for
  WebRTC.PeerConnection.SslCipherSuite.*
UMA metrics and metrics compability (despite not yielding the IANA ids it promises).

BUG=None

Change-Id: Iaa357e3e31dc90abea688cf6ca10c0b40582ef38
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/363202
Reviewed-by: David Benjamin <davidben@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43097}
2024-09-27 21:45:18 +00:00
Florent Castelli
8037fc6ffa Migrate absl::optional to std::optional
Bug: webrtc:342905193
No-Try: True
Change-Id: Icc968be43b8830038ea9a1f5f604307220457807
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/361021
Auto-Submit: Florent Castelli <orphis@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42911}
2024-09-02 12:16:47 +00:00
Per K
b60f0ffbce Dont signal ReadyToSend in RtpTransport::SendPacket
Before this cl, ReadyToSend signaled false if sending a packet failed and transport->GetError() returns ECONN.
ECONN may be reported by the TCP connection (TcpConnection) if the remote closed the connection. TcpConnection will attempt to reconnect and should change the writable state if it fail.
Changing the state in the context of sending packets may cause recursive
calls and seems to cause problems with incorrect states.
It is simpler if RtpTransport::SendPacket ignore these failures and
upper layers treat these lost packets similar to if the packets had been
lost via UDP.
For safety, this change can be reverted by field trial WebRTC-SetReadyToSendFalseIfSendFail/Enabled/.

Bug: webrtc:361124449 b/359989715
Change-Id: I8e7016dfb4301862286215c4512aa8ac03a16685
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/360120
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42868}
2024-08-27 14:16:53 +00:00
Per K
6db0db5cfd Ensure TCPPort is notified of sent packets after reconnect
This fix an issue where the socket does not notify the port of sent packets after that the TCPConnection has opened a new socket. TcpConnection will open a new socket if the TCP  connection has been closed.

Bug: webrtc:361124449 b/359989715
Change-Id: Id33c5fc5292ee7d1c2d1cad6c373e2d4355d4fe1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/360260
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42865}
2024-08-27 12:29:52 +00:00
Philipp Hancke
b31ade36ff stun/turn: suppress icecandidateerror for incompatible address family
Suppresses the ice candidate error callback when the STUN/TURN server
address family is not compatible with the local candidate address family.

This is similar to not pairing between candidates that have different
incompatible address families as described in
https://datatracker.ietf.org/doc/html/rfc5245#section-5.7.1

The spec actually says to emit the 701 error if *no* host candidate is able to reach the server:
  https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnectioniceerrorevent-errorcode

Also use the same (spec) error code for STUN and TURN, see
https://github.com/webrtc/samples/issues/1215 (error 600 for TURN)
https://github.com/webrtc/samples/issues/1227 (error 701 with AF mismatch)

Drive-by: misc logging fixes

BUG=webrtc:359404135

Change-Id: I99574b7b2b79986a52ab38a7fa58ea1bebab954c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/358961
Commit-Queue: Philipp Hancke <phancke@meta.com>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42830}
2024-08-22 21:33:45 +00:00
Philipp Hancke
2cfedb277a Remove vestiges of GTURN
and update some usage to use the "correct" stun attribute names

BUG=webrtc:42229250

Change-Id: If0c34d1d9b399766d7073661ea2a5515100256a5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/359440
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Cr-Commit-Position: refs/heads/main@{#42810}
2024-08-19 16:05:37 +00:00