Commit Graph

3987 Commits

Author SHA1 Message Date
DesWurstes 0972db6834
Implement SVCB (#1067)
* Implement SVCB

* Fix serialization and deserialization of double quotes

* More effort (?)

4 months old commit

* DEBUG

* _

* Presentation format serialization/deserialization

* _

Remove generated

* Progress on presentation format parse & write

* _

* Finish parsing presentation format

* Regenerate

* Pack unpack

* Move to svcb.go

Scan_rr.go and types.go should be untouched now

* 🐛

Thanks ghedo

* Definitions

* TypeHTTPSSVC

* Generated

and isDuplicate

* Goodbye lenient functions

Now private key=value pairs have to be defined as structs too. They are no longer automatically named as KeyNNNNN

* Encode/decode

* Experimental svc

* Read method

* Implement some of the methods, use trick...

to  report where the error is while reading it. This should be applied to EDNS too. Todo: Find if case can only contain e := new(SVC_ALPN) and rest moved out

Also fix two compile errors

* Add SVC_LOCAL methods, reorder, remove alpn value, bugs

* Errors

* Alpn, make it build

* Correct testsuite

* Fully implement parser

Change from keeping a state variable to reading in one iteration until the key=value pair is fully consumed

* Simplify and document

EDNS should be simplified too

* Attempt to fix fuzzer

And Alpn bug

* A bug and change type values to match @ghedo's implementation

* IP bug

Also there are two ip duplicating patterns, one with copy, one with append. Maybe change it to be consistent.

* Check for strictly increasing keys as required

* Don't panic on invalid alpn

* Redundant check, don't modify original array

* Size calculation

* Fix the fuzzer, match the style

* 65535 is reserved too, don't delay errors

* Check keyNNN, check for aliasform having values

* IPvNHint is an array

* Fix ipvNHint

* Rename everything

* Unrecognized keys according to the updated specification

* Skip zero-length structs in generators. Fix CI

* Doc cleanup

* Off by one

* Add parse tests

* Check if private key doesn't collide with known key, invalid tests

* Disallow IPv4 as IPv6. More tests.

Related #1107

* Style fixes

* More consistency, more tests

* 🐛 Deep copy as in the documentation

	a := make([]net.IP, 1)
	a[0] = net.ParseIP("1.1.1.1").To4()
	b := append(make([]net.IP, 0, 1), a...)
	b[0] = net.ParseIP("3.1.1.1").To4()
	fmt.Println(a[0][0])

* Make tests readable

* Move valid parse tests to different file

* 🐛 One of previous commits not fully committed

* Test binary single value encoding/decoding and full encode/decode

* Add worst-case grows to builders, 🐛 Wrong visible character range, redundant tests

* Testing improvements

And don't convert to IPv4 twice

* Doc update only

* Document worst case allocations

and ipv6 can be at most of length 39, not 40

* Redundant IP copy, consistent IPv6 behavior, fix deep copy

* isDuplicate for SVCB

* Optimizations

* echoconfig

* Svc => SVCB

* Fix CI

* Regenerate after REBASE (2)

Rebased twice on 15th and 20th May

* Rename svc, use escapeByte.

* Fix parsing whitespaces between quotes, rename ECHOHOConfig

* resolve

Remove svcbFieldLen
Use reverseInt
Uppercase SVCB
Rename key_value
"invalid" => bad
Alpn comments
> 65535 check
Unneeded slices

* a little more

read => parse
IP array meaning
Force pushed because forgot to change read in svcb_test.go

* HTTPSSVC -> HTTPS

* Use new values

* mandatory code

https://github.com/MikeBishop/dns-alt-svc/pull/205

* Resolve comments

Rename svcb-pairs
Remove SVCB_PRIVATE ranges
Comment on SVCB_KEY65535
ParseError return l.token
rename svcbKeyToString and svcbStringToKey
privatize SVCBKeyToString, SVCBStringToKey

* Refactor 1

Rename sorted, originalPairs
Use append instead of copy
Use svcb_RESERVED instead of 65535, with it now being private
"type SVCBKey uint16"

* Refactor 2

svcbKeyToString as method
svcbStringToKey updated after key 0
🐛 mandatory has missing key
Rename str
idx < 0

* Refactor 3

Use l.token as z
var key, value string
Comment wrap
0:
Sentences with '.'
keyValue => kv

* Refactor 4

* Refactor 5

len() int

* Refactor 6

* Refactor 7

* Test remove parsing

* Error messages

* Rewrite two estimate comments

* parse shouldn't modify original array 🐛

* Remove two unneeded comments

* Address review comments

Push 2 because can't build fuzzer python
Push 3 to try again

* Simplify argument duplication as per tmthrgd's suggestion

And add the relevant test
Force push edit: Make sorting code fit into one line

* Rewrite ECHConfig and address the review

* Remove the optional tab

* Add To4() Check

* More cleanup and fix mandatory not sorting bug
2020-10-11 09:09:36 +02:00
Frank Olbricht cec9156531
Set UDPSize in connections created with client.Dial() (#1165) 2020-10-11 09:06:33 +02:00
Miek Gieben 68df4402de
readme: remove too generic users (#1164)
These domain either nxdomain/404 or just generic sites selling some
service.

Remove them from the readme.

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-10-05 09:13:52 +02:00
reuben honigwachs 7a5f1127f7
Update README.md (#1160)
Not sure whether router7 makes the cut for your impressive list, but it's worth a "go" I guess. Thanks.
2020-09-16 07:57:26 +02:00
Jacob Hoffman-Andrews efdec21496
Remove comment saying ExchangeContext is deprecated. (#1154) 2020-08-26 07:58:07 +02:00
Brian Shea 034f791cf8
answer queries with no matching handler with RcodeRefused (#1151)
* answer queries with no matching handler with RcodeRefused

* update documentation

* mark HandleFailed deprecated

* add handleRefused and use it to answer requests matching no handler

* silence noise maker

Co-authored-by: Brian <brian@pop-os.localdomain>
2020-08-20 08:41:45 +02:00
JINMEI Tatuya 9df839b2b4
make sure removing trailing zero octets in APL AFDPART (#1150)
* make sure removing trailing zero octets in APL AFDPART

* update code comment with a reference to RFC3123.
2020-08-17 19:51:22 +01:00
JINMEI Tatuya da812eed45
fix and enhance stringToCm to parse LOC RR optional fields (#1148)
Automatically submitted.
2020-08-17 07:08:03 +00:00
JINMEI Tatuya 81df27db17
validate LOC's lat/long field values not to be out of range (#1149)
Automatically submitted.
2020-08-17 07:07:46 +00:00
Disconnect3d 86044e4e05
Fixes a TODO to "error out on > MAX_UINT32" (#1147)
Automatically submitted.
2020-08-17 05:59:54 +00:00
Miek Gieben 34cecfe1b4 Release 1.1.31 2020-08-01 06:57:59 +02:00
JINMEI Tatuya de1def76d8
Add support for HMAC-SHA224 and HMAC-SHA384 TSIG algorithms (#1139) 2020-07-22 13:59:04 +09:30
JINMEI Tatuya f3da20bc00
fix TsigGenerate for non-0 TSIG error or non-empty other data (#1138)
Automatically submitted.
2020-07-21 15:55:03 +00:00
JINMEI Tatuya a7a0eafd7a
catch error from tsigBuffer, mainly to detect other data overflow (#1136)
* catch error from tsigBuffer, mainly to detect other data overflow

* hardcoded a constant string instead of a const var
2020-07-21 08:04:57 +02:00
JINMEI Tatuya 9093928550
make TsigVerify check time after signature per rfc2845bis (#1135)
Automatically submitted.
2020-07-18 06:06:18 +00:00
Eric Case 50b4756e47
Add domainr.com & zonedb.org to the Users list (#1134)
Thanks for making this great library, Miek!
2020-07-08 21:09:04 +02:00
Miek Gieben 54ab126a04
Create codeql-analysis.yml
Add codescanning - we're in the beta.

This is to try it out, this commit adds the default github comes up with
2020-07-08 09:23:39 +02:00
Miek Gieben f17e6c7171 Release 1.1.30 2020-07-06 22:17:46 +02:00
Richard Gibson 978b9a827a
Be consistent about domain name label character escaping (#1122)
* Improve sprintName tests

* Fix sprintName handling of escaped dots

* Make sprintName consistently drop dangling incomplete escapes

* Be consistent about domain name label character escaping

Fixes #1121

* Replace strings.IndexByte with faster special-purpose function
2020-07-06 10:07:56 +02:00
Michael Hudson-Doyle 064ba4b789
fix failing tests on 32 bit platforms (#1130)
* fix check for bad offset on 32 bit systems

* parse integers into int64 rather than platform dependent ints

Co-authored-by: Michael Hudson-Doyle <Michael Hudson-Doyle michael.hudson@ubuntu.com>
2020-07-02 09:54:07 +02:00
Richard Gibson 203ad2480b
Add test for forward compression pointer (#1123)
Automatically submitted.
2020-05-27 08:05:25 +00:00
DesWurstes 0ffcea3295
Generate copy() for derived types (#1118)
Automatically submitted.
2020-05-18 12:54:09 +00:00
Miek Gieben b7da9d95e0
Remove string(n) (#1117)
Automatically submitted.
2020-05-14 10:50:37 +00:00
Alex Fattouche b28dcc1849
Fix URI and CAA parsing on quotes and backslashes. (#1101) (#1104)
Automatically submitted.
2020-05-13 19:24:22 +00:00
DesWurstes 8f63c2d20c
Generate isDuplicate for derivatives (#1114) 2020-05-11 09:16:21 +02:00
DesWurstes b7703d0fa0
Cleanup EDNS (#1112) 2020-05-06 15:41:54 +02:00
yaakov kuperman 1fc9fa1db0
Adds function ExchangeWithConn (#1110)
* Implements ExchangeWithConn, a function that allows callers to pass in a connection instead of having the library create a new one for them.  Exchange now wraps around this, implementing the existing behavior by creating a new connection and passing it to ExchangeWithConn.  c.exchange has been updated to support this behavior as well.

* adding tab

* formatting problem

* adds test case for ExchangeWithConn
2020-05-04 10:22:21 +02:00
taciomcosta d128d10d17
refactor: remove ParseZone and parseZone (#1099) 2020-04-28 09:24:18 +02:00
Catena cyber 5bfe94bb6e
Efficient string concatenation (#1105)
Found by oss-fuzz
2020-04-28 09:21:06 +02:00
Manabu Sonoda 67373879ce
fix APL address length check. (#1095)
* fix APL address length check.

* add afdlen check, update check APL address bits

* revert error message

* revert error message
2020-04-10 21:20:01 +02:00
Catena cyber 2c9b7cfbaa
Continuous integration with GitHub workflow (#1091)
* Adds github workflow

* Add CIFuzz github workflow

* remove Gopkg.toml stuff
2020-04-09 08:50:30 +02:00
Adam Chalkley fd9c7eb788
RFCs allow multiple questions, but not in practice (#1097)
Paraphrase @miekg's response to emphasize that multiple
questions in the question section of a DNS message
is not supported in practice.

refs miekg/dns#1092

Co-authored-by: Adam Chalkley <atc0005@users.noreply.github.com>
2020-03-29 19:46:09 +02:00
Sijie Yang 923fc6bc72
Update README.md (#1096) 2020-03-26 17:24:37 +01:00
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