Commit graph

93 commits

Author SHA1 Message Date
Danil Chapovalov
b0fe794d7d Delete expired field trial WebRTC-SignalNetworkPreferenceChange
Bug: webrtc:42221944
Change-Id: I786d73f5ede27d4ab40a9b3b2fef49da45bd3444
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/350302
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42274}
2024-05-11 09:50:40 +00:00
Danil Chapovalov
58a9f6d490 Delete depercated variant of the Network::GetCost function
Bug: webrtc:42220378
Change-Id: Iebfc924ab55896981cbf83407a9b049e4d0dde8f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/350303
Auto-Submit: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42269}
2024-05-10 11:25:19 +00:00
Diep Bui
7e2aa7d70a Add logs to see if network is ignored because flag IFF_RUNNING is not set.
Some chrome os endpoints get ICE NEVER CONNECTED because their wireless interfaces are ignored. One possible explanation is that result from getifaddrs is incorrect because some interfaces can work even if IFF_RUNNING is not set. Comparing to chromium code, not all messages with IFF_RUNNING on wireless interface are considered (https://chromium.googlesource.com/chromium/src/+/refs/heads/main/net/base/address_tracker_linux.cc#539). Thus the log print helps us to verify our explanation.

Chrome log: https://screenshot.googleplex.com/8SnDn66F56HAKfQ
Webrtc log: https://screenshot.googleplex.com/4jKxPsTHxExNBgz

Bug: webrtc:14334
Change-Id: Icd67dbe4e8ddcaed8b583f2fdb5f1fadfd7bac60
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/304460
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Diep Bui <diepbp@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40020}
2023-05-09 10:01:36 +00:00
Diep Bui
41daa40203 Update log level in network.cc to avoid excessive log printing
Bug: webrtc:14334
Change-Id: I034a7db47b5af14fb437d7370331cdadfed0c1a1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/304021
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Diep Bui <diepbp@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39973}
2023-05-03 08:13:02 +00:00
Sameer Vijaykar
df7df199ab Clean up IPv6 fixes field trial artifacts.
The fixes have been default enabled, so clean up dead code.

Bug: webrtc:14334
Change-Id: I4967d5ad451ac333c54294fc14bea6c7ba1445e3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/301180
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Cr-Commit-Position: refs/heads/main@{#39949}
2023-04-25 14:59:55 +00:00
Sameer Vijaykar
1f251dd67e Default enable WebRTC-IPv6NetworkResolutionFixes
Fully launched on mobile and approved for chrome launch.

Removed tests for feature enablement with field trial.

Bug: webrtc:14334
Change-Id: I7ca7183ff618835fef8c820cfd52863e1c7fa25e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/301163
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Cr-Commit-Position: refs/heads/main@{#39879}
2023-04-17 20:28:53 +00:00
Diep Bui
5248228d79 Do not use deprecated IPv6 on Windows, and set temporary address attribute for IPv6
Currently webrtc does not have info about interface flags, thus it can use deprecated IPv6 and does not prefer temporary addresses as mentioned in https://www.rfc-editor.org/rfc/rfc8835#name-usage-of-temporary-ipv6-add

Test: not able to test it because cannot mock GetAdaptersAddresses system call on Windows. However, it should be correct because the implementation is the same as chromium code. https://source.chromium.org/chromium/chromium/src/+/main:net/base/network_interfaces_win.cc;l=182

Bug: webrtc:14334
Change-Id: Iae696b00368ae2f9480b542d2ddbc036338081f1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/300965
Commit-Queue: Diep Bui <diepbp@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39839}
2023-04-13 07:49:23 +00:00
Diep Bui
46849fc73c Print discovered network interfaces for debugging ICE_NEVER_CONNECTED endcause.
Bug: webrtc:14334
Change-Id: Iad2f25e44cd3a154d6dceda755696480e2618a93
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/299421
Commit-Queue: Diep Bui <diepbp@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39716}
2023-03-29 11:58:22 +00:00
Philipp Hancke
310e0624aa Add Cisco AnyConnect IPSec MAC to VPN detection
and set the underlying type to unknown for mac-based detection.

