Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: webrtc/rtc_base/network.cc

Issue 2985133002: If adapter type is unknown and interface name is "ipsec", treat as VPN. (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/rtc_base/network_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 AdapterType BasicNetworkManager::GetAdapterTypeFromName( 794 AdapterType BasicNetworkManager::GetAdapterTypeFromName(
795 const char* network_name) const { 795 const char* network_name) const {
796 // If there is a network_monitor, use it to get the adapter type. 796 // If there is a network_monitor, use it to get the adapter type.
797 // Otherwise, get the adapter type based on a few name matching rules. 797 // Otherwise, get the adapter type based on a few name matching rules.
798 if (network_monitor_) { 798 if (network_monitor_) {
799 AdapterType type = network_monitor_->GetAdapterType(network_name); 799 AdapterType type = network_monitor_->GetAdapterType(network_name);
800 if (type != ADAPTER_TYPE_UNKNOWN) { 800 if (type != ADAPTER_TYPE_UNKNOWN) {
801 return type; 801 return type;
802 } 802 }
803 } 803 }
804 if (strncmp(network_name, "ipsec", 5) == 0) {
805 return ADAPTER_TYPE_VPN;
806 }
804 #if defined(WEBRTC_IOS) 807 #if defined(WEBRTC_IOS)
805 // Cell networks are pdp_ipN on iOS. 808 // Cell networks are pdp_ipN on iOS.
806 if (strncmp(network_name, "pdp_ip", 6) == 0) { 809 if (strncmp(network_name, "pdp_ip", 6) == 0) {
807 return ADAPTER_TYPE_CELLULAR; 810 return ADAPTER_TYPE_CELLULAR;
808 } 811 }
809 if (strncmp(network_name, "en", 2) == 0) { 812 if (strncmp(network_name, "en", 2) == 0) {
810 // This may not be most accurate because sometimes Ethernet interface 813 // This may not be most accurate because sometimes Ethernet interface
811 // name also starts with "en" but it is better than showing it as 814 // name also starts with "en" but it is better than showing it as
812 // "unknown" type. 815 // "unknown" type.
813 // TODO(honghaiz): Write a proper IOS network manager. 816 // TODO(honghaiz): Write a proper IOS network manager.
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 std::stringstream ss; 986 std::stringstream ss;
984 // Print out the first space-terminated token of the network desc, plus 987 // Print out the first space-terminated token of the network desc, plus
985 // the IP address. 988 // the IP address.
986 ss << "Net[" << description_.substr(0, description_.find(' ')) 989 ss << "Net[" << description_.substr(0, description_.find(' '))
987 << ":" << prefix_.ToSensitiveString() << "/" << prefix_length_ 990 << ":" << prefix_.ToSensitiveString() << "/" << prefix_length_
988 << ":" << AdapterTypeToString(type_) << "]"; 991 << ":" << AdapterTypeToString(type_) << "]";
989 return ss.str(); 992 return ss.str();
990 } 993 }
991 994
992 } // namespace rtc 995 } // namespace rtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/rtc_base/network_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698