| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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/network_interfaces_mac.h" | 5 #include "net/base/network_interfaces_mac.h" |
| 6 | 6 |
| 7 #include <ifaddrs.h> | 7 #include <ifaddrs.h> |
| 8 #include <net/if.h> | 8 #include <net/if.h> |
| 9 #include <netinet/in.h> | 9 #include <netinet/in.h> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 198 |
| 199 if (address.FromSockAddr(addr, addr_size)) { | 199 if (address.FromSockAddr(addr, addr_size)) { |
| 200 uint8_t prefix_length = 0; | 200 uint8_t prefix_length = 0; |
| 201 if (interface->ifa_netmask) { | 201 if (interface->ifa_netmask) { |
| 202 // If not otherwise set, assume the same sa_family as ifa_addr. | 202 // If not otherwise set, assume the same sa_family as ifa_addr. |
| 203 if (interface->ifa_netmask->sa_family == 0) { | 203 if (interface->ifa_netmask->sa_family == 0) { |
| 204 interface->ifa_netmask->sa_family = addr->sa_family; | 204 interface->ifa_netmask->sa_family = addr->sa_family; |
| 205 } | 205 } |
| 206 IPEndPoint netmask; | 206 IPEndPoint netmask; |
| 207 if (netmask.FromSockAddr(interface->ifa_netmask, addr_size)) { | 207 if (netmask.FromSockAddr(interface->ifa_netmask, addr_size)) { |
| 208 prefix_length = MaskPrefixLength(netmask.address()); | 208 prefix_length = MaskPrefixLength(netmask.address_number()); |
| 209 } | 209 } |
| 210 } | 210 } |
| 211 networks->push_back(NetworkInterface( | 211 networks->push_back(NetworkInterface( |
| 212 name, name, if_nametoindex(name.c_str()), connection_type, | 212 name, name, if_nametoindex(name.c_str()), connection_type, |
| 213 address.address(), prefix_length, ip_attributes)); | 213 address.address_number(), prefix_length, ip_attributes)); |
| 214 } | 214 } |
| 215 } | 215 } |
| 216 | 216 |
| 217 return true; | 217 return true; |
| 218 } | 218 } |
| 219 | 219 |
| 220 } // namespace internal | 220 } // namespace internal |
| 221 | 221 |
| 222 bool GetNetworkList(NetworkInterfaceList* networks, int policy) { | 222 bool GetNetworkList(NetworkInterfaceList* networks, int policy) { |
| 223 if (networks == NULL) | 223 if (networks == NULL) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 243 freeifaddrs(interfaces); | 243 freeifaddrs(interfaces); |
| 244 return result; | 244 return result; |
| 245 } | 245 } |
| 246 | 246 |
| 247 std::string GetWifiSSID() { | 247 std::string GetWifiSSID() { |
| 248 NOTIMPLEMENTED(); | 248 NOTIMPLEMENTED(); |
| 249 return ""; | 249 return ""; |
| 250 } | 250 } |
| 251 | 251 |
| 252 } // namespace net | 252 } // namespace net |
| OLD | NEW |