BUG=webrtc:13097,webrtc:13172
Co-authored by: amir.pirogovsky@microsoft.com

Change-Id: I177214f9eb5c2990faa65262f77b3d0ce9d5eab7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/284500
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#38709}
2022-11-22 11:55:26 +00:00
Diep Bui
3d9b5590c2 Move field trial from BasicNetworkManager to NetworkManagerBase
Bug: webrtc:14306
Change-Id: I9bba38090a77a40f599eaa680da3cf60810b0337
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/283801
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Diep Bui <diepbp@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38674}
2022-11-18 10:39:04 +00:00
Artem Titov
b555e83395 add ccmni as cellular type
"ccmni" is the cellular interface name in MTK platform.
The accurate name may be ccmni0, ccmni1 ...etc. We would like
to add it in order to provide correct adapter type when user
invokes webrtc function GetAdapterTypeFromName.

Bug: b/246680543, webrtc:14438
Change-Id: I30074a442b3c02b93bc72a044675718955bd96f4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/275860
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38113}
2022-09-19 07:53:18 +00:00
Danil Chapovalov
9e09a1f327 Replace Thread::Invoke with Thread::BlockingCall
BlockingCall doesn't take rtc::Location parameter and thus most of the dependencies on location can be removed

Bug: webrtc:11318
Change-Id: I91a17e342dd9a9e3e2c8f7fbe267474c98a8d0e5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/274620
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38045}
2022-09-09 10:44:17 +00:00
Diep Bui
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
Sameer Vijaykar
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
Diep Bui
1e589eb77f Modify GetBestIP to prefer global IPv6 addresses to the link local IPv6 addresses.
The change is behind the flag WebRTC-PreferGlobalIPv6ToLinkLocal.

Bug: webrtc:14306
Change-Id: Id2cae2e510fcfd007016e79ae4bd46947101d0fc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/269762
Commit-Queue: Diep Bui <diepbp@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37658}
2022-08-02 10:16:35 +00:00
Daniel.L (Byoungchan Lee)
489f648ea3 Remove the deprecated BasicNetworkManager constructor
Bug: webrtc:13145
Change-Id: I43696aea7256d3fe94a11514ea6d81e3c3ac5f57
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/268780
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Daniel.L (Byoungchan) Lee <daniel.l@hpcnt.com>
Auto-Submit: Daniel.L (Byoungchan) Lee <daniel.l@hpcnt.com>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37564}
2022-07-20 08:14:04 +00:00
Danil Chapovalov
5286dcfab6 Migrate rtc_base and rtc_tools to absl::AnyInvocable based TaskQueueBase interface
Bug: webrtc:14245
Change-Id: I71abe3db7a23ad33bd175297e23fa8e927fa9628
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/268768
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37553}
2022-07-19 10:57:42 +00:00
Artem Titov
c374d11fac Move to_queued_task.h and pending_task_safety_flag.h into public API
Bug: b/235812579
Change-Id: I9fa3dc4a65044df8b44fff4e9bfeac7233fa381c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/266080
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37248}
2022-06-17 09:20:39 +00:00
Jonas Oreland
61dbcd115a Rewrite "Reset all maps in AndroidNetworkMonitor Start()/Stop()"
This reverts commit 8cd7b0a7ba.

The assumption in AndroidNetworkMonitor that an interface name
is unique has turned out to be incorrect :( for some (weird) devices,
i.e ccmni0.
It is unclear if it is a permanent setup or a transient state.

This cl/ changes the impl. to cope with that, the last
OnNetworkConnected_n "owns" the interface name, and when
OnNetworkDisconnected_n runs, we check if we're "owner"
and maybe set a new "owner" (if we're not "owner" we do nothing).

New testcases added.

I also
1) change NetworkMonitorInterface to return a struct
with all the information that is requested with interface name
as key.
2) Change Network.cc adding (debug) assertions that network
properties can't change inside a loop (in one thread).

