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

Unified Diff: net/dns/dns_config_service_posix.cc

Issue 10546081: [net/dns] If the only name server is 0.0.0.0:53 assume DnsConfig is invalid. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initialize sockaddr_in. Created 8 years, 6 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 | net/dns/dns_config_service_posix_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/dns_config_service_posix.cc
diff --git a/net/dns/dns_config_service_posix.cc b/net/dns/dns_config_service_posix.cc
index a0571912541db487d1b3ea7dd54cff33bbfce0fa..0caf2f481fe526b55fccfb021eb2d6d2cfdcf14d 100644
--- a/net/dns/dns_config_service_posix.cc
+++ b/net/dns/dns_config_service_posix.cc
@@ -13,6 +13,7 @@
#include "base/memory/scoped_ptr.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_util.h"
+#include "net/dns/dns_protocol.h"
#include "net/dns/serial_worker.h"
namespace net {
@@ -189,6 +190,11 @@ bool ConvertResStateToDnsConfig(const struct __res_state& res,
#endif
dns_config->edns0 = res.options & RES_USE_EDNS0;
+ // If the only name server is 0.0.0.0:53, assume the configuration is invalid.
+ const IPEndPoint kDefaultAddress(IPAddressNumber(kIPv4AddressSize),
+ dns_protocol::kDefaultPort);
+ if (dns_config->nameservers.size() == 1)
+ return !(dns_config->nameservers.front() == kDefaultAddress);
mmenke 2012/06/11 22:38:54 Wonder if it makes more sense to fail if any of th
szym 2012/06/14 16:18:20 Done.
return true;
}
#endif // !defined(OS_ANDROID)
« no previous file with comments | « no previous file | net/dns/dns_config_service_posix_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698