Commit Graph

4079 Commits

Author SHA1 Message Date
Miek Gieben 59b8e6b3db
Remove the word Scrub (#961)
The function is called Truncate, not Scrub (that was the old name).
Updated the function's documentation to rename this.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-05-03 08:25:00 +01:00
Tom Thorogood 92185d1e17 Simplify PrivateRR copying (#960)
This eliminates mkPrivateRR and reduces the risk of panic.
2019-04-30 09:14:58 +01:00
Tom Thorogood 56c04f1fec Fix dns:"hex" field len being off-by-one (#959)
dns:"hex" fields are not packed with any extra trailing byte. This was
causing a mismatch between PackRR and Len.
2019-04-30 09:14:07 +01:00
Miek Gieben 8aa92d4e02 Release 1.1.9 2019-04-30 07:24:24 +01:00
Tom Thorogood 357af3038a Always return UDP buffers to pool (#958) 2019-04-30 07:12:45 +01:00
Tom Thorogood cfee849963 Change the single in flight key for Client.Exchange (#943)
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.
2019-04-10 11:55:21 +01:00
Miek Gieben 73601d4aed Release 1.1.8 2019-03-31 09:30:53 +01:00
Miek Gieben 0460860e89 Merge branch 'master' of github.com:miekg/dns 2019-03-31 09:30:33 +01:00
Miek Gieben 19b4ba9c16 Release 1.1.7 2019-03-31 08:50:54 +01:00
Tom Thorogood d1c1f95f67 Fix Len(rr) for dynamic update for A/AAAA/L32 RRs (#951) 2019-03-28 21:53:54 +00:00
Tom Thorogood d051b464e9 Add a message truncation implementation (#854)
* 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
2019-03-24 09:20:11 +00:00
Tom Thorogood d8ff986484 Use for range loops instead of manual for loops (#937)
* 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
2019-03-18 07:06:44 +00:00
Tom Thorogood bc7d5a495c Remove pointless cast in Conn.Read (#942)
This was accidentally added in a recent PR.
2019-03-18 07:01:10 +00:00
Tom Thorogood 1f99ca2fa4 Use new(big.Int) instead of big.NewInt(0) (#938)
* Use new(big.Int) instead of big.NewInt(0)

* Make big.NewInt(1) global for DNSKEY.PrivateKeyString
2019-03-13 07:36:34 +00:00
Christoffer Fjellström d49c86087e Add checks on data length for A and AAAA records (#919)
* 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
2019-03-12 16:31:33 +00:00
Miek Gieben cc8cd02140 Release 1.1.6 2019-03-11 11:04:46 +00:00
Tom Thorogood 834f456fff Simplify TCP reading (#935)
* 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
2019-03-11 10:59:25 +00:00
Tom Thorogood 337216f9a7 Use net.Buffers for writing TCP message (#934) 2019-03-10 13:46:14 +00:00
Tom Thorogood 1a5555c783 Split Server.serve into separate TCP and UDP methods (#933)
* Split Server.serve into separate TCP and UDP methods

* Merge reject cases in Server.serveDNS

* Inline Server.disposeBuffer method
2019-03-10 12:52:08 +00:00
Tom Thorogood 53b8a87e14 Correct Close() check in Server.serve (#932)
This was changed in ec3443f85d, but I
missed this function. Apparently no one noticed.
2019-03-10 11:59:36 +00:00
Miek Gieben eef2495fa3
Move srv.Handling selection to init() (#931)
Move this code to the server's init function to get it out of the
hotpath.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-03-10 11:14:57 +00:00
Miek Gieben 035891ab61 Release 1.1.5 2019-03-09 15:15:13 +00:00
Miek Gieben 284bad20d8
Manually revert go workers (98a1ef45) (#928)
Manually revert the worker model.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-03-09 13:34:22 +00:00
Tom F 487e4636d5 ZoneParser: error on parsing an IPv6 address in an A record (#923)
* 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 ":".
2019-03-09 09:02:18 +00:00
JINMEI Tatuya e838e1e3ce corrected default value of Server.MsgAcceptFunc as documented (#920)
the description says DefaultMsgAcceptFunc but actually defaultMsgAcceptFunc
was used.
2019-03-07 07:02:29 +00:00
Peter Banik 72df20724e Added github.com/peterzen/goresolver (#917)
goresolver is a DNSSEC validating resolver library based on miekg/dns
2019-03-04 07:36:23 +00:00
Jens Erat 092d7745b4 Ignore empty lines when parsing private keys (#911)
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.
2019-02-28 06:32:07 +00:00
Tom Thorogood 12ac8fb6e8 Add go1.12 to Travis CI (#915) 2019-02-28 06:29:30 +00:00
Tom Thorogood 39e689aa4a Fix String formatting of RP record (#914) 2019-02-28 06:28:44 +00:00
Tariq Ibrahim 164b22ef9a follow convention for deprecation notice in ExchangeConn (#908) 2019-02-07 07:30:09 +00:00
Dmitry Zubarev a288d199dc Fixed a misspelling. (#906) 2019-02-01 16:34:24 +00:00
Miek Gieben 8fc2e5773b Release 1.1.4 2019-01-30 18:12:07 +00:00
Francois Tur 896800ef1d fix OPT Record deep copy (#902)
* - 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
2019-01-30 18:11:33 +00:00
Anurag Goel 2df14c5c9f Add render to list (#904) 2019-01-29 07:32:45 +00:00
Miek Gieben 56be65265e Release 1.1.3 2019-01-12 10:18:55 +00:00
Miek Gieben 5c2ec9f7e4
RFC 1996 allows SOA in answer in notify (#900)
* 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>
2019-01-12 10:11:11 +00:00
Tom Thorogood 5beb962416
Test for escaped dots in IsFqdn (#896)
This catches situations where the final dot in a name is actually
escaped. This was causing problems when packing these domain names.
2019-01-06 14:55:21 +10:30
Tom Thorogood c5493ad28d
Use an interface method for IsDuplicate (#883)
* 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
2019-01-06 14:42:38 +10:30
Tom Thorogood db3d0ce13b
Use an interface method for parsing zone file records (#886)
* 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.
2019-01-06 14:36:16 +10:30
Miek Gieben 44a8c5f8ba Release 1.1.2 2019-01-04 19:22:34 +00:00
Tom Thorogood 29b9bf368b Remove pointless casts (#895)
* Remove pointless casts

These are all casts where the value was already of the same type.

* Use var style for zero-value not cast style
2019-01-04 10:30:55 +00:00
Tom Thorogood 513c1ff221 Simplify and unify various returns (#893) 2019-01-04 10:19:42 +00:00
Tom Thorogood 57ca5ae8f4 Use headerSize const instead of hardcoded 12 (#894) 2019-01-04 10:19:01 +00:00
Tom Thorogood 34be74deeb Flatten goroutine inside goroutine in Transfer.In (#890)
* 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.
2019-01-04 08:14:40 +00:00
Tom Thorogood 09499bd07f Use IsFqdn and Fqdn helper functions more (#892) 2019-01-04 08:13:00 +00:00
Tom Thorogood b9e1e7529b Avoid calling RR.Header more than once per RR (#891)
* 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.
2019-01-04 08:12:32 +00:00
Tom Thorogood e8b24e80da Move all reversed map creation into reverse.go (#889) 2019-01-04 08:10:15 +00:00
Tom Thorogood 5b818eed53 Use a value reciever for defaultReader (#888)
As defaultReader contains a single pointer, we can pass it by value and
avoid an allocation when it's put inside an interface{}.
2019-01-04 08:09:23 +00:00
Tom Thorogood ace4e60848 Make defaultMsgAcceptFunc a func not a var (#887) 2019-01-04 08:09:04 +00:00
Tom Thorogood b955100a79
Move RR header packing out of generated code (#885) 2019-01-04 10:09:14 +10:30