Original change's description:
> Revert "Reset all maps in AndroidNetworkMonitor Start()/Stop()"
>
> This reverts commit 02293096f9.
>
> Reason for revert: mysterious crashes in android_network_monitor.cc
>
> Original change's description:
> > Reset all maps in AndroidNetworkMonitor Start()/Stop()
> >
> > This cl/ fixes another race condition with the recent additions
> > to NetworkMonitorAutoDetect (getAllNetworksFromCache).
> >
> > The getAllNetworksFromCache-feature uses the by the Android team
> > preferred way of enumerating networks, i.e to register network listeners.
> >
> > Th recent fix to add IsAdapterAvailable, https://webrtc-review.googlesource.com/c/src/+/257400
> > contained a bug in that the adapter_type_by_name_ map was not
> > reset either on disconnect or Start/Stop.
> >
> > This cl/ addresses that including unit test.
> > It also de-obfuscates NetworkMonitor so that it always
> > calls NotifyOfActiveNetworkList on startMonitoring even
> > if list.size() == 0. This should not matter but makes
> > code easier to understand.
> >
> > Bug: webrtc:13741
> > Change-Id: I438b877eebf769a8b2e7292b697ef1c0a349b24f
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258721
> > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#36530}
>
> Bug: webrtc:13741
> Change-Id: I36fbf63f658d3e8048e13959cbebfbd14df12b14
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/264146
> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
> Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#37016}

Bug: webrtc:13741
Change-Id: Ib4eb072b775e493b564528f0be94c685b70ec20f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/264421
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37056}
2022-05-31 10:49:55 +00:00
Mirko Bonadei
13f9c62ec8 Fix comparator bugs which are not compliant to strict weak ordering.
See a full explanation of the problem on this blog [1] post about changing
std::sort in LLVM and relative issues uncovered.

The CompareNetwork function was violating the 4th rule of "strict weak
ordering" (Transitivity of incomparability: x == y and y == z imply x == z, where x == y means x < y and y < x are both false).

[1] - https://danlark.org/2022/04/20/changing-stdsort-at-googles-scale-and-beyond/

Bug: None
Change-Id: I7e893f0a30da31403766284823f75c45c4db91c3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251681
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36711}
2022-04-29 16:00:53 +00:00
Niels Möller
6228d870dc Reland "Delete deprecated versions of MergeNetworkList"
This is a reland of commit 7679e9bf07

Breakage in chrome/services/sharing/ (not built as part of webrtc
presubmit) should be fixed with
https://chromium-review.googlesource.com/c/chromium/src/+/3604642

Original change's description:
> Delete deprecated versions of MergeNetworkList
>
> Bug: webrtc:13869
> Change-Id: I6b888ba14ca664a1f28de2fb59b7d1343cb18bd8
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/259300
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Niels Moller <nisse@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#36611}

Bug: webrtc:13869
Change-Id: I4cf0fe0f2310eabb2d0b32c6dec5f8aef64c7712
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/259869
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36704}
2022-04-29 11:19:02 +00:00
Ilya Nikolaevskiy
2f9291c7fb Revert "Delete deprecated versions of MergeNetworkList"
This reverts commit 7679e9bf07.

