Commit Graph

3711 Commits

Author SHA1 Message Date
Roland Bracewell Shoemaker 574f29b9d6 Always set tokenUpper when setting token (#403) 2016-10-03 15:10:26 +01:00
Kevin Burke b4e7237e90 Fix typos (#405) 2016-10-03 15:10:00 +01:00
Miek Gieben db96a2b759 Handle empty salt value (#392)
When removing the reflection we inadvertely also removed the code for
handling empty salt values in NSEC3 and NSEC3PARAM. These are somewhat
annoying because the text representation is '-', which is not valid hex.
2016-07-25 20:20:27 -07:00
Miek Gieben 5d001d0209 zmsg: return empty rr with header (#380)
When there is no rdata, return the newly created RR with the header
embedded in it. If we only return the header, we changed the
API for Go DNS.
2016-06-14 17:21:01 +01:00
Miek Gieben e6b37d00af Cleanup and removals (#377)
* Cleanup and removals

Gut rawmsg.go as most functions are not used. Reword some documentation.
Add more types to be checked for name compression.

* Yeah, we do use these

* Remove this function as well - only used one
2016-06-13 19:44:38 +01:00
Miek Gieben b51e305bc6 Remove reflection (#376)
Everything is generated. Remove all uses of packStruct/unpackStruct and
make the library reflectionless.
2016-06-12 21:06:46 +01:00
Miek Gieben dbffa4b057 Kill all reflection when packing/unpacking RR (#372)
Update the size-xxx-member tags to point to another field in the struct
that should be used for the length in that field. Fix NSEC3/HIP and TSIG
to use to this and generate the correct pack/unpack functions for them.

Remove IPSECKEY from the lib and handle it as an unknown record - it is
such a horrible RR, needed kludges before - now just handle it as an
unknown RR.

All types now use generated pack and unpack functions. The blacklist is
removed.
2016-06-12 18:31:50 +01:00
Miek Gieben 6ae3b9f061 Skip reflection for most types (#369)
Make the reflection types a black list (these types use (or should use)
the tag 'size-xxx' in their struct definition.s

HIP, IPSECKEY, NSEC3, TSIG

All other types don't use reflection anymore.

* Return a pointer to the header when there is no rdata, this restores old
  behavior. The rest of the conversion mostly hangs on getting size-hex
  right, but then packStruct and packStructValue and the unpack variant
  can be killed.
* Generate pack and unpack for all embedded types as well.
* Fix PrivateRRs, register an unpack function as well, when you register
  a new PrivateRR.
* Add the tag octet, nsec, []domains and more  to msg_helper.go
2016-06-12 16:09:37 +01:00
Miek Gieben 331ecbbc51 Add RcodeBadCookie (23) 2016-06-12 13:10:24 +01:00
Miek Gieben e048e89b44 Extra doc for DNS Cookies 2016-06-11 09:37:01 +01:00
Miek Gieben ee126a9f10 RFC 7858 and 7873 are published 2016-06-11 09:21:11 +01:00
Michael Haro 1be7320498 Use t.Errorf in tests and make the error variable naming more consistent. (#367)
* Make the error variable always named err.

Sometimes the error variable was named 'err' sometimes 'e'.  Sometimes
'e' refered to an EDNS or string and not an error type.

* Use t.Errorf instead of t.Logf & t.Fail.
2016-06-09 07:00:08 +01:00
Michael Haro 48c8acaf0c Simplify packing and unpacking (#363)
* Simplify packing and unpacking

* Make a copy of the buffer to allow buffer reuse.

* Revert use of fmt.Sprintf

I don't have time to benchmark this right now and I suspect a different
cleanup will be of higher value.
2016-06-08 17:10:03 +01:00
Michael Haro a465e84f54 Use encoding/binary's conversion functions when possible. (#364)
* Remove {un,}packUint{16,32}Msg functions.

unpackUint16Msg unpackUint32Msg packUint16Msg packUint32Msg implemented
functionality that is part of the encoding/binary package.

* Use encoding/binary's encoding in more places.
2016-06-08 16:38:42 +01:00
Miek Gieben 799de7044d Remove WKS support
Support for WKS was incomplete, i.e. len() method was incorrect.
Remove support for the record and handle it as an unknown one.

Fixes #361
2016-06-05 08:23:44 +01:00
Miek Gieben 907a4aef57 Generate pack/unpack for all RRs (#360)
Add dns:txt parsing helper to prevent compile errors. This allows
us to generate all unpack/pack function.

Add pack to the RR interface definition and add this method to
PrivateRR.

We still use typeToUnpack to select which types don't use reflection.
2016-06-05 07:53:12 +01:00
Roland Bracewell Shoemaker 3f53d75269 Seed math/rand with crypto/rand (#359)
* Use crypto/rand to seed math/rand instead of using the default seed

* Better seeding+generation and fallback on crypto/rand.Read failure

* Remove user warning
2016-06-05 07:51:30 +01:00
Joe Farrell bd738b30b1 Fixed typo in docstring (#358) 2016-06-04 08:11:36 +01:00
Miek Gieben cbeae15006 Merge branch 'generate_pack' 2016-06-03 12:48:12 +01:00
Miek Gieben 475ab80867 Remove (most) reflection
Remove the use of reflection when packing and unpacking, instead
generate all the pack and unpack functions using msg_generate.
This will generate zmsg.go which in turn calls the helper functions from
msg_helper.go.

This increases the speed by about ~30% while cutting back on memory
usage. Not all RRs are using it, but that will be rectified in upcoming
PR.

Most of the speed increase is in the header/question section parsing.
These functions *are* not generated, but straight forward enough. The
implementation can be found in msg.go.

The new code has been fuzzed by go-fuzz, which turned up some issues.

All files that started with 'z', and not autogenerated were renamed,
i.e. zscan.go is now scan.go.

Reflection is still used, in subsequent PRs it will be removed entirely.
2016-06-03 12:45:22 +01:00
Erik Dubbelboer 48ab6605c6 go fmt (#355) 2016-05-12 07:43:16 +01:00
phamhongviet b5deb9f6c0 Add serf-dns to the user list (#353) 2016-05-07 14:17:04 +01:00
Miek Gieben f53eb22bfb Check length before packing OPT (#352)
fixes #351
2016-05-05 16:56:17 +01:00
Miek Gieben 4355939008 massage edns cookie comment 2016-05-03 15:22:17 +00:00
Shumon Huque b534177a1a small patch for EDNS0 cookie support (#350)
* Add EDNS0 Cookie (option 10) support.

* Add EDNS0 Cookie processing.

* Fix nits.

* Add EDNS0 cookie support mention.
2016-05-03 16:19:28 +01:00
looter de1d5dd281 Added grimd project (#349) 2016-05-03 09:16:38 +01:00
Will Bond c9d1302d54 Add Client.Timeout to allow limiting total exchange duration (#345) 2016-04-19 11:29:51 +01:00
McStork a5cc44dc6b set ExtendedRcode return type to int instead of uint8 (#347) 2016-04-18 17:40:15 +01:00
Miek Gieben 89d9c5e74b Merge pull request #346 from jsha/patch-1
Update README.md
2016-04-14 17:49:32 +01:00
Jacob Hoffman-Andrews 8d74112f68 Update README.md 2016-04-14 09:22:05 -07:00
Jacob Hoffman-Andrews 031fad65fe Use package name more reliably. (#343)
The previous logic would act incorrectly when this package was vendored into
other packages.
2016-04-14 08:48:01 +01:00
Miek Gieben dd83d5cbcf IsSubDomain docs
Improve the docs a little and add a test for when the child and parent
are equal.
2016-04-12 22:05:53 +01:00
Miek Gieben b5f8285e2a Merge pull request #340 from miekg/edns2-fix
Put the correct extended rcode in OPT
2016-04-09 16:17:25 +01:00
Miek Gieben 84206d880d Put the correct extended rcode in OPT
We were off by a value of 15. This fixes it. Hard to come up with a test
as writing and reading it yourself will be consistent.
Don't allows extended rcodes smaller than 16. And fix the tests as well.
2016-04-09 16:07:18 +01:00
Miek Gieben c70f867d87 Merge pull request #338 from miekg/edns-fix
Optimize IsEdns0
2016-04-09 15:53:29 +01:00
Miek Gieben 51f75cadab Optimize IsEdns0
Start at the end of the additional section instead of the beginning.
Optionally we only scan the last 2 records, and get rid of the loop
in its entirety.
2016-04-08 08:22:36 +00:00
Miek Gieben 7e024ce8ce Merge branch 'master' of github.com:miekg/dns 2016-03-28 15:46:43 +01:00
Miek Gieben b4a9a147b2 Small fix in docs for transfer Out 2016-03-28 15:45:23 +01:00
Miek Gieben c2b278e70f Merge pull request #335 from mischief/plan9
fix building on plan9
2016-03-25 16:41:19 +00:00
Nick Owens cbc47172cd fix building on plan9 2016-03-21 12:27:12 -07:00
Miek Gieben f8964231a8 Merge pull request #333 from matje/issue-316-rdlen-2
Len returns the rr len of the uncompressed format.
2016-03-17 14:31:27 +00:00
Matthijs Mekking 5107215070 Len returns the rr len of the uncompressed format. 2016-03-17 15:07:51 +01:00
Miek Gieben b9171237b0 Merge pull request #329 from miekg/tsig-lowercase
TSIG: lowercase algorithm before use
2016-03-08 07:08:06 +00:00
Miek Gieben b6897b5a7c TSIG: lowercase algorithm before use
These strings are domain names, so we should lowercase them before
using them.

Also add some tests for Tsig generation and verification.

(/ht ldns release).
2016-03-07 22:17:28 +00:00
Miek Gieben 4adf880b02 Merge pull request #327 from miekg/better-docs-for-larger-responses
Better docs on client buffer size
2016-03-02 10:42:01 +00:00
Miek Gieben 4a3ac71278 Better docs on client buffer size
Extend the documentation for Exchange to make it clear that it is
the callers responsibility to enable larger buffers.
2016-03-02 09:40:40 +00:00
Miek Gieben cce6c130cd Merge pull request #325 from miekg/issue-324
Issue 324
2016-02-28 19:27:08 +00:00
Miek Gieben aabc5a63e1 better comment 2016-02-28 16:40:28 +00:00
Miek Gieben 0985f1e8ff Fix TCP rtt
TCP wasn't returning rrt info anymore, fix this. Also add
an issue_test.go where fixes for specific issues can be put.

Pull the rtt for udp message up into the function where we now
also set the rrt for tcp (for symmetry).
2016-02-28 16:36:19 +00:00
Miek Gieben 2403d251d5 Add specific test file for fixing issues 2016-02-28 16:15:32 +00:00