From 33d0d058115800f452e0fa7f7eb912a570608018 Mon Sep 17 00:00:00 2001 From: Min Woo Kim <59036289+uuoonim@users.noreply.github.com> Date: Mon, 24 Mar 2025 10:38:11 -0400 Subject: [PATCH] Increase CNAME lookup limit from 7 to 10 (#7153) Signed-off-by: Min Woo Kim <59036289+minportant@users.noreply.github.com> Signed-off-by: Min Woo Kim Co-authored-by: Min Woo Kim <59036289+minportant@users.noreply.github.com> --- plugin/backend_lookup.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugin/backend_lookup.go b/plugin/backend_lookup.go index 0887bb4dc..371b96662 100644 --- a/plugin/backend_lookup.go +++ b/plugin/backend_lookup.go @@ -13,6 +13,8 @@ import ( "github.com/miekg/dns" ) +const maxCnameChainLength = 10 + // A returns A records from Backend or an error. func A(ctx context.Context, b ServiceBackend, zone string, state request.Request, previousRecords []dns.RR, opt Options) (records []dns.RR, truncated bool, err error) { services, err := checkForApex(ctx, b, zone, state, opt) @@ -34,7 +36,7 @@ func A(ctx context.Context, b ServiceBackend, zone string, state request.Request } newRecord := serv.NewCNAME(state.QName(), serv.Host) - if len(previousRecords) > 7 { + if len(previousRecords) > maxCnameChainLength { // don't add it, and just continue continue } @@ -108,7 +110,7 @@ func AAAA(ctx context.Context, b ServiceBackend, zone string, state request.Requ } newRecord := serv.NewCNAME(state.QName(), serv.Host) - if len(previousRecords) > 7 { + if len(previousRecords) > maxCnameChainLength { // don't add it, and just continue continue } @@ -361,7 +363,7 @@ func TXT(ctx context.Context, b ServiceBackend, zone string, state request.Reque } newRecord := serv.NewCNAME(state.QName(), serv.Host) - if len(previousRecords) > 7 { + if len(previousRecords) > maxCnameChainLength { // don't add it, and just continue continue }