Reason for revert: Breaks chromium roll (see https://ci.chromium.org/ui/p/chromium/builders/try/linux-chromeos-compile-dbg/998457/overview)

Original change's description:
> Delete deprecated versions of MergeNetworkList
>
> Bug: webrtc:13869
> Change-Id: I6b888ba14ca664a1f28de2fb59b7d1343cb18bd8
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/259300
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Niels Moller <nisse@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#36611}

Bug: webrtc:13869
Change-Id: I781ac1980687367ee17d033f6613c2e487b7966f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/259775
Auto-Submit: Ilya Nikolaevskiy <ilnik@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36621}
2022-04-22 13:24:29 +00:00
Niels Möller
7679e9bf07 Delete deprecated versions of MergeNetworkList
Bug: webrtc:13869
Change-Id: I6b888ba14ca664a1f28de2fb59b7d1343cb18bd8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/259300
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36611}
2022-04-22 07:39:48 +00:00
Niels Möller
d959f3a665 Use std:unique_ptr for Network objects owned by the NetworkManager.
Bug: webrtc:13869, webrtc:13846
Change-Id: I699ac4774f84cf891304b9c75434301f99ca55d6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258500
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36569}
2022-04-19 10:34:37 +00:00
Ali Tofigh
2ab914c6ab Adopt absl::string_view in rtc_base/ (straightforward cases)
Bug: webrtc:13579
Change-Id: I240db6285abb22652242bc0b2ebe9844ec4a45f0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258723
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Ali Tofigh <alito@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36561}
2022-04-17 12:11:56 +00:00
Niels Möller
2221144d01 Delete old versions of GetNetworks and GetAnyAddressNetworks
Bug: webrtc:13869
Change-Id: I8a54b875a06345ac6a762673aba9ca51d79f0a82
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/256967
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36479}
2022-04-07 11:25:12 +00:00
Hans Wennborg
597e03f201 Remove set but otherwise unused variable
Recent Clang versions have enhanced -Wunused-but-set-variable which now
warns about this.

Bug: chromium:1309955
Change-Id: I7a9d2175e6314fe8133cf7a77eb00bd4a22a23c5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/257300
Reviewed-by: Jonas Oreland <jonaso@google.com>
Auto-Submit: Hans Wennborg <hans@chromium.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36418}
2022-04-04 08:19:05 +00:00
Jonas Oreland
e62c2f2c77 WebRTC-DeprecateGlobalFieldTrialString/Enabled/ - part 12/inf
rename WebRtcKeyValueConfig to FieldTrialsView

Bug: webrtc:10335
Change-Id: If725bd498c4c3daf144bee638230fa089fdde833
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/256965
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36365}
2022-03-29 10:14:00 +00:00
Jonas Oreland
c06fe8b04e WebRTC-DeprecateGlobalFieldTrialString/Enabled/ - part 11/inf
convert rtc_base/network and collateral.

This also remove last usage of system_wrappers/field_trials
in p2p/...Yay!

Bug: webrtc:10335
Change-Id: Ie8507b1f52bf7f3067e9b4bf8c81a825e4644fda
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/256640
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36357}
2022-03-28 15:48:01 +00:00
Ali Tofigh
7fa9057a05 Adopt absl::string_view in function parameters under rtc_base/
This is part of a large-scale effort to increase adoption of
absl::string_view across the WebRTC code base.

This CL converts the majority of "const std::string&"s in function
parameters under rtc_base/ to absl::string_view.

Bug: webrtc:13579
Change-Id: I2b1e3776aa42326aa405f76bb324a2d233b21dca
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/254081
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Xavier Lepaul‎ <xalep@webrtc.org>
Reviewed-by: Anders Lilienthal <andersc@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Commit-Queue: Ali Tofigh <alito@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36239}
2022-03-17 15:39:26 +00:00
Niels Möller
27c1452fae Refactor BasicNetworkManager to use TQ methods and PendingTaskSafetyFlag.
Bug: webrtc:11988
Change-Id: I29a1023297510cc57fe81f02bc4ce06fcde614ea
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/251042
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35951}
2022-02-08 13:54:37 +00:00
Jonas Oreland
3001905072 Fix guess adapter type.
https://crrev.com/b477fc73cfd2f4c09bb9c416b170ba4b566cecaf added a
cost for VPN, but I forgot to fix this method at the same time.
The VPN cost has luckily(?) not yet been rolled out, so no harm done!

Bug: webrtc:13097
Change-Id: I1e513eb0c1d5ca7a8efd184b5cf6ceeca7112cca
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/249603
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35827}
2022-01-28 15:13:45 +00:00
Niels Möller
539f3e1a89 Deprecate BasicNetworkManager default constructor
Replaced with a constructor with a SocketFactory argument.

