mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-31 02:03:20 -04:00 
			
		
		
		
	Default to scrubbing replies in the server (#2012)
Every plugin needs to deal with EDNS0 and should call Scrub to make a message fit the client's buffer. Move this functionality into the server and wrapping the ResponseWriter into a ScrubWriter that handles these bits for us. Result: Less code and faster, because multiple chained plugins could all be calling scrub and SizeAndDo - now there is just one place. Most tests in file/* and dnssec/* needed adjusting because in those unit tests you don't see OPT RRs anymore. The DNSSEC signer was also looking at the returned OPT RR to see if it needed to sign - as those are now added by the server (and thus later), this needed to change slightly. Scrub itself still exist (for backward compat reasons), but has been made a noop. Scrub has been renamed to scrub as it should not be used by external plugins. Fixes: #2010 Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
		| @@ -73,8 +73,7 @@ var delegationTestCases = []test.Case{ | ||||
|  | ||||
| var secureDelegationTestCases = []test.Case{ | ||||
| 	{ | ||||
| 		Qname: "a.delegated.example.org.", Qtype: dns.TypeTXT, | ||||
| 		Do: true, | ||||
| 		Qname: "a.delegated.example.org.", Qtype: dns.TypeTXT, Do: true, | ||||
| 		Ns: []dns.RR{ | ||||
| 			test.DS("delegated.example.org.	1800	IN	DS	10056 5 1 EE72CABD1927759CDDA92A10DBF431504B9E1F13"), | ||||
| 			test.DS("delegated.example.org.	1800	IN	DS	10056 5 2 E4B05F87725FA86D9A64F1E53C3D0E6250946599DFE639C45955B0ED416CDDFA"), | ||||
| @@ -83,14 +82,12 @@ var secureDelegationTestCases = []test.Case{ | ||||
| 			test.RRSIG("delegated.example.org.	1800	IN	RRSIG	DS 13 3 1800 20161129153240 20161030153240 49035 example.org. rlNNzcUmtbjLSl02ZzQGUbWX75yCUx0Mug1jHtKVqRq1hpPE2S3863tIWSlz+W9wz4o19OI4jbznKKqk+DGKog=="), | ||||
| 		}, | ||||
| 		Extra: []dns.RR{ | ||||
| 			test.OPT(4096, true), | ||||
| 			test.A("a.delegated.example.org. 1800 IN A 139.162.196.78"), | ||||
| 			test.AAAA("a.delegated.example.org. 1800 IN AAAA 2a01:7e00::f03c:91ff:fef1:6735"), | ||||
| 		}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		Qname: "delegated.example.org.", Qtype: dns.TypeNS, | ||||
| 		Do: true, | ||||
| 		Qname: "delegated.example.org.", Qtype: dns.TypeNS, Do: true, | ||||
| 		Ns: []dns.RR{ | ||||
| 			test.DS("delegated.example.org.	1800	IN	DS	10056 5 1 EE72CABD1927759CDDA92A10DBF431504B9E1F13"), | ||||
| 			test.DS("delegated.example.org.	1800	IN	DS	10056 5 2 E4B05F87725FA86D9A64F1E53C3D0E6250946599DFE639C45955B0ED416CDDFA"), | ||||
| @@ -99,14 +96,12 @@ var secureDelegationTestCases = []test.Case{ | ||||
| 			test.RRSIG("delegated.example.org.	1800	IN	RRSIG	DS 13 3 1800 20161129153240 20161030153240 49035 example.org. rlNNzcUmtbjLSl02ZzQGUbWX75yCUx0Mug1jHtKVqRq1hpPE2S3863tIWSlz+W9wz4o19OI4jbznKKqk+DGKog=="), | ||||
| 		}, | ||||
| 		Extra: []dns.RR{ | ||||
| 			test.OPT(4096, true), | ||||
| 			test.A("a.delegated.example.org. 1800 IN A 139.162.196.78"), | ||||
| 			test.AAAA("a.delegated.example.org. 1800 IN AAAA 2a01:7e00::f03c:91ff:fef1:6735"), | ||||
| 		}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		Qname: "foo.delegated.example.org.", Qtype: dns.TypeA, | ||||
| 		Do: true, | ||||
| 		Qname: "foo.delegated.example.org.", Qtype: dns.TypeA, Do: true, | ||||
| 		Ns: []dns.RR{ | ||||
| 			test.DS("delegated.example.org.	1800	IN	DS	10056 5 1 EE72CABD1927759CDDA92A10DBF431504B9E1F13"), | ||||
| 			test.DS("delegated.example.org.	1800	IN	DS	10056 5 2 E4B05F87725FA86D9A64F1E53C3D0E6250946599DFE639C45955B0ED416CDDFA"), | ||||
| @@ -115,14 +110,12 @@ var secureDelegationTestCases = []test.Case{ | ||||
| 			test.RRSIG("delegated.example.org.	1800	IN	RRSIG	DS 13 3 1800 20161129153240 20161030153240 49035 example.org. rlNNzcUmtbjLSl02ZzQGUbWX75yCUx0Mug1jHtKVqRq1hpPE2S3863tIWSlz+W9wz4o19OI4jbznKKqk+DGKog=="), | ||||
| 		}, | ||||
| 		Extra: []dns.RR{ | ||||
| 			test.OPT(4096, true), | ||||
| 			test.A("a.delegated.example.org. 1800 IN A 139.162.196.78"), | ||||
| 			test.AAAA("a.delegated.example.org. 1800 IN AAAA 2a01:7e00::f03c:91ff:fef1:6735"), | ||||
| 		}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		Qname: "foo.delegated.example.org.", Qtype: dns.TypeDS, | ||||
| 		Do: true, | ||||
| 		Qname: "foo.delegated.example.org.", Qtype: dns.TypeDS, Do: true, | ||||
| 		Ns: []dns.RR{ | ||||
| 			test.DS("delegated.example.org.	1800	IN	DS	10056 5 1 EE72CABD1927759CDDA92A10DBF431504B9E1F13"), | ||||
| 			test.DS("delegated.example.org.	1800	IN	DS	10056 5 2 E4B05F87725FA86D9A64F1E53C3D0E6250946599DFE639C45955B0ED416CDDFA"), | ||||
| @@ -131,14 +124,12 @@ var secureDelegationTestCases = []test.Case{ | ||||
| 			test.RRSIG("delegated.example.org.	1800	IN	RRSIG	DS 13 3 1800 20161129153240 20161030153240 49035 example.org. rlNNzcUmtbjLSl02ZzQGUbWX75yCUx0Mug1jHtKVqRq1hpPE2S3863tIWSlz+W9wz4o19OI4jbznKKqk+DGKog=="), | ||||
| 		}, | ||||
| 		Extra: []dns.RR{ | ||||
| 			test.OPT(4096, true), | ||||
| 			test.A("a.delegated.example.org. 1800 IN A 139.162.196.78"), | ||||
| 			test.AAAA("a.delegated.example.org. 1800 IN AAAA 2a01:7e00::f03c:91ff:fef1:6735"), | ||||
| 		}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		Qname: "delegated.example.org.", Qtype: dns.TypeDS, | ||||
| 		Do: true, | ||||
| 		Qname: "delegated.example.org.", Qtype: dns.TypeDS, Do: true, | ||||
| 		Answer: []dns.RR{ | ||||
| 			test.DS("delegated.example.org.	1800	IN	DS	10056 5 1 EE72CABD1927759CDDA92A10DBF431504B9E1F13"), | ||||
| 			test.DS("delegated.example.org.	1800	IN	DS	10056 5 2 E4B05F87725FA86D9A64F1E53C3D0E6250946599DFE639C45955B0ED416CDDFA"), | ||||
| @@ -149,9 +140,6 @@ var secureDelegationTestCases = []test.Case{ | ||||
| 			test.NS("example.org.	1800	IN	NS	b.iana-servers.net."), | ||||
| 			test.RRSIG("example.org.	1800	IN	RRSIG	NS 13 2 1800 20161129153240 20161030153240 49035 example.org. llrHoIuw="), | ||||
| 		}, | ||||
| 		Extra: []dns.RR{ | ||||
| 			test.OPT(4096, true), | ||||
| 		}, | ||||
| 	}, | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user