OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/base/net_util.h" | 5 #include "net/base/net_util.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <sys/types.h> | 8 #include <sys/types.h> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 &address, | 135 &address, |
136 &network_prefix)); | 136 &network_prefix)); |
137 | 137 |
138 CHECK(network_tokenizer.GetNext()); | 138 CHECK(network_tokenizer.GetNext()); |
139 uint32 index = 0; | 139 uint32 index = 0; |
140 CHECK(base::StringToUint(network_tokenizer.token(), &index)); | 140 CHECK(base::StringToUint(network_tokenizer.token(), &index)); |
141 | 141 |
142 networks->push_back( | 142 networks->push_back( |
143 NetworkInterface(name, name, index, | 143 NetworkInterface(name, name, index, |
144 NetworkChangeNotifier::CONNECTION_UNKNOWN, | 144 NetworkChangeNotifier::CONNECTION_UNKNOWN, |
145 address, network_prefix)); | 145 address, network_prefix)); |
lorenzo
2014/09/11 06:06:10
What about the flags? Will this compile?
guoweis_webrtc
2014/09/12 23:55:21
My bad. I have ensured trybot passed this time.
| |
146 } | 146 } |
147 return true; | 147 return true; |
148 #else | 148 #else |
149 // getifaddrs() may require IO operations. | 149 // getifaddrs() may require IO operations. |
150 base::ThreadRestrictions::AssertIOAllowed(); | 150 base::ThreadRestrictions::AssertIOAllowed(); |
151 | 151 |
152 #if defined(OS_MACOSX) && !defined(OS_IOS) | 152 #if defined(OS_MACOSX) && !defined(OS_IOS) |
153 int ioctl_socket = -1; | 153 int ioctl_socket = -1; |
154 if (policy & INCLUDE_ONLY_TEMP_IPV6_ADDRESS_IF_POSSIBLE) { | 154 if (policy & INCLUDE_ONLY_TEMP_IPV6_ADDRESS_IF_POSSIBLE) { |
155 // we need a socket to query information about temporary address. | 155 // we need a socket to query information about temporary address. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
242 if (interface->ifa_netmask->sa_family == 0) { | 242 if (interface->ifa_netmask->sa_family == 0) { |
243 interface->ifa_netmask->sa_family = addr->sa_family; | 243 interface->ifa_netmask->sa_family = addr->sa_family; |
244 } | 244 } |
245 IPEndPoint netmask; | 245 IPEndPoint netmask; |
246 if (netmask.FromSockAddr(interface->ifa_netmask, addr_size)) { | 246 if (netmask.FromSockAddr(interface->ifa_netmask, addr_size)) { |
247 net_mask = MaskPrefixLength(netmask.address()); | 247 net_mask = MaskPrefixLength(netmask.address()); |
248 } | 248 } |
249 } | 249 } |
250 network_info.interface = NetworkInterface( | 250 network_info.interface = NetworkInterface( |
251 name, name, if_nametoindex(name.c_str()), | 251 name, name, if_nametoindex(name.c_str()), |
252 connection_type, address.address(), net_mask); | 252 connection_type, address.address(), net_mask, |
253 IPV6_ADDRESS_FLAG_NONE); | |
253 | 254 |
254 network_infos.push_back(NetworkInterfaceInfo(network_info)); | 255 network_infos.push_back(NetworkInterfaceInfo(network_info)); |
255 } | 256 } |
256 } | 257 } |
257 freeifaddrs(interfaces); | 258 freeifaddrs(interfaces); |
258 #if defined(OS_MACOSX) && !defined(OS_IOS) | 259 #if defined(OS_MACOSX) && !defined(OS_IOS) |
259 if (ioctl_socket >= 0) { | 260 if (ioctl_socket >= 0) { |
260 close(ioctl_socket); | 261 close(ioctl_socket); |
261 } | 262 } |
262 #endif | 263 #endif |
263 | 264 |
264 if (policy & INCLUDE_ONLY_TEMP_IPV6_ADDRESS_IF_POSSIBLE) { | 265 if (policy & INCLUDE_ONLY_TEMP_IPV6_ADDRESS_IF_POSSIBLE) { |
265 RemovePermanentIPv6AddressesWhereTemporaryExists(&network_infos); | 266 RemovePermanentIPv6AddressesWhereTemporaryExists(&network_infos); |
266 } | 267 } |
267 | 268 |
268 for (size_t i = 0; i < network_infos.size(); ++i) { | 269 for (size_t i = 0; i < network_infos.size(); ++i) { |
269 networks->push_back(network_infos[i].interface); | 270 networks->push_back(network_infos[i].interface); |
270 } | 271 } |
271 return true; | 272 return true; |
272 #endif | 273 #endif |
273 } | 274 } |
274 | 275 |
275 WifiPHYLayerProtocol GetWifiPHYLayerProtocol() { | 276 WifiPHYLayerProtocol GetWifiPHYLayerProtocol() { |
276 return WIFI_PHY_LAYER_PROTOCOL_UNKNOWN; | 277 return WIFI_PHY_LAYER_PROTOCOL_UNKNOWN; |
277 } | 278 } |
278 | 279 |
279 } // namespace net | 280 } // namespace net |
OLD | NEW |