Index: net/base/net_util_posix.cc |
diff --git a/net/base/net_util_posix.cc b/net/base/net_util_posix.cc |
index 315e9ed1a237e658bafbb5b3e9b00e644e0921d1..5c1c3e7a311873728c0b5816b0a4250a4745a199 100644 |
--- a/net/base/net_util_posix.cc |
+++ b/net/base/net_util_posix.cc |
@@ -41,7 +41,7 @@ namespace { |
#if !defined(OS_ANDROID) |
struct NetworkInterfaceInfo { |
- NetworkInterfaceInfo() : permanent(true) { } |
+ NetworkInterfaceInfo() : permanent(true) {} |
bool permanent; // IPv6 has notion of temporary address. If the address is |
// IPv6 and it's temporary this field will be false. |
@@ -69,12 +69,12 @@ void RemovePermanentIPv6AddressesWhereTemporaryExists( |
return; |
// Search for permenent addresses belonging to same network interface. |
- for (i = infos->begin(); i != infos->end(); ) { |
+ for (i = infos->begin(); i != infos->end();) { |
// If the address is IPv6 and it's permanent and there is temporary |
// address for it, then we can remove this address. |
if ((i->interface.address.size() == kIPv6AddressSize) && i->permanent && |
(ifaces_with_temp_addrs.find(i->interface.name) != |
- ifaces_with_temp_addrs.end())) { |
+ ifaces_with_temp_addrs.end())) { |
i = infos->erase(i); |
} else { |
++i; |
@@ -87,7 +87,8 @@ void RemovePermanentIPv6AddressesWhereTemporaryExists( |
#if defined(OS_MACOSX) && !defined(OS_IOS) |
NetworkChangeNotifier::ConnectionType GetNetworkInterfaceType( |
- int addr_family, const std::string& interface_name) { |
+ int addr_family, |
+ const std::string& interface_name) { |
NetworkChangeNotifier::ConnectionType type = |
NetworkChangeNotifier::CONNECTION_UNKNOWN; |
@@ -131,18 +132,19 @@ bool GetNetworkList(NetworkInterfaceList* networks, int policy) { |
std::string interface_address = network_tokenizer.token(); |
IPAddressNumber address; |
size_t network_prefix = 0; |
- CHECK(ParseCIDRBlock(network_tokenizer.token(), |
- &address, |
- &network_prefix)); |
+ CHECK(ParseCIDRBlock(network_tokenizer.token(), &address, &network_prefix)); |
CHECK(network_tokenizer.GetNext()); |
uint32 index = 0; |
CHECK(base::StringToUint(network_tokenizer.token(), &index)); |
networks->push_back( |
- NetworkInterface(name, name, index, |
+ NetworkInterface(name, |
+ name, |
+ index, |
NetworkChangeNotifier::CONNECTION_UNKNOWN, |
- address, network_prefix)); |
+ address, |
+ network_prefix)); |
} |
return true; |
#else |
@@ -156,7 +158,7 @@ bool GetNetworkList(NetworkInterfaceList* networks, int policy) { |
DCHECK_GT(ioctl_socket, 0); |
} |
- ifaddrs *interfaces; |
+ ifaddrs* interfaces; |
if (getifaddrs(&interfaces) < 0) { |
PLOG(ERROR) << "getifaddrs"; |
return false; |
@@ -165,8 +167,7 @@ bool GetNetworkList(NetworkInterfaceList* networks, int policy) { |
std::vector<NetworkInterfaceInfo> network_infos; |
// Enumerate the addresses assigned to network interfaces which are up. |
- for (ifaddrs *interface = interfaces; |
- interface != NULL; |
+ for (ifaddrs* interface = interfaces; interface != NULL; |
interface = interface->ifa_next) { |
// Skip loopback interfaces, and ones which are down. |
if (!(IFF_UP & interface->ifa_flags)) |
@@ -191,8 +192,7 @@ bool GetNetworkList(NetworkInterfaceList* networks, int policy) { |
continue; |
} |
} else if (addr->sa_family == AF_INET) { |
- struct sockaddr_in* addr_in = |
- reinterpret_cast<struct sockaddr_in*>(addr); |
+ struct sockaddr_in* addr_in = reinterpret_cast<struct sockaddr_in*>(addr); |
addr_size = sizeof(*addr_in); |
if (addr_in->sin_addr.s_addr == INADDR_LOOPBACK || |
addr_in->sin_addr.s_addr == 0) { |
@@ -221,7 +221,8 @@ bool GetNetworkList(NetworkInterfaceList* networks, int policy) { |
ioctl_socket >= 0 && addr->sa_family == AF_INET6) { |
struct in6_ifreq ifr = {}; |
strncpy(ifr.ifr_name, interface->ifa_name, sizeof(ifr.ifr_name) - 1); |
- memcpy(&ifr.ifr_ifru.ifru_addr, interface->ifa_addr, |
+ memcpy(&ifr.ifr_ifru.ifru_addr, |
+ interface->ifa_addr, |
interface->ifa_addr->sa_len); |
int rv = ioctl(ioctl_socket, SIOCGIFAFLAG_IN6, &ifr); |
if (rv >= 0) { |
@@ -245,9 +246,12 @@ bool GetNetworkList(NetworkInterfaceList* networks, int policy) { |
net_mask = MaskPrefixLength(netmask.address()); |
} |
} |
- network_info.interface = NetworkInterface( |
- name, name, if_nametoindex(name.c_str()), |
- connection_type, address.address(), net_mask); |
+ network_info.interface = NetworkInterface(name, |
+ name, |
+ if_nametoindex(name.c_str()), |
+ connection_type, |
+ address.address(), |
+ net_mask); |
network_infos.push_back(NetworkInterfaceInfo(network_info)); |
} |