Bug: webrtc:13145
Change-Id: I30db4ad089009284e1be8a6bbdadd5a671e93713
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/239180
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35508}
2021-12-09 12:10:20 +00:00
Harald Alvestrand
5f34130f26 Declare LERROR deprecated and remove all usage in webrtc
Bug: webrtc:13362
Change-Id: I1c6c6eccd950d73be616b34f96db7832ff94377e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/238804
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35416}
2021-11-24 14:34:24 +00:00
Artem Titov
d3251968d1 Prepare to rename RTC_NOTREACHED to RTC_DCHECK_NOTREACHED
Add implementation of RTC_DCHECK_NOTREACHED equal to the RTC_NOTREACHED.
The new macros will replace the old one when old one's usage will be
removed. The idea of the renaming to provide a clear signal that this
is debug build only macros and will be stripped in the production build.

Bug: webrtc:9065
Change-Id: I4c35d8b03e74a4b3fd1ae75dba2f9c05643101db
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/237802
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35348}
2021-11-15 21:44:59 +00:00
Niels Möller
aa373166f7 Pass a SocketFactory to BasicNetworkManager constructor
Used by QueryDefaultLocalAddress, instead of relying on the update
thread's associated socket server.

This is not the only use of rtc::Thread::socketserver() in the
BasicNetworkManager class. It also interacts with the thread's
socket server to call set_network_binder. That is unchanged by this cl,
perhaps those calls can be moved to the caller of StartNetworkMonitor and
StopNetworkMonitor.

Bug: webrtc:13145
Change-Id: If109c2dcb0e74b183e10bb3db7a5aefcc95d1a8c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/232613
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35118}
2021-09-29 08:59:37 +00:00
Jonas Oreland
ac554ebbc5 Add VPN detection by mac-address for Windows
This patch adds VPN detection for windows
based on known MAC addresses.
- Cisco AnyConnect
- GlobalProtect Virtual Ethernet

Bug: webrtc:13097
Change-Id: Ia90ee50be0dc2dcd2e6e9de1493fdd2c5e7d9d3a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/230245
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#34997}
2021-09-15 08:57:28 +00:00
Jonas Oreland
2ee0e64696 Add support for manually configuring subnets as VPN
This patch adds support for manually setting subnets that
should be handled as VPN, i.e be subject to VpnPreference,
in case webrtc fails to auto-detect VPNs.

Bug: webrtc:13097
Change-Id: I42514f0677a35cfe30ad053570fa9c2a5b4a856b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/230122
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#34852}
2021-08-25 14:49:11 +00:00
Jonas Oreland
b477fc73cf Add small cost to Vpn
This patch adds small cost to Vpn connections
so that a "raw" connection identical to a vpn connection
will be chosen first.

The feature is gated by a field trial WebRTC-AddNetworkCostToVpn
for safe roll out.

Bug: webrtc:13097
Change-Id: I4ad40fa00780a6d7f89cacf6f85f3db4ecd0988c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/229585
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34822}
2021-08-23 11:07:36 +00:00
Niels Möller
d0b8879770 Delete AsyncSocket class, merge into Socket class
Bug: webrtc:13065
Change-Id: I13afee2386ea9c4de0e4fa95133f0c4d3ec826e8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227031
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34787}
2021-08-17 15:39:25 +00:00
Artem Titov
96e3b991da Use backticks not vertical bars to denote variables in comments for /rtc_base
Bug: webrtc:12338
Change-Id: I72fcb505a92f03b2ace7160ee33d555a977eddfd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226955
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34587}
2021-07-28 13:51:47 +00:00
Mirko Bonadei
3707793a57 [sigslot] - Remove sigslot form NetworkMonitorInterface.
Bug: webrtc:11943
Change-Id: Iddedb2840e437dfbffcb0d6cbf71a09b0030fbab
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226869
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34573}
2021-07-27 19:27:52 +00:00
Jonas Oreland
b5274ef8b9 Enable WebRTC-BindUsingInterfaceName by default
But keep option to disable it.
The fix has been tested using A/B experiment with Duo
with positive results.

Bug: webrtc:10707
Change-Id: Iaac72430bc52026ab5db9dd042c5fdc3832fdce5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217380
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33941}
2021-05-07 06:33:44 +00:00
Jonas Oreland
6ca955a1dd Reland "Fix problem with ipv4 over ipv6 on Android"
This reverts commit 1e60490ddb.

Reason for revert: Downstream project has been fixed (127.0.0.1 is not PII)

Original change's description:
> Revert "Fix problem with ipv4 over ipv6 on Android"
>
> This reverts commit da2fd2a2b2,
> as well as follow-up b7227a5a10,
> "Fix handling of partial match for GetVpnUnderlyingAdapterType".
>
> Reason for revert: Breaks downstream test.
>
> First change's description:
> > Fix problem with ipv4 over ipv6 on Android
> >
> > This patch fixes a problem with using ipv4 over ipv6
> > addresses on Android. These addresses are discovered
> > using 'getifaddr' with interfaces called 'v4-wlan0' or
> > 'v4-rmnet' but the Android API does not report them.
> >
> > This leads to failure when BasicPortAllocator tries
> > to bind a socket to the ip-address, making the ipv4
> > address unusable.
> >
> > This solution does the following
> > 1) Insert BasicNetworkManager as NetworkBinderInterface
> > rather than AndroidNetworkManager.
> >
> > 2) When SocketServer calls BindSocketToNetwork,
> > BasicNetworkManager first lookup the interface name,
> > and then calls AndroidNetworkManager.
> >
> > 3) AndroidNetworkManager will then first try to bind
> > using the known ip-addresses, and if it can't find the network
> > it will instead match the interface names.
> >
> > The patch has been tested on real android devices, and works fine.
> > And everything is disabled by default, and is enabled by field trial.
> >
> > My plan is to rollout the feature, checking that it does not introduce
> > any problems, and if so, enabled for all.
> >
> > Bug: webrtc:10707
> > Change-Id: I7081ba43d4ce17077acfa5fbab44eda127ac3971
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211003
> > Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
> > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#33422}
>
> Second change's description:
> > Fix handling of partial match for GetVpnUnderlyingAdapterType
> >
> > This is a followup to https://webrtc-review.googlesource.com/c/src/+/211003
> > and fixes the problem pointed out by deadbeef@, thanks!
> >
> > Bug: webrtc:10707
> > Change-Id: I8dea842b25ba15416353ce4002356183087873c7
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211344
> > Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
> > Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#33436}
>
> TBR=hta@webrtc.org,jonaso@webrtc.org
> NOTRY=True
>
> Bug: webrtc:10707
> Change-Id: Ib13127fbf087c7f34ca0ccc6ce1805706f01d19d
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211740
> Reviewed-by: Taylor <deadbeef@webrtc.org>
> Commit-Queue: Taylor <deadbeef@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#33453}

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: webrtc:10707
Change-Id: I0a11025c366c3127e2f57cd2cd2c33cc3877d1e3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211862
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/master@{#33460}
2021-03-15 10:50:31 +00:00
Taylor Brandstetter
1e60490ddb Revert "Fix problem with ipv4 over ipv6 on Android"
This reverts commit da2fd2a2b2,
as well as follow-up b7227a5a10,
"Fix handling of partial match for GetVpnUnderlyingAdapterType".

Reason for revert: Breaks downstream test.

First change's description:
> Fix problem with ipv4 over ipv6 on Android
>
> This patch fixes a problem with using ipv4 over ipv6
> addresses on Android. These addresses are discovered
> using 'getifaddr' with interfaces called 'v4-wlan0' or
> 'v4-rmnet' but the Android API does not report them.
>
> This leads to failure when BasicPortAllocator tries
> to bind a socket to the ip-address, making the ipv4
> address unusable.
>
> This solution does the following
> 1) Insert BasicNetworkManager as NetworkBinderInterface
> rather than AndroidNetworkManager.
>
> 2) When SocketServer calls BindSocketToNetwork,
> BasicNetworkManager first lookup the interface name,
> and then calls AndroidNetworkManager.
>
> 3) AndroidNetworkManager will then first try to bind
> using the known ip-addresses, and if it can't find the network
> it will instead match the interface names.
>
> The patch has been tested on real android devices, and works fine.
> And everything is disabled by default, and is enabled by field trial.
>
> My plan is to rollout the feature, checking that it does not introduce
> any problems, and if so, enabled for all.
>
> Bug: webrtc:10707
> Change-Id: I7081ba43d4ce17077acfa5fbab44eda127ac3971
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211003
> Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#33422}

Second change's description:
> Fix handling of partial match for GetVpnUnderlyingAdapterType
>
> This is a followup to https://webrtc-review.googlesource.com/c/src/+/211003
> and fixes the problem pointed out by deadbeef@, thanks!
>
> Bug: webrtc:10707
> Change-Id: I8dea842b25ba15416353ce4002356183087873c7
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211344
> Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#33436}

TBR=hta@webrtc.org,jonaso@webrtc.org
NOTRY=True

Bug: webrtc:10707
Change-Id: Ib13127fbf087c7f34ca0ccc6ce1805706f01d19d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211740
Reviewed-by: Taylor <deadbeef@webrtc.org>
Commit-Queue: Taylor <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33453}
2021-03-13 00:20:14 +00:00
Jonas Oreland
da2fd2a2b2 Fix problem with ipv4 over ipv6 on Android
This patch fixes a problem with using ipv4 over ipv6
addresses on Android. These addresses are discovered
using 'getifaddr' with interfaces called 'v4-wlan0' or
'v4-rmnet' but the Android API does not report them.

This leads to failure when BasicPortAllocator tries
to bind a socket to the ip-address, making the ipv4
address unusable.

This solution does the following
1) Insert BasicNetworkManager as NetworkBinderInterface
rather than AndroidNetworkManager.

2) When SocketServer calls BindSocketToNetwork,
BasicNetworkManager first lookup the interface name,
and then calls AndroidNetworkManager.

3) AndroidNetworkManager will then first try to bind
using the known ip-addresses, and if it can't find the network
it will instead match the interface names.

The patch has been tested on real android devices, and works fine.
And everything is disabled by default, and is enabled by field trial.

My plan is to rollout the feature, checking that it does not introduce
any problems, and if so, enabled for all.

Bug: webrtc:10707
Change-Id: I7081ba43d4ce17077acfa5fbab44eda127ac3971
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211003
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33422}
2021-03-10 16:08:18 +00:00
Jonas Oreland
47fa08f90d Add field trial WebRTC-AllowMACBasedIPv6
Bug: webrtc:12268
Change-Id: I6fad191a12aa2834eb2f38b437781cba23785d5e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196506
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32782}
2020-12-06 21:28:59 +00:00
Taylor Brandstetter
ea7fbfb966 Implement network monitor for iOS.
Notably, this should detect whether an interface is "available" or not,
which should prevent the failure is with dual SIM card setups.

This is gated behind a field trial for now, to ensure this doesn't cause
any regressions due to false negatives (interfaces that are usable
but not listed as available by NWPathMonitor).

Bug: webrtc:10966
Change-Id: Ia3942c4c57b525d08d8b340e2325f3705cfd0304
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/180923
Commit-Queue: Taylor <deadbeef@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Anders Carlsson <andersc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31977}
2020-08-20 21:46:18 +00:00
Taylor Brandstetter
07fc24d9a3 Removing NetworkMonitorFactory static global.
It's now passed through CreatePeerConnectionFactory like all similar
injectable dependencies.

Also removing network_monitor.h from native_api/base, since clients
should all be moved to the new location now.

Bug: webrtc:9883
Change-Id: I3776262ce2a2a380d01c163f4d18a0dfad4b5b41
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/181401
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Taylor <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31931}
2020-08-13 20:50:23 +00:00
Jonas Oreland
f7721fb246 Add interface for os/firmware to affect ICE selection.
This patch adds an interface for os/firmware to set a network
preference NOT_PREFERRED / NEUTRAL that can be picked up by
an IceController and used when selection ice candidate pair.

The patch exposes this using an Android Intent based interface.

BUG: webrtc:11825
Change-Id: Ic12b6bf704fde7f9c912020dd7bc79ccae4613ab
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/180883
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31877}
2020-08-07 10:07:43 +00:00