Previously it was possible for two different questions to hit the same
single in flight entry if the type or class isn't in the relevant
XToString map. This could happen for a proxy server or similar.
* Add a message truncation implementation
* Remove OPT if-statement at end of Scrub
* Impose RFC 6891 payload size limit in Scrub
* Remove *Msg receiver from truncateLoop
* Remove OPT record creation from Scrub
* Test that TestRequestScrubAnswerExact has correct record count
* Rename (*Msg).Scrub to Truncate
This better reflects it's purpose.
* Remove comment reference to scrubbing in Truncate
* Properly calculate the length of OPT record in Truncate
* Correct comment in IsEdns0 in regards to RFC 6891
* Handle the OPT record being anywhere in Truncate
* Slight cleanup of Msg.Truncate
* Use for range loops instead of manual loops
* Use for range loop in Msg.CopyTo
This is a separate commit as the change is slightly more than just
switching the loop style.
* Use for range loop in DNSKEY.publicKeyRSA
* Add explen comment to DNSKEY.publicKeyRSA
* Add checks on data length for A and AAAA records
Fixes panic when parsing A or AAAA records with no data
* Add tests Field() on empty A/AAAA data
* Refactor format test
* Add return value check on format test
* Simplify Server.readTCP
This slightly alters the error behaviour, but it should not be
observable outside of a decorated reader. I don't believe the old
behaviour was either obvious, documented or correct.
* Simplify TCP reading in client Conn
This alters the error behaviour in possibly observable ways, though
this is quite subtle and may not actually be readily observable.
Conn.ReadMsgHeader should behave the same way and still returns
ErrShortRead for length being too short.
Conn.Read will no longer return ErrShortRead if the length == 0,
otherwise it should be largely similar.
* Remove redundant error check in Conn.ReadMsgHeader
* ZoneParser: error on parsing an IPv6 address in an A record
And vice versa for IPv4 with AAAA.
The implementation of isIPv6 is inspired by e341bae08d/src/net/ip.go (L678-L681) .
* Fix benchmarks that try to use ::1 as A record.
* Test A/AAAA parsing via NewRR rather than zone parser.
* Document why we distinguish IPv4 vs IPv6 via existence of ":".
When migrating zones to CoreDNS, it did not accept private key files
the former bind setup gracefully accepted. It turned out they had a
trailing newline for whateveer reason. The dns library should handle
them gracefully, too.
* - implement deep-copy for OPT records + simple UT
* - adding ztypes.go (generated).
* - properly comment the specific behavior for EDNS0
* - remove too narrow UT + down-scope copy() method to package level only
* - tune comment
* RFC 1996 allows SOA in answer in notify
The answer section of a notify can contain a SOA record that we should
not ignore in the DefaultAcceptFunc.
* End sentence
Signed-off-by: Miek Gieben <miek@miek.nl>
* Prevent IsDuplicate from panicing on wrong Rrtype
* Replace the isDuplicateRdata switch with an interface method
This is substantially simpler and avoids the need to use reflect.
* Add equal RR case to TestDuplicateWrongRrtype
* Move RR_Header duplicate checking back into IsDuplicate
This restores the previous behaviour that RR_Header's were never
equal to each other.
* Revert "Move RR_Header duplicate checking back into IsDuplicate"
This reverts commit a3d7eba50825d546074d81084e639bbecf9cbb57.
* Run go fmt on package
This was a mistake when I merged the master branch into this PR.
* Move isDuplicate method to end of RR interface
* Eliminate Variable bool from parserFunc
Instead we now check whether the last token read from the zlexer was
a zNewline or zEOF. The error check above should be tripped for any
record that ends prematurely.
* Use an interface method for parsing zone file records
* Prevent panic in TestOmittedTTL if no regexp match
* Move slurpRemainder into fixed length parse functions
This is consistent with the original logic in setRR and avoids potential
edge cases.
* Parse synthetic records according to RFC 3597
These records lack a presentation format and cannot be parsed otherwise.
This behaviour is consistent with how this previously operated.
* Flatten goroutine inside goroutine in Transfer.In
* Return an error for unknown question types
Previously this would just be silently ignored leaving nothing to close
the returned channel or return an error.
* Avoid calling RR.Header more than once per RR
Header is an interface method so there's non-zero overhead when calling
it.
* Reset entire RR_Header in SIG.Sign
This is equivilant (while also clearing Rdlength) while being simpler.
* Fork packDomainName for IsDomainName
* Eliminate msg buffer from packDomainName2
* Eliminate compression code from packDomainName2
* Remove off argument and return from packDomainName2
* Remove bs buffer from packDomainName2
* Merge packDomainName2 into IsDomainName
* Eliminate root label special case from IsDomainName
* Remove ls variable from IsDomainName
* Fixup comments in IsDomainName
* Remove msg == nil special cases from packDomainName
* Eliminate lenmsg variable from packDomainName
* Eliminate label counting from packDomainName
* Change off length check in IsDomainName
* Fix IsDomainName for escaped names
* Use strings.HasSuffix for IsFqdn
* Revert "Use strings.HasSuffix for IsFqdn"
I'll submit this as a seperate PR.
This reverts commit 80bf8c83700d121ea45edac0f00db52817498166.
* Cross reference IsDomainName and packDomainName
* Correct IsDomainName max length comment