* 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>
* 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>
* 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
* 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>
* 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>
* 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>
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>
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>
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
* 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)
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
* 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>
* [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
* [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