mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-31 10:13:14 -04:00 
			
		
		
		
	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 <minportant@gmail.com> Co-authored-by: Min Woo Kim <59036289+minportant@users.noreply.github.com>
This commit is contained in:
		| @@ -13,6 +13,8 @@ import ( | |||||||
| 	"github.com/miekg/dns" | 	"github.com/miekg/dns" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|  | const maxCnameChainLength = 10 | ||||||
|  |  | ||||||
| // A returns A records from Backend or an error. | // 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) { | 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) | 	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) | 			newRecord := serv.NewCNAME(state.QName(), serv.Host) | ||||||
| 			if len(previousRecords) > 7 { | 			if len(previousRecords) > maxCnameChainLength { | ||||||
| 				// don't add it, and just continue | 				// don't add it, and just continue | ||||||
| 				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) | 			newRecord := serv.NewCNAME(state.QName(), serv.Host) | ||||||
| 			if len(previousRecords) > 7 { | 			if len(previousRecords) > maxCnameChainLength { | ||||||
| 				// don't add it, and just continue | 				// don't add it, and just continue | ||||||
| 				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) | 			newRecord := serv.NewCNAME(state.QName(), serv.Host) | ||||||
| 			if len(previousRecords) > 7 { | 			if len(previousRecords) > maxCnameChainLength { | ||||||
| 				// don't add it, and just continue | 				// don't add it, and just continue | ||||||
| 				continue | 				continue | ||||||
| 			} | 			} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user