Commit Graph

3622 Commits

Author SHA1 Message Date
Miek Gieben 862c2faf96
Add codecov yaml to not fail the build (#600) 2017-12-06 10:36:23 +00:00
Miek Gieben fbee4ceea9
Lint: use ignore-this on generated files (#596)
Make golint not complain about generated file - it's a bit of cheating,
but I think that is OK.
2017-12-06 10:02:47 +00:00
Miek Gieben 9271f6595b
Add semver (#595)
Add a version.go that has the semver version of this libary; now at
1.0.0. Use a struct so external code can easily check the for the
version without resulting to string parsing. Add String() function if
you want to access the version string.

Use simple Makefile.release to kick off a new release:

% edit version.go
% make -f Makefile.release

will tag and push according to version, if version is 1.0.0 the tag
in git will be v1.0.0
2017-12-06 09:46:54 +00:00
James Hartig 325e98bb86 Use and vendor golang.org/x/net/ipv4 and golang.org/x/net/ipv6 (#594) 2017-12-04 09:59:24 +00:00
Miek Gieben 6da3249dfb
EDNS0 client subnet: drop draft option (#589)
Noone should be using this option, it has been deprecated ever since
RFC 7178 came out: May 2016. Remove code that deals with that.
2017-11-28 07:48:19 +00:00
spsholleman 052efef004 Add support for TKEY RRs (#567)
* Add support for TKEY RRs

- make sure Key and Data fields are variable length hex fields
- checkin output from 'go generate'
- add a TKEY specific test to ensure this stays working

* go format changes

* address review comments

* add ability to parse TKEY via string

* handle review comments - change TKEY string output
2017-11-28 07:48:02 +00:00
Marc Ende 5ec0c6d20f Modified clientconfig to match ndots0 (#590)
* Modified clientconfig to match ndots0

* Added Tests for reading resolv.conf

* Cleaned up and removed duplicated code in test

* Added test for ndots below 0

* Cleaned up test

* Clean up
2017-11-27 11:17:45 +00:00
Miek Gieben 57a0d1a2cf
458+dep (#591)
* Add support for Ed25519 DNSSEC signing from RFC 8080

Note: The test case from RFC 8080 has been modified
to correct the missing final brace, but is otherwise
present as-is.

* Explain why ed25519 is special cased in (*RRSIG).Sign

* Explain use of ed25519.GenerateKey in readPrivateKeyED25519

* Add dep

This is PR #458 with the dependency added into it.
2017-11-27 10:49:53 +00:00
Miek Gieben 79bfde677f
Include missing types when for DNSSEC sig verify (#587)
rawSignatureData currently missed a few types:
MD MF RP AFSDB RT SIG PX NXT A6

We don't have NXT and A6 anymore in this lib. Add the other ones.

Fixes #523
2017-11-25 08:20:28 +00:00
Miek Gieben 2ae4695cc7
Implement CSYNC (#585)
Implement the CSYNC record.

Fixes #290

Long overdue, lets add this record. Similar in vain as NSEC/NSEC3, we
need to implement len() our selves. Presentation format parsing and
tests are done as well.

This is CoreDNS running with CSYNC support, `dig` doesn't support this
at the moment, so:

~~~
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40323
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;csync.example.org.		IN	TYPE62

;; ANSWER SECTION:
csync.example.org.	10	IN	TYPE62	\# 12 000335240042000460000008

;; AUTHORITY SECTION:
example.org.		10	IN	NS	a.iana-servers.net.
example.org.		10	IN	NS	b.iana-servers.net.
~~~
2017-11-25 08:19:06 +00:00
Miek Gieben e776a21550
Remove idn/ (#584)
Superseded by x/net/idna. It was useful, but not anymore; remove
entire directory.

Fixes #518
2017-11-25 08:18:44 +00:00
JeremyRand cdb76b64a3 Spelling fixes (#583)
* Doc: fix misspelling.

Found via "misspell" static analyzer.

* Parse test: fix misspellings.

Found via "misspell" static analyzer.
2017-11-24 08:14:48 +00:00
Miek Gieben be5ae6ca7a
Add fuzzing framework (#580)
Add easy way to fuzz this dns library, put fuzz related code in fuzz.go
and have a small Makefile.fuzz to be used:

$ make -f Makefile.fuzz build
$ make -f Makefile.fuzz fuzz

Will build and fuzz the library. Both pack/unpack and NewRR are fuzz
targets, but we could open this up.
2017-11-23 09:34:31 +00:00
Miek Gieben acff9ce3fa
Fuzzing the text parser: a few fixes (#579)
I'm fuzzing the text parser and that turned up these two. Will do
further fuzzing with these fixes in.
2017-11-20 18:07:37 +00:00
Miek Gieben 7994cb36ea
Test: rework concurrentExchange (#576)
See issue #575. Try to fix (and maybe trigger it)
2017-11-17 15:31:51 +00:00
Matthijs Mekking 99c447f9f6 TSIG name must be presented in canonical form (#574)
* TSIG name must be presented in canonical form

Update the documentation to make clear that the zonename in the
TsigSecret map must be in canonical form.

* Reference RFC 4034 for canonical form
2017-11-17 13:17:47 +00:00
Miek Gieben 2a67631d76
cleanup: remove debug.Printf from scanner (#573)
Remove the debug.Printf stuff from scanner and some other style nits.
2017-11-17 10:48:42 +00:00
Miek Gieben cfe41281c2
txt parser: fix goroutine leak (#570)
* txt parser: fix goroutine leak

When a higher level (grammar or syntax) error was encountered the lower
level zlexer routine would be left open and trying to send more tokens
on the channel c. This leaks a goroutine, per failed parse...

This PR fixes this by signalling this error - by canceling a context -
retrieving any remaining items from the channel, so zlexer can return.

It also adds a goroutine leak test that can be re-used in other tests,
the TestParseBadNAPTR test uses this leak detector.

The private key parsing code had the same bug and is also fixed in this
PR.

Fixes #586
Fixes https://github.com/coredns/coredns/issues/1233

* sem not needed anymore
2017-11-17 10:47:28 +00:00
Miek Gieben 9fc4eb252e
Server: drop inflight waitgroup (#561)
* Server: drop inflight waitgroup

This drops the waitgroup in Server, the suspicion is this can make the server
fail to stop; doing this make graceful shutdown not work.

Add test that tries to find a race between starting on stopping race;
there was a data race on srv.Inflight.

The coredns' TestReadme doesn't race anymore with this as it did with
the more evasive PR #546.
2017-11-10 10:33:17 +00:00
Miek Gieben 9cfd42f1df
Tests: add ListenAndServe tests (#562)
This increases the test coverage as these methods where not tested.
Add some cosmetic changes to the mix.
2017-11-10 10:11:23 +00:00
Miek Gieben 4bb60ce4d8
Revert "server: drop graceful handling (#546)" (#560)
This reverts commit 8223ae840e.
2017-11-09 21:01:09 +00:00
Miek Gieben 8223ae840e
server: drop graceful handling (#546)
Drop all graceful handling. There is just too much locking in
waitgrouping going on for very little gain; deal with it.

Make the error handling between serve{TCP,UDP} identical.
2017-11-09 09:38:14 +00:00
Tom Limoncelli 7e7e8dcb22 util.TrimDomainName() fails when origin doesn't end in dot (#559)
* Fix https://github.com/miekg/dns/issues/555 dnsutil.TrimDomainName tests fail

* Remove comment

* Clean up comments and code.

* Clean up comments, use dns.Fqdn() where we can, lint.
2017-11-08 18:19:10 +00:00
Miek Gieben 388f6eea29
Tests updates (#556)
Use :0 for loopback testing. This is more portable between testing environments.
Add testRR that calls NewRR and throws error away - apply it everywhere where needed.

It seems only Go 1.9 can deal with :0 being used. Disable 1.8 in travis.
2017-11-08 10:01:19 +00:00
Miek Gieben 813f928d53
readme: small bunch updates (#554)
Remove specifying the versions of Go, just say the last two, this is
getting stale every single time.
2017-11-07 17:37:25 +00:00
Miek Gieben 4bcc48899c
golint fixes (#553)
* golint fixes

Comment all RR with references to relevant RFC or other docs.
Some lint fixes in edns0.go.

* Some more fixes
2017-11-07 13:45:27 +00:00
Miek Gieben f73262699a
Add goreportcard badge (#552) 2017-11-07 11:23:24 +00:00
Miek Gieben 13c92255fe
codecov: add shield to README (#551) 2017-11-07 09:35:32 +00:00
Miek Gieben ae5ce096eb
codecov: add test coverage (#550) 2017-11-07 09:17:19 +00:00
Miek Gieben b38dc3dcb7
Cleanup: gofmt -w -s *.go (#548)
Some renames of internal names to make go lint happier.
2017-11-03 16:15:35 +00:00
Miek Gieben 348c84f37e
Test: remove all Logf/Log (#547)
Move some of them to Errorf and friends, but most of them are just
gone: This make go test -v actually readable.

Remove a bunch of test that used ipv6 on localhost as this does not work
on Travis.
2017-11-03 15:50:01 +00:00
andrewtj 145266a717 Make compress generate output stable and edns.go formatting (#542)
* make compress_generate.go produce stable output

* go fmt edns.go
2017-11-03 14:41:20 +00:00
David McNett a5852667e3 Document SetTsig() needs to be final RRset change (#544)
I spent several hours trying to figure out why my TSIG signatures were
failing on requests to a server.  I finally discovered this little
detail in the RFC which turned out to be my whole problem.  Amending the
documentation to hopefully spare others the same confusion.

    If an incoming message contains a TSIG record, it MUST be the last
    record in the additional section.

RFC2845 3.2
2017-10-30 06:55:49 +00:00
Ethan J. Jackson 822ae18e71 Change quilt.io link in the README to kelda.io (#539)
The project renamed itself, so this patch updates the relevant link.
2017-10-19 07:42:25 +01:00
Neo Zhuo b02ebddc7f Add Apex in Users (#538) 2017-10-18 13:32:32 +01:00
Miek Gieben 54ceb83127 Optimize CompareDomainName (#535)
Optimize CompareDomainName:
old: BenchmarkCompareDomainName-2   	 1000000	      1869 ns/op	      64 B/op	       2 allocs/op
new: BenchmarkCompareDomainName-2   	 2000000	       854 ns/op	      64 B/op	       2 allocs/op

This removes the strings.ToLower and fixes the documentation. It also
does not Fqdn's the names anymore (the documentation said we didn't, now
the documentation is right again).
Unlike what the documentation said we are comparing in a ignore-case
manor, add helper function equal that does this without calling
strings.ToLower.
2017-10-15 16:22:03 +02:00
sarneaud ca092a4398 Allow parsing resolv.conf from io.Reader (#532)
* Allow parsing resolv.conf from io.Reader

This allows projects that use this parser to write unit tests without
writing temporary files to the filesystem.

* Avoid allocation by using strings.NewReader
2017-10-15 16:18:44 +02:00
Star Brilliant f218fef126 Fix EDNS0_SUBNET compatibility with dig (#530)
Do not complain about AddressFamily=0, if SubnetNetmask is also 0.

Fixes issue #529
2017-10-13 18:04:01 +02:00
Star Brilliant 6f3c0a126c Fix EDNS Extended RCODE (#517)
* Fix EDNS Extended RCODE

Issue #516

* Fix EDNS Extended RCODE

Issue #516
2017-10-13 17:21:46 +02:00
kahnert be519e51ff Fix IXFR may end prematurely (#512) (#507)
Fix make IXFR work with single line answers (#507)
2017-10-13 17:21:31 +02:00
Tom Thorogood 5f64fb22f9 Simplify compressed length code (#527)
* Add BenchmarkMsgLengthNoCompression

* Simplify compressedLen loops

* Fix typo in compressionLenSlice
2017-10-13 17:21:12 +02:00
insomniac 9f7460ee9c Go version bump in CI (#534) 2017-10-13 08:57:18 +02:00
James Hartig 946bd9fbed Fix DialTimeout always using udp (#526) 2017-09-30 19:54:08 +01:00
insomniac aade52d68e Redesigned Client API around net.Dialer (#511)
* Redesigned Client API around net.Dialer

* Moved Dialer under Client; reverted msgHash; removed unneeded deprecation

* Reverted client_compat.go into client.go and renamed dialer variable

* Shortened comment lines

* Erroneously removed pointer declaration
2017-09-29 10:52:01 +01:00
James Hartig 032fbabc82 Correctly set the Source IP to the received Destination IP (#524)
Previously, the oob data was just stored and sent to WriteMsgUDP but it
ignores the Src field when writing. Instead, now it is setting the Src
to the original Dst and handling IPv4 IPs over IPv6 correctly.
2017-09-29 10:38:26 +01:00
Richard Gibson eccf8bbe83 Correctly parse omitted TTLs and relative domains (#513)
* Fix $TTL handling
* Error when there is no TTL for an RR
* Fix relative name handling
* Error when a relative name is used without an origin (cf. https://tools.ietf.org/html/rfc1035#section-5.1 )

Fixes #484
2017-09-26 11:15:37 -04:00
Roland Bracewell Shoemaker 689d334b01 Implement EDNS(0) Padding option code (#520)
* Implement EDNS(0) Padding option code

* Fix EDNS0_PADDING.String
2017-09-21 13:50:49 +01:00
Miek Gieben e420576857 scan: Fix $INCLUDE arguments to parseZone (#508)
When an $INCLUDE was seen the arguments to parseZone where in the wrong
order meaning the filename was used as the `neworigin` instead of the
actual origin we need.

Extend the testcase to check for the full name of the record.
2017-08-18 14:14:42 +01:00
Matthijs Mekking 0598bd43cf Fix TSIG bug releated to ID substitution (#504)
* Fix TSIG bug releated to ID substitution

TSIG accounts for ID substitution. This means if the ID in the DNS
message is changed by for example a forwarder, TSIG calculation should
use the original message ID (from the TSIG RR).

I have a test for this as well, but it seems tsig_test.go has been
removed, so not sure where to put it now.

* Add tests for TSIG bugfix
2017-08-12 20:21:44 +01:00
Tim Esselens bbca4873b3 variable shadowing of token (#503)
* Added test for $INCLUDE statement parser in zone files

* FIX: localized l to switch statement, shadowed later call to os.Open(l.token)
2017-08-08 15:19:10 -07:00