Recognize additional adapter types on Windows
Specifically, Ethernet, Wi-Fi and cellular interfaces.
Note that this only affects native applications, as chromium already
has its own code for this:
https://cs.chromium.org/chromium/src/net/base/network_interfaces_win.cc?l=29&rcl=568ba7132833eea41fc863dd41c377928f49fa51
Which WebRTC accesses through "IpcNetworkManager".
Bug: webrtc:3149, webrtc:6588
Change-Id: I347f2734d95ea24cea3f89e6ed5bf2d135a9fc77
Reviewed-on: https://webrtc-review.googlesource.com/76622
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23332}
diff --git a/rtc_base/network.cc b/rtc_base/network.cc
index 9433813..e857e75 100644
--- a/rtc_base/network.cc
+++ b/rtc_base/network.cc
@@ -708,9 +708,29 @@
auto existing_network = current_networks.find(key);
if (existing_network == current_networks.end()) {
AdapterType adapter_type = ADAPTER_TYPE_UNKNOWN;
- if (adapter_addrs->IfType == IF_TYPE_SOFTWARE_LOOPBACK) {
- // TODO(phoglund): Need to recognize other types as well.
- adapter_type = ADAPTER_TYPE_LOOPBACK;
+ switch (adapter_addrs->IfType) {
+ case IF_TYPE_SOFTWARE_LOOPBACK:
+ adapter_type = ADAPTER_TYPE_LOOPBACK;
+ break;
+ case IF_TYPE_ETHERNET_CSMACD:
+ case IF_TYPE_ETHERNET_3MBIT:
+ case IF_TYPE_IEEE80212:
+ case IF_TYPE_FASTETHER:
+ case IF_TYPE_FASTETHER_FX:
+ case IF_TYPE_GIGABITETHERNET:
+ adapter_type = ADAPTER_TYPE_ETHERNET;
+ break;
+ case IF_TYPE_IEEE80211:
+ adapter_type = ADAPTER_TYPE_WIFI;
+ break;
+ case IF_TYPE_WWANPP:
+ case IF_TYPE_WWANPP2:
+ adapter_type = ADAPTER_TYPE_CELLULAR;
+ break;
+ default:
+ // TODO(phoglund): Need to recognize other types as well.
+ adapter_type = ADAPTER_TYPE_UNKNOWN;
+ break;
}
std::unique_ptr<Network> network(new Network(
name, description, prefix, prefix_length, adapter_type));