Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin/bind: Discard link-local addresses on binding by interface name #4531

Merged
merged 3 commits into from
Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugin/bind/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ If several addresses are provided, a listener will be open on each of the IP pro

Each address has to be an IP or name of one of the interfaces of the host. Bind by interface name, binds to the IPs on that interface at the time of startup or reload (reload will happen with a SIGHUP or if the config file changes).

If the given argument is an interface name, and that interface has serveral IP addresses, CoreDNS will listen on all of the interface IP addresses (including IPv4 and IPv6).
If the given argument is an interface name, and that interface has serveral IP addresses, CoreDNS will listen on all of the interface IP addresses (including IPv4 and IPv6), except for IPv6 link-local addresses on that interface.

## Syntax

Expand Down
4 changes: 3 additions & 1 deletion plugin/bind/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ func setup(c *caddy.Controller) error {
}
for _, addr := range addrs {
if ipnet, ok := addr.(*net.IPNet); ok {
all = append(all, ipnet.IP.String())
if ipnet.IP.To4() != nil || (!ipnet.IP.IsLinkLocalMulticast() && !ipnet.IP.IsLinkLocalUnicast()) {
all = append(all, ipnet.IP.String())
}
}
}
}
Expand Down