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

Unified Diff: net/base/net_util_posix.cc

Issue 100703002: Added net::NetworkInterface::interface_index. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/net_util.cc ('k') | net/base/net_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_util_posix.cc
diff --git a/net/base/net_util_posix.cc b/net/base/net_util_posix.cc
index 4ff3ee9f4583c89255f826c71e6356fdcf016e70..5e1042b4304c6ba9ba8d17954c259edc2193f860 100644
--- a/net/base/net_util_posix.cc
+++ b/net/base/net_util_posix.cc
@@ -81,8 +81,12 @@ bool GetNetworkList(NetworkInterfaceList* networks) {
&address,
&network_prefix));
+ CHECK(network_tokenizer.GetNext());
+ uint32 index = 0;
+ CHECK(base::StringToUint(network_tokenizer.token(), &index));
+
networks->push_back(
- NetworkInterface(name, address, network_prefix));
+ NetworkInterface(name, index, address, network_prefix));
}
return true;
#else
@@ -108,6 +112,7 @@ bool GetNetworkList(NetworkInterfaceList* networks) {
struct sockaddr* addr = interface->ifa_addr;
if (!addr)
continue;
+
// Skip unspecified addresses (i.e. made of zeroes) and loopback addresses
// configured on non-loopback interfaces.
int addr_size = 0;
@@ -144,7 +149,9 @@ bool GetNetworkList(NetworkInterfaceList* networks) {
}
}
- networks->push_back(NetworkInterface(name, address.address(), net_mask));
+ networks->push_back(
+ NetworkInterface(name, if_nametoindex(name.c_str()),
+ address.address(), net_mask));
}
}
« no previous file with comments | « net/base/net_util.cc ('k') | net/base/net_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698