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

Unified Diff: net/dns/host_resolver_impl_unittest.cc

Issue 1035803003: Fail DNS resolution if the result contains 127.0.53.53. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« net/dns/host_resolver_impl.cc ('K') | « net/dns/host_resolver_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/host_resolver_impl_unittest.cc
diff --git a/net/dns/host_resolver_impl_unittest.cc b/net/dns/host_resolver_impl_unittest.cc
index 7a46a1c4dc4e3cfc1998858a5fb8bc75bd9b0fe7..770a57a21e2279185fee64f05900d6b4464d3ffb 100644
--- a/net/dns/host_resolver_impl_unittest.cc
+++ b/net/dns/host_resolver_impl_unittest.cc
@@ -1319,6 +1319,36 @@ TEST_F(HostResolverImplTest, MultipleAttempts) {
EXPECT_EQ(resolver_proc->resolved_attempt_number(), kAttemptNumberToResolve);
}
+// If a host resolves to a list that includes 127.0.53.53, this is treated as
+// an error. 127.0.53.53 is a localhost address, however it has been given a
+// special significance by ICANN to help surfance name collision resulting from
+// the new gTLDs.
+TEST_F(HostResolverImplTest, NameCollision127_0_53_53) {
+ proc_->AddRuleForAllFamilies("single", "127.0.53.53");
+ proc_->AddRuleForAllFamilies("multiple", "127.0.0.1,127.0.53.53");
+ proc_->AddRuleForAllFamilies("ipv6", "::127.0.53.53");
+ proc_->SignalMultiple(3u);
+
+ Request* request;
+
+ request = CreateRequest("single");
+ EXPECT_EQ(ERR_IO_PENDING, request->Resolve());
+ EXPECT_EQ(ERR_FAILED, request->WaitForResult());
Ryan Sleevi 2015/03/26 00:32:29 We don't give a better error here? To ensure that
eroman 2015/03/26 00:39:31 d'oh, forgot to update the unittest after adding t
+
+ request = CreateRequest("multiple");
+ EXPECT_EQ(ERR_IO_PENDING, request->Resolve());
+ EXPECT_EQ(ERR_FAILED, request->WaitForResult());
+
+ // Resolving an IP literal of 127.0.53.53 however is allowed.
+ EXPECT_EQ(OK, CreateRequest("127.0.53.53")->Resolve());
+
+ // Moreover the address should not be recognized when embedded in an IPv6
+ // address.
+ request = CreateRequest("ipv6");
+ EXPECT_EQ(ERR_IO_PENDING, request->Resolve());
+ EXPECT_EQ(OK, request->WaitForResult());
+}
+
DnsConfig CreateValidDnsConfig() {
IPAddressNumber dns_ip;
bool rv = ParseIPLiteralToNumber("192.168.1.0", &dns_ip);
« net/dns/host_resolver_impl.cc ('K') | « net/dns/host_resolver_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698