Commit Graph

4071 Commits

Author SHA1 Message Date
Miek Gieben 1e224ff5de Release 1.1.22 2019-10-04 10:33:17 +01:00
Miek Gieben 1cd342c79a
Revert "labels: eliminate most allocations and improve perf by 15-65% (#1007)" (#1022)
This reverts commit ab6ac402ba.

This break CoreDNS tests and probably a lot of other apps as well.
Reverted
2019-10-04 10:26:59 +01:00
Miek Gieben 041b4bc010 Release 1.1.21 2019-10-04 07:36:49 +01:00
Miek Gieben 76b57d0384
Limit $GENERATE range to 65535 steps (#1020)
* Limit $GENERATE range to 65535 steps

Having these checks means all test in TestCrasherString() are not
reached because we bail out earlier - removed that test all together.

Fixes #1019

Signed-off-by: Miek Gieben <miek@miek.nl>

* bring back testcase

Signed-off-by: Miek Gieben <miek@miek.nl>

* bring back crash test

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-10-03 20:01:28 +01:00
chantra 557870346a [scan] fix crashers when parsing comment (#1018)
* [scan] fix crashers when parsing comment

When dealing with comments the parsers was potentially incrementing comi
variable twice. During the second access to com[], comi was possibly
longer than maxTok, causing an out of bound error:
panic: runtime error: index out of range [2048] with length 2048

* * Keep only 1 crasher test string.
* move tests from scan_test.go to fuzz_test.go
2019-10-03 19:09:39 +01:00
Miek Gieben 046ae4ead6 Release 1.1.20 2019-10-03 10:08:22 +01:00
chantra 8ebfd8abbb [fuzz] Fix crashes when parsing GENERATE (#1016)
* [fuzz] Fix crashes when parsing GENERATE

Running the fuzzer on NewRR, some crashes came up that could be
prevented by checking that the token after the range is a Blank.
This diff checks that and return an error when the blank is not found.

* * s/Expect blank /garbage /
* get rid of if/else
2019-10-03 07:37:56 +01:00
Miek Gieben 93f749db12
Revert "pool the transient maps used for Msg Pack, Truncate and Len (#1006)" (#1017)
This reverts #1006, see discussion on the PR. Def. worth exploring this
furhter and pushing a more correct approach.

This reverts commit 9578caeab0.
2019-10-03 07:36:27 +01:00
Miek Gieben 1208fbdde0 Release 1.1.19 2019-09-27 18:04:44 +01:00
Miek Gieben bb79ca102d
Update deps (#1013)
Signed-off-by: Miek Gieben <miek@miek.nl>
2019-09-25 15:51:31 +01:00
Miek Gieben 513f7ec990 Release 1.1.18 2019-09-25 07:26:45 +01:00
Richard Gibson 9a6f1f2dc9 Simplify unpackString (#1012) 2019-09-25 06:53:47 +01:00
Charlie Vieth e393768b85 types: improve the performance of sprintName by ~30% and halve allocs (#1008)
```
benchmark                                          old ns/op     new ns/op     delta
BenchmarkSprintName-12                             174           117           -32.76%

benchmark                                          old allocs     new allocs     delta
BenchmarkSprintName-12                             2              1              -50.00%

benchmark                                          old bytes     new bytes     delta
BenchmarkSprintName-12                             48            32            -33.33%
```
2019-09-23 07:17:00 +01:00
Charlie Vieth 9578caeab0 pool the transient maps used for Msg Pack, Truncate and Len (#1006)
This improves runtime by 20-40% and more importantly significantly
reduces memory usage and allocations.
2019-09-23 07:16:26 +01:00
Tom Thorogood b733ad8671 Improve unpackString performance (#1011)
I'm not convinced this is really worth doing, but it does show a
performance improvement.

name                       old time/op    new time/op    delta
UnpackString/Escaped-12      83.7ns ± 7%    78.2ns ± 3%   -6.50%  (p=0.000 n=10+9)
UnpackString/Unescaped-12    57.8ns ± 9%    50.4ns ±13%  -12.74%  (p=0.000 n=10+10)

name                       old alloc/op   new alloc/op   delta
UnpackString/Escaped-12       48.0B ± 0%     32.0B ± 0%  -33.33%  (p=0.000 n=10+10)
UnpackString/Unescaped-12     32.0B ± 0%     32.0B ± 0%     ~     (all equal)

name                       old allocs/op  new allocs/op  delta
UnpackString/Escaped-12        2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)
UnpackString/Unescaped-12      1.00 ± 0%      1.00 ± 0%     ~     (all equal)
2019-09-22 08:59:05 +01:00
Tom Thorogood ba5bfd0295 Use strings.ToLower in ServeMux.match (#1010)
This has been a long standing TODO. golang.org/cl/137575 was included in
go1.12 which is the oldest officially supported release.
2019-09-21 08:50:53 +01:00
Charlie Vieth ab6ac402ba labels: eliminate most allocations and improve perf by 15-65% (#1007)
* labels: eliminate most allocations and improve perf by 15-65%

This commit changes the labels functions to step through labels
section-by-section instead of splitting them and thus allocating
a slice.

Where possible allocations are reduced to 0.

```
benchmark                         old ns/op     new ns/op     delta
BenchmarkSplitLabels-12           41.4          34.9          -15.70%
BenchmarkLenLabels-12             25.8          15.5          -39.92%
BenchmarkCompareDomainName-12     107           39.3          -63.27%
BenchmarkIsSubDomain-12           348           120           -65.52%

benchmark                         old allocs     new allocs     delta
BenchmarkSplitLabels-12           1              1              +0.00%
BenchmarkLenLabels-12             0              0              +0.00%
BenchmarkCompareDomainName-12     2              0              -100.00%
BenchmarkIsSubDomain-12           6              0              -100.00%

benchmark                         old bytes     new bytes     delta
BenchmarkSplitLabels-12           32            32            +0.00%
BenchmarkLenLabels-12             0             0             +0.00%
BenchmarkCompareDomainName-12     64            0             -100.00%
BenchmarkIsSubDomain-12           192           0             -100.00%
```

* labels: fix CompareDomainName and improve tests
2019-09-21 08:46:30 +01:00
Miek Gieben 2acbc9eff3 Release 1.1.17 2019-09-10 07:44:47 +01:00
Miek Gieben dcb849b337
update deps (#1005)
Update the deps to the latest versions.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-09-09 14:34:25 +01:00
Miek Gieben c674456565 Release 1.1.16 2019-08-17 16:39:23 +01:00
Tiago Ilieve 5825da9f4d Migrate to Go modules (#980)
* Remove 'vendor/' directory

* Remove Go dep, add Go modules

* Travis: remove Go 1.10/GOPATH, add Go modules
2019-08-17 15:38:20 +00:00
Miek Gieben b13675009d Release 1.1.15 2019-06-28 16:40:26 +01:00
Tom Thorogood 7f2bf8764a Set the TC bit more aggressively in Truncate (#989)
* Set the TC bit more aggressively in Truncate

* Update Truncate documentation for TC bit changes
2019-06-24 16:59:43 +01:00
chantra d89f1e3d4b Reply with NOTIMPL when Opcode is not supported (#982)
One of the test from DNS Compliance testing validates that if the opcode
is not supported, a NOTIMPL rcode is returned.

e0884144dd/genreport.c (L293)

This diff makes the default acceptfunc support this case and reply with
NOTIMPL instead of FORMERR.
2019-06-17 16:13:02 +01:00
chantra ee62c8b086 go fmt (#986) 2019-06-13 07:24:10 +01:00
Miek Gieben 9cfcfb2209 Release 1.1.14 2019-06-10 07:39:39 +01:00
Tom Thorogood 25cacca8ca Prohibit newlines before record data in the ZoneParser (#979)
* Merge setRR into ZoneParser.Next

* Remove file argument from RR.parse

This was only used to fill in the ParseError file field. Instead we now
fill in that field in ZoneParser.Next.

* Move dynamic update check out of RR.parse

This consolidates all the dynamic update checks into one place.

* Check for unexpected newline before parsing RR data

* Move rr.parse call into if-statement

* Allow dynamic updates for TKEY and RFC3597 records

* Document that ParseError file field is unset from parse

* Inline allowDynamicUpdate into ZoneParser.Next

* Improve and simplify TestUnexpectedNewline
2019-06-10 07:38:54 +01:00
Frank Olbricht cbc52d2408 Add github.com/folbricht/routedns to users list (#984) 2019-06-10 07:35:38 +01:00
Miek Gieben 8a56deec68
Update deps (#981)
* update deps

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-06-06 07:36:43 +01:00
Miek Gieben d16ecb693e Release 1.1.13 2019-05-27 15:48:50 +01:00
Yaroslav Kolomiiets 1545072057 ignore Z flag in queries, clear Z flag in automatic replies (#976) 2019-05-23 20:54:24 +01:00
Pepijnvi fbd426fefa Handle all net.Conn connections correctly (#957)
* Change switch to if condition

* Update switch to if in read function
2019-05-22 14:38:57 +01:00
Miek Gieben a2c73fb86d Release 1.1.12 2019-05-21 09:42:26 +01:00
chantra ccd41ffaf8 [nsec3] fix crash in nsec3 packing (#973)
Both NSEC and NSEC3 use the same logic to pack the bitmap.
CSYNC.pack also appear to make use of `packDataNsec` so I am giving it
the same treatment by moving the logic in a helper function and making
all those types `len` call use that function.
2019-05-21 07:27:24 +01:00
Miek Gieben 77cba59d63 Release 1.1.11 2019-05-20 20:49:47 +01:00
Miek Gieben 9c315c51c3
Remove DSA* algorithms (#972)
This follows BIND9 and removed support for the DSA family of algorithms.
Any DNSSEC implementation should consider those zones using it,
insecure.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-05-20 20:49:02 +01:00
Miek Gieben 087e486609
Run gofmt -w -s (#971)
mechanical run of gofmt.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-05-20 07:44:53 +01:00
Miek Gieben 0930b62a13
DNSSEC: remove deprecated algorithms (RFC 6944) (#970)
This removes RSAMD5 as an algorithm you can use. BIND also has
deprecated *all* DSA algos which is more involved can removes more
helper codes as well, so that should be done in a new PR.

See #968

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-05-20 07:44:43 +01:00
Miek Gieben d49318b5a0 Release 1.1.10 2019-05-19 08:40:58 +01:00
chantra 37f455fa04 [nsec] compute NSEC.len() the same way that we would do in packDataNsec (#967)
The byte sequence, when Unpack()-ed and subsequential Pack()-ed created a
panic: runtime error: slice bounds out of range
github.com/miekg/dns.(*Msg).packBufferWithCompressionMap(0xc0000d4000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x100, 0x14, 0x14e80b, 0xbf2d4654d501a3c8, ...)
/Users/chantra/go/src/github.com/miekg/dns/msg.go:868 +0x13a8

Confirmed that Unpacking/Repacking payload described in TestCrashNSEC
did not raise a slice bound out of range panic, added unittests which
failed prior to this change.

```
go test -run TestCrashNSEC
--- FAIL: TestCrashNSEC (0.00s)
    types_test.go:135: expected length of 19, got 12
FAIL
exit status 1
FAIL	github.com/miekg/dns	0.067s
```
2019-05-19 08:40:22 +01:00
chantra 2f1ea90356 packDataOpt: fix overflow in packing opt (#966)
An option needs a minimum of 4 bytes that contains OPTION-CODE and OPTION-LENGTH
The code was checkign off + 3 > len(msg) instead of off + 4
2019-05-18 18:23:50 +01:00
Nick McKinney 77c7d907b4 Set TSIG on Transfer Out (#939)
* Call SetTsig() Msg `r` if q.IsTsig() != nil to enable TSIG on AXFR.

* Add tests for xfr.go

* Fix data race condition setting server.TsigSecret

* Test cleanup: xfr_test.go

* Xfr Test cleanup: use exported `IsDuplicate()`, len(xfrTestData)
2019-05-12 09:15:21 +01:00
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