From 2e266e91268d9cb55bc3c3089303efc989de2abb Mon Sep 17 00:00:00 2001 From: Noah Richards Date: Tue, 7 Apr 2015 11:51:56 -0700 Subject: [PATCH] On iOS, detect pdp_ip networks as cellular. BUG= R=juberti@webrtc.org, tkchin@webrtc.org Review URL: https://webrtc-codereview.appspot.com/44009004 Cr-Commit-Position: refs/heads/master@{#8943} --- webrtc/base/network.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/webrtc/base/network.cc b/webrtc/base/network.cc index ff092366fa..2081c94e2c 100644 --- a/webrtc/base/network.cc +++ b/webrtc/base/network.cc @@ -381,9 +381,15 @@ void BasicNetworkManager::ConvertIfAddrs(struct ifaddrs* interfaces, if (existing_network == current_networks.end()) { AdapterType adapter_type = ADAPTER_TYPE_UNKNOWN; if (cursor->ifa_flags & IFF_LOOPBACK) { - // TODO(phoglund): Need to recognize other types as well. adapter_type = ADAPTER_TYPE_LOOPBACK; } +#if defined(WEBRTC_IOS) + // Cell networks are pdp_ipN on iOS. + if (strncmp(cursor->ifa_name, "pdp_ip", 6) == 0) { + adapter_type = ADAPTER_TYPE_CELLULAR; + } +#endif + // TODO(phoglund): Need to recognize other types as well. scoped_ptr network(new Network(cursor->ifa_name, cursor->ifa_name, prefix,