mirror of
https://github.com/coredns/coredns.git
synced 2025-12-04 17:35:13 -05:00
plugin/host: don't append the names when reparsing hosts file (#3045)
The host plugin kept on adding entries instead of overwriting. Split the inline cache off from the /etc/hosts file cache and clear /etc/hosts file cache and re-parsing. A bunch of other cleanup as well. Use functions defined in the plugin package, don't re-parse strings if you don't have to and use To4() to check the family for IP addresses. Fix all test cases a carried entries are always fqdn-ed. Various smaller cleanup in unnessacry constants. Fixes: #3014 Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
@@ -11,14 +11,16 @@ file that exists on disk. It checks the file for changes and updates the zones a
|
||||
plugin only supports A, AAAA, and PTR records. The hosts plugin can be used with readily
|
||||
available hosts files that block access to advertising servers.
|
||||
|
||||
The plugin reloads the content of the hosts file every 5 seconds. Upon reload, CoreDNS will use the new definitions.
|
||||
Should the file be deleted, any inlined content will continue to be served. When the file is restored, it will then again be used.
|
||||
The plugin reloads the content of the hosts file every 5 seconds. Upon reload, CoreDNS will use the
|
||||
new definitions. Should the file be deleted, any inlined content will continue to be served. When
|
||||
the file is restored, it will then again be used.
|
||||
|
||||
This plugin can only be used once per Server Block.
|
||||
|
||||
## The hosts file
|
||||
|
||||
Commonly the entries are of the form `IP_address canonical_hostname [aliases...]` as explained by the hosts(5) man page.
|
||||
Commonly the entries are of the form `IP_address canonical_hostname [aliases...]` as explained by
|
||||
the hosts(5) man page.
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -34,7 +36,8 @@ fdfc:a744:27b5:3b0e::1 example.com example
|
||||
|
||||
### PTR records
|
||||
|
||||
PTR records for reverse lookups are generated automatically by CoreDNS (based on the hosts file entries) and cannot be created manually.
|
||||
PTR records for reverse lookups are generated automatically by CoreDNS (based on the hosts file
|
||||
entries) and cannot be created manually.
|
||||
|
||||
## Syntax
|
||||
|
||||
|
||||
Reference in New Issue
Block a user