| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 IPEndPoint address; | 189 IPEndPoint address; |
| 190 | 190 |
| 191 int addr_size = 0; | 191 int addr_size = 0; |
| 192 if (addr->sa_family == AF_INET6) { | 192 if (addr->sa_family == AF_INET6) { |
| 193 addr_size = sizeof(sockaddr_in6); | 193 addr_size = sizeof(sockaddr_in6); |
| 194 } else if (addr->sa_family == AF_INET) { | 194 } else if (addr->sa_family == AF_INET) { |
| 195 addr_size = sizeof(sockaddr_in); | 195 addr_size = sizeof(sockaddr_in); |
| 196 } | 196 } |
| 197 | 197 |
| 198 if (address.FromSockAddr(addr, addr_size)) { | 198 if (address.FromSockAddr(addr, addr_size)) { |
| 199 uint8 prefix_length = 0; | 199 uint8_t prefix_length = 0; |
| 200 if (interface->ifa_netmask) { | 200 if (interface->ifa_netmask) { |
| 201 // If not otherwise set, assume the same sa_family as ifa_addr. | 201 // If not otherwise set, assume the same sa_family as ifa_addr. |
| 202 if (interface->ifa_netmask->sa_family == 0) { | 202 if (interface->ifa_netmask->sa_family == 0) { |
| 203 interface->ifa_netmask->sa_family = addr->sa_family; | 203 interface->ifa_netmask->sa_family = addr->sa_family; |
| 204 } | 204 } |
| 205 IPEndPoint netmask; | 205 IPEndPoint netmask; |
| 206 if (netmask.FromSockAddr(interface->ifa_netmask, addr_size)) { | 206 if (netmask.FromSockAddr(interface->ifa_netmask, addr_size)) { |
| 207 prefix_length = MaskPrefixLength(netmask.address()); | 207 prefix_length = MaskPrefixLength(netmask.address()); |
| 208 } | 208 } |
| 209 } | 209 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 freeifaddrs(interfaces); | 242 freeifaddrs(interfaces); |
| 243 return result; | 243 return result; |
| 244 } | 244 } |
| 245 | 245 |
| 246 std::string GetWifiSSID() { | 246 std::string GetWifiSSID() { |
| 247 NOTIMPLEMENTED(); | 247 NOTIMPLEMENTED(); |
| 248 return ""; | 248 return ""; |
| 249 } | 249 } |
| 250 | 250 |
| 251 } // namespace net | 251 } // namespace net |
| OLD | NEW |