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

Unified Diff: net/base/net_util.cc

Issue 3331024: Treat IPv6 link local addresses as loopback addresses. (Closed)
Patch Set: Created 10 years, 3 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_util.cc
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index 4dd357fbc90e625c2341dace10504c034e968641..21c150c7d252b2b165a1c22f41a4c102f4aecadd 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -1831,6 +1831,14 @@ bool HaveOnlyLoopbackAddresses() {
const struct sockaddr* addr = interface->ifa_addr;
if (!addr)
continue;
+ if (addr->sa_family == AF_INET6) {
+ // Safe cast since this is AF_INET6.
+ const struct sockaddr_in6* addr_in6 =
+ reinterpret_cast<const struct sockaddr_in6*>(addr);
+ const struct in6_addr* sin6_addr = &addr_in6->sin6_addr;
+ if (IN6_IS_ADDR_LOOPBACK(sin6_addr) || IN6_IS_ADDR_LINKLOCAL(sin6_addr))
+ continue;
+ }
if (addr->sa_family != AF_INET6 && addr->sa_family != AF_INET)
continue;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698