Commit Graph

145 Commits

Author SHA1 Message Date
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
Tom Thorogood
b6ecf29d98 Improve performance by addressing some low hanging fruit. (#444)
* Remove unused bytes.Buffer from dns/idn.encode.

This buffer is truncated and written to but never read from. It
serves no purpose and all tests pass with it removed.

It appears to have been introduced when puncycode.go was first
added in miekg/dns@e3c2c07.

* Produce less pointless garbage.

This change:
- removes several needless []byte -> string conversions,
- removes two needless append calls in HashName, and
- writes the hash to the same nsec3 []byte in HashName rather
  than creating a new []byte on each of the k iterations.

These are all minor performance improvements that will likely
go entirely unnoticed. The changes will reduce the ammount of
garbage produced when calling CertificateToDANE, HashName,
(*SIG).Sign and TsigGenerate.
2017-02-02 07:33:49 +00: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
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
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
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
Filippo Valsorda
25846488f9 Apply per-type code generation to .copy()
This fixes bugs in MB and CNAME.copy() (using sprintName for copying),
IPSECKEY (missed copyIP) and OPT (partially, Options was not copied as
slice; EDNS0 objects themselves are still pointers).
2015-10-07 05:51:36 +01:00
Filippo Valsorda
d4a4e089d0 Generate programmatically per-type code, including .len()
This process probably fixes a bug in NSAPPTR.len(), after a similar one was
found in HINFO.len().

This should also make it easier to make changes to these functions, and
check their correctness.

Generate the code by running "go generate".
2015-10-07 05:48:12 +01:00
Miek Gieben
64fea017a2 Move all docs to docs.go
Another golint change.
2015-02-19 13:47:50 +00:00
Miek Gieben
67945c119e A bunch of golint fixes
The proposed vars names are a nono, because they break the API.
Things left: document each RR and zscan_rr.go has some funcky if-then-elses.
2015-02-19 09:58:33 +00:00
Flavien Lebarbe
067cfe8d4e Add support for HmacSHA512 algorithm in TSIG 2015-01-23 10:51:56 +01:00
Filippo Valsorda
0f1b1184ae Rename and simplify packing helper functions 2014-12-05 19:27:44 +00:00
Miek Gieben
6e3a9dd0d8 Fix tsig fudge factor
Excellent bug report from freb, about how this fails when a message
arrives in the past (because of clock skew).

Closes #153
2014-11-11 17:58:12 +00:00
Miek Gieben
0aa3021a83 Remove all copyright notices
Use the central COPYRIGHT file.
2014-09-11 20:57:37 +01:00
Miek Gieben
4dd48338af documentation tweaks 2014-07-30 07:35:06 +01:00
Andrew Tunnell-Jones
0a5cb5c80a Update TSIG doc header to avoid godoc oddity
For some reason godoc treats it as plain text because it contains
"(TSIG)".
2014-03-02 09:48:46 +00:00
Miek Gieben
83efab6078 Revert "Use dLen in TSIG too"
This reverts commit 37406413d7.
2014-02-14 20:05:51 +00:00
Miek Gieben
37406413d7 Use dLen in TSIG too 2014-02-12 12:51:13 +00:00
Andrew Tunnell-Jones
857a1c66cb Make TsigVerify's MAC comparison take constant time 2014-01-24 03:28:08 +00:00
Miek Gieben
37356f5e68 Documenation fixes 2014-01-12 10:43:59 +00:00
Miek Gieben
4862dd17b4 Slight doc updates 2013-10-12 19:19:24 +01:00
Miek Gieben
0134de62ed Fix TSIG/transfer documentation 2013-10-12 19:14:45 +01:00
Miek Gieben
81941d4422 Update all copyright notices 2013-05-12 16:15:52 +02:00
Miek Gieben
d53d9eab81 gofmt 2013-05-05 20:30:44 +02:00
Miek Gieben
c88ac95260 whitespace in comments 2013-03-18 17:37:49 +00:00
Miek Gieben
cd10853288 Make Len() and Copy() private
I don't think anybody will needs these, msg.Len() is still
available. Severly cuts back on the amount of exported functions.
2013-02-09 08:35:17 +01:00
Miek Gieben
84983bc293 remove space 2013-02-09 08:17:05 +01:00
Miek Gieben
4a951fc1f8 Merge branch 'master' of github.com:miekg/dns 2012-12-14 12:35:25 +01:00
Miek Gieben
99817d7c33 Fix TSIG
If you even add a tag to a struct member, be sure to add that
tag to the other important structs too.
2012-12-13 13:44:27 +01:00
Miek Gieben
375917b7a0 update the todo 2012-12-13 13:10:34 +01:00
Miek Gieben
53dccfe5ed fix docs 2012-12-12 15:08:39 +01:00
Miek Gieben
235e892dfc Rename the RR types drop the RR_ prefix
This is also done in the official Go library. It also make the
code shorter.
2012-12-09 19:23:25 +01:00
Miek Gieben
d618b07666 documentation 2012-12-02 09:15:10 +01:00
Miek Gieben
acbbbdece5 Fix comment 2012-11-30 19:39:16 +01:00
Miek Gieben
3783f43fc3 documentation 2012-11-30 19:13:49 +01:00
Miek Gieben
27de9bad36 Actually parse the whole uint64 2012-11-19 12:26:13 +01:00
Miek Gieben
204a5c3981 hopefully somewhat better 2012-10-12 15:32:41 +02:00
Miek Gieben
dce8b2e71a gofmt 2012-10-10 22:17:50 +02:00
Miek Gieben
10a349423c Fix tests and tsig in the process 2012-10-09 22:45:19 +02:00
Miek Gieben
570bf8dc69 Use proper error in packing and unpacking
All the relevant functions now return an error instead of
a simple boolean. This greatly approves the feedback to coders.

Spotted some fishy error handling along the way and fix that too.
2012-10-09 21:17:54 +02:00
Miek Gieben
915781ea86 Better naming 2012-09-11 21:45:21 +02:00
Miek Gieben
9fd69abe09 struct embedding 2012-09-05 16:31:48 +02:00
Miek Gieben
e4fb00c34d Fix handling of non fully qualified domain names
When PackDomain sees such a name it calls panic.
All panic now use the prefix 'dns:'
2012-08-28 18:21:23 +02:00
Miek Gieben
68961f2f5b Make the IsTsig and IsEdn0 more usefull by returning the record 2012-08-25 11:24:01 +02:00
Miek Gieben
845f4a6992 dont export - minimize api 2012-08-24 12:42:41 +02:00
Miek Gieben
b96e6ac78d tweaks to the documentation 2012-08-24 09:35:33 +02:00
Miek Gieben
b0fc5a2f22 re-export these - I use them in unbound 2012-08-20 18:03:15 +02:00
Miek Gieben
1687a13438 Further minimize the lib 2012-08-20 09:39:10 +02:00