OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/dns/dns_config_service_posix.h" | 5 #include "net/dns/dns_config_service_posix.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
535 if (res.options & kUnhandledOptions) { | 535 if (res.options & kUnhandledOptions) { |
536 dns_config->unhandled_options = true; | 536 dns_config->unhandled_options = true; |
537 return CONFIG_PARSE_POSIX_UNHANDLED_OPTIONS; | 537 return CONFIG_PARSE_POSIX_UNHANDLED_OPTIONS; |
538 } | 538 } |
539 | 539 |
540 if (dns_config->nameservers.empty()) | 540 if (dns_config->nameservers.empty()) |
541 return CONFIG_PARSE_POSIX_NO_NAMESERVERS; | 541 return CONFIG_PARSE_POSIX_NO_NAMESERVERS; |
542 | 542 |
543 // If any name server is 0.0.0.0, assume the configuration is invalid. | 543 // If any name server is 0.0.0.0, assume the configuration is invalid. |
544 // TODO(szym): Measure how often this happens. http://crbug.com/125599 | 544 // TODO(szym): Measure how often this happens. http://crbug.com/125599 |
545 const IPAddressNumber kEmptyAddress(kIPv4AddressSize); | 545 const IPAddressNumber kEmptyAddress(kIPv4AddressSize); |
eroman
2016/01/13 23:19:42
Here is the zero address again we were seeing. I t
martijnc
2016/01/14 22:48:17
Will do this in a separate CL.
| |
546 for (unsigned i = 0; i < dns_config->nameservers.size(); ++i) { | 546 for (unsigned i = 0; i < dns_config->nameservers.size(); ++i) { |
547 if (dns_config->nameservers[i].address() == kEmptyAddress) | 547 if (dns_config->nameservers[i].address().bytes() == kEmptyAddress) |
548 return CONFIG_PARSE_POSIX_NULL_ADDRESS; | 548 return CONFIG_PARSE_POSIX_NULL_ADDRESS; |
549 } | 549 } |
550 return CONFIG_PARSE_POSIX_OK; | 550 return CONFIG_PARSE_POSIX_OK; |
551 } | 551 } |
552 | 552 |
553 #else // defined(OS_ANDROID) | 553 #else // defined(OS_ANDROID) |
554 | 554 |
555 bool DnsConfigServicePosix::SeenChangeSince( | 555 bool DnsConfigServicePosix::SeenChangeSince( |
556 const base::Time& since_time) const { | 556 const base::Time& since_time) const { |
557 DCHECK(CalledOnValidThread()); | 557 DCHECK(CalledOnValidThread()); |
(...skipping 26 matching lines...) Expand all Loading... | |
584 #endif // defined(OS_ANDROID) | 584 #endif // defined(OS_ANDROID) |
585 | 585 |
586 } // namespace internal | 586 } // namespace internal |
587 | 587 |
588 // static | 588 // static |
589 scoped_ptr<DnsConfigService> DnsConfigService::CreateSystemService() { | 589 scoped_ptr<DnsConfigService> DnsConfigService::CreateSystemService() { |
590 return scoped_ptr<DnsConfigService>(new internal::DnsConfigServicePosix()); | 590 return scoped_ptr<DnsConfigService>(new internal::DnsConfigServicePosix()); |
591 } | 591 } |
592 | 592 |
593 } // namespace net | 593 } // namespace net |
OLD | NEW |