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}
This commit is contained in:
Jonas Oreland
2021-08-23 12:16:33 +02:00
committed by WebRTC LUCI CQ
parent b0cb4d1b5d
commit b477fc73cf
4 changed files with 71 additions and 17 deletions

View File

@ -27,6 +27,11 @@ constexpr uint16_t kNetworkCostUnknown = 50;
constexpr uint16_t kNetworkCostLow = 10;
constexpr uint16_t kNetworkCostMin = 0;
// Add 1 to network cost of underlying network type
// so that e.g a "plain" WIFI is prefered over a VPN over WIFI
// everything else being equal.
constexpr uint16_t kNetworkCostVpn = 1;
// alias
constexpr uint16_t kNetworkCostHigh = kNetworkCostCellular;