Commit Graph

4104 Commits

Author SHA1 Message Date
Miek Gieben f515aa579d Release 1.1.29 2020-03-18 11:22:29 +01:00
Jan Včelák 524a80c35d
CanonicalName function to return domain name in canonical form (#1073)
* add Canonical function to get name in canonical form

* replace strings.ToLower with Canonical

* rename Canonical to CanonicalName

* replace Fqdn with CanonicalName in ServeMux
2020-03-18 11:21:59 +01:00
Dominik Menke 438e446f5c
Ensure TSIG state is verified in TestServerRoundtripTsig (#1085)
Automatically submitted.
2020-03-11 14:18:07 +00:00
Miek Gieben 40ecd66164 Release 1.1.28 2020-03-11 10:25:26 +01:00
Manabu Sonoda 1d3a971542
Fix NSEC3PARAM SaltLength when parsing (#1088)
* fix parse nsec3param saltLength

* division inside into cast
2020-03-11 10:24:25 +01:00
Miek Gieben f0dca1ef05
Fix all cases of error halding (#1087)
Automatically submitted.
2020-03-10 06:42:28 +00:00
Pavel Rybintsev 418631f446
correct default values fields in LOC record (#1084)
* Fixed the default values of HorizPre and VertPre

According to RFC-1876 those fields should be:

"a pair of four-bit unsigned
integers, each ranging from zero to nine, with the most
significant four bits representing the base and the second
number representing the power of ten by which to multiply
the base.  This allows sizes from 0e0 (<1cm) to 9e9
(90,000km) to be expressed"

Current values for HorizPre and VertPre (165=0xA5 and 162=0xA2)
are incorrect because the first HEX digit is greater then 9

The default values should be:

HorizPre = 10000m = 10000 * 100 cm = 10^6 = 0x16
VertPre  = 10m    = 10 * 100 cm    = 10^3 = 0x13
Size     = 1m     = 1 * 100 cm     = 10^2 = 0x12

The value of Size was correct, but this PR changes it to HEX
representation to be more readable

* Informative comments

Made comments on LOC record default field values more informative

Co-Authored-By: Richard Gibson <richard.gibson@gmail.com>

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
2020-03-02 08:48:01 +00:00
Miek Gieben 9dcf47a409
Doc updates (#1075)
* Doc updates

Was reading https://pkg.go.dev/github.com/miekg/dns?tab=doc and spotted
some types and things to could be slightly better.

Make v unexported, as this version stuff should not be part of the
public API.

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

* fix test

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-02-14 22:47:21 +01:00
Florian Lehner 7963800469
l is never used (#1071)
Signed-off-by: Lehner Florian <dev@der-flo.net>
2020-02-03 21:10:40 +01:00
Miek Gieben 6c0c4e6581 Release 1.1.27 2020-01-03 13:46:28 +01:00
Jan Včelák c9b62b4215 APL record support (#1058)
* APL record: add structure and code point

* APL record: add wire format support

* APL record: add presentation format support

* APL record: add isDuplicate implementation

* APL record: add copy implementation

* APL record: add len implementation

* APL record: run go generate

* APL record: fix condition checking for equality

* APL record: use switches to map family to address length

* APL record: check bounds of individual fields rather than whole header

* APL record: stylistic changes

* APL record: remove APLPrefix methods from public interface

* APL record: update README

* APL record: additional cleanup for code review

* APL record: change return type from pointer to struct

* APL record: refactor of pack and unpack to eliminate extra variables
2020-01-03 13:41:45 +01:00
Ask Bjørn Hansen e636c10380 Support the zero length EDNS0 EXPIRE option (#1065)
* Support the zero length EDNS0 EXPIRE option

* EDNS0 EXPIRE: Just reference the RFC, don't link to it

Co-Authored-By: Miek Gieben <miek@miek.nl>

Co-authored-by: Miek Gieben <miek@miek.nl>
2019-12-30 14:42:48 +01:00
Jan Včelák ba5b1f0bae code generation compatible with go modules (#1050)
* code generation compatible with go modules

* build: ensure go generate makes no changes
2019-12-30 12:25:57 +01:00
Miek Gieben eda228adcf Release 1.1.26 2019-12-20 14:31:18 +00:00
Miek Gieben 711e0fd90d
doc: fix xfr example. (#1062)
* doc: fix xfr example.

The currently example code has a data race, put in the proper code.

Fixes: #1061

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

* Feedback

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-12-19 13:11:22 +00:00
Miek Gieben bfd8601222
Doc fixes (#1060)
* Doc fixes

Polish the docs a bit; fix a link to miek.nl, remove edns0client subnet
draft link and point to the RFC. Some layout fixes and pull GOPATH from
the readme as we do go modules now.

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

* review comments

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-12-19 09:28:37 +00:00
Austin Oh b3cafcb268 Add missing EDNS0EXPIRE data unpack (#1054)
Automatically submitted.
2019-12-19 07:52:02 +00:00
Miek Gieben a72e5ceb18
Put added license bit at the bottom (#1056)
This license file is not being recognized by Github, nor by the new
google golang thingy recently launched. Don't remove those lines just
yet, but put them at the bottom

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-12-18 06:58:51 +00:00
Miek Gieben bd4ba36771 Add ; before printing TSIG (#1051)
Automatically submitted.
2019-12-17 15:18:05 +00:00
Miek Gieben aae7df65e6 Release 1.1.25 2019-12-11 07:31:45 +00:00
Jacob Hoffman-Andrews 8ebf2e419d Use crypto/rand for random id generation. (#1044)
* Use crypto/rand for random id generation.

Fixes #1043 and #1037

* Panic on rare crypto/rand error.

* Fixes in response to review.
2019-12-11 07:31:09 +00:00
Miek Gieben 6d0449f981
Add CODEOWNERS (#1042)
git shows:

 git shortlog -sne | head
  3311	Miek Gieben <miek@miek.nl>
   157	Tom Thorogood <me+github@tomthorogood.co.uk>
    39	Alex Sergeyev <asergeyev@dyn.com>
    37	Andrew Tunnell-Jones <andrew@tj.id.au>
    34	Filippo Valsorda <filippo@cloudflare.com>
    21	Rafael Dantas Justo <rafael@registro.br>
    19	Michael Haro <mharo@google.com>
    14	Alex Sergeyev <abc@alexsergeyev.com>
    13	chantra <chantra@users.noreply.github.com>
    11	Alex Ciuba <alexciuba@gmail.com>

I took the top 2, but happy to extend this obvs.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-12-09 11:50:19 +00:00
Miek Gieben 0788ed5f4e Release 1.1.24 2019-12-06 21:24:08 +00:00
Miek Gieben 730ff1f016
Revert "Export EDNS0 interface (#1041)" (#1046)
This reverts commit a98e771ba5.

This is breaking people
2019-12-06 21:23:18 +00:00
Miek Gieben 78ecb5db60 Release 1.1.23 2019-12-06 15:22:00 +00:00
Omer Anson a98e771ba5 Export EDNS0 interface (#1041)
Replace all the private methods in the EDNS0 with public methods.
Additionally, as suggested in issue #857, made Pack receive a
pre-allocated byte array, introduce a Len method, and have Pack
and Unpack return the number of octets written and read (respectively)
if there was no error.

Closes #857
2019-12-06 10:56:57 +00:00
Julian Picht 22cda6dc4f Speed up NextLabel and PrevLabel (#1039)
* change NextLabel and PrevLabel to be faster

This reduces readability, but they are in the hot path of coredns.

* @redyeti pointed out, that my implementation disregarded triple backslashes

* add synthetic benchmark-tests for PrevLabel and NextLabel

* rename ii -> j

* invert compare

* PrevLabel: add empty string check + test case

* NextLabel: fix and add testcase for NextLabel("", offset>0)
2019-12-04 07:25:08 +00:00
chantra 9b7437f11d [zone parser] disallow nested $GENERATE directive (#1033)
While the range number of GENERATE is now limited, one can pass
a line with 2 $GENERATE directive that will exponentially increase the
time spent generating RRs.
Limit to only one per line.
Fixes #1020
2019-10-23 10:41:32 +01:00
Miek Gieben 4d4363a5dc
build: reduce testing output (#1031)
Use a better name in the fuzzing test to not spam the travis output,
move to Go 1.13.x in travis.yaml

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-10-20 07:12:43 +01:00
Andrew Tunnell-Jones 4334efe802 Update EDNS0_UL to draft-sekar-dns-ul-02 (#1028) 2019-10-14 09:29:56 +01:00
chantra 40eab7a196 [fuzzer] Avoid fuzzing parser with line that contains "$INCLUDE" (#1026)
Fixes #1025

```
GO111MODULE=off make -f Makefile.fuzz build
go-fuzz -bin=dns-fuzz.zip -workdir=fuzz -func Fuzz
GO111MODULE=off make -f Makefile.fuzz build-rr
go-fuzz -bin=dns-fuzz.zip -workdir=fuzz -func FuzzNewRR
```
2019-10-10 07:12:53 +01:00
Miek Gieben 997f079b75
Run gofmt (#1024)
Periodic go-fmt-ing.

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-10-07 10:33:11 +01:00
Florian Lehner 58a17b97a1 simplify loop (#1023)
Signed-off-by: Lehner Florian <dev@der-flo.net>
2019-10-05 14:24:46 +01:00
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