mirror of
https://github.com/coredns/coredns.git
synced 2026-10-27 20:55:45 -04:00
Merge commit from fork
EndpointSlice FQDN addresses were copied into endpoint records as if they were IP addresses. CoreDNS then treated each value as a CNAME target. A tenant could build a branching chain of headless Services that made one query perform exponential work and exhaust CoreDNS memory. Publish endpoints only from IPv4 and IPv6 slices and validate every address against its declared family. Deduplicate CNAME targets for the whole query so repeated or converging paths are chased once. Protect internal self-lookups with an independent depth limit. This stops direct and indirect k8s_external CNAME loops without consuming the loop counter already maintained by the file and rewrite plugins. Add regression coverage for address types, recursive convergence, repeated k8s_external targets, and direct and indirect self-reference. Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
This commit is contained in:
@@ -145,7 +145,12 @@ func generateEndpointSlices(cidr string, svcType string, client kubernetes.Inter
|
||||
port := int32(80)
|
||||
protocol := api.Protocol("tcp")
|
||||
name := "http"
|
||||
addressType := discovery.AddressTypeIPv4
|
||||
if ip.To4() == nil {
|
||||
addressType = discovery.AddressTypeIPv6
|
||||
}
|
||||
eps := &discovery.EndpointSlice{
|
||||
AddressType: addressType,
|
||||
Ports: []discovery.EndpointPort{
|
||||
{
|
||||
Port: &port,
|
||||
|
||||
Reference in New Issue
Block a user