Commit Graph

559 Commits

Author SHA1 Message Date
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
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
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
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
f53eb22bfb Check length before packing OPT (#352)
fixes #351
2016-05-05 16:56:17 +01: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
Matthijs Mekking
5107215070 Len returns the rr len of the uncompressed format. 2016-03-17 15:07:51 +01:00
Nick Galbreath
5cbabd2322 spelling 2016-01-19 14:23:11 -08:00
James Hartig
2d2c2ebcfc Instead of removing all RRs on Truncated, attempt to unpack 2015-11-01 15:51:09 -05:00
Filippo Valsorda
023972bb19 Expose TypeToRR 2015-10-16 23:36:49 +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
79547a0341 Add Dedup function
Add function that dedups a list of RRs. Work on strings, which
adds garbage, but seems to be the least intrusive and takes the
last amount of memory.

Some fmt changes snook in as well.
2015-08-24 22:02:57 +01:00
Miek Gieben
9bf52083d1 golint fixes 2015-08-23 08:03:13 +01:00
Miek Gieben
21b35db538 Remove the NSAP record
The NSAP was not implemented correctly, see #239. Just remove it. It will still work as unknown RR.
2015-08-10 07:26:35 +01:00
Miek Gieben
8eb292db07 Doc update for future change in TC handling
Update the comment in msg.go#L1700 about the TC bit handling

Small cleanups.
2015-08-09 16:26:25 +01:00
Miek Gieben
58c5f4cf6e Small doc updates 2015-08-07 20:58:26 +01:00
Filippo Valsorda
40484667f4 rewrite NSEC bitmap [un]packing to account for out-of-order 2015-08-05 00:18:02 +01:00
Filippo Valsorda
2b564cd047 UnpackDomainName: fix infinite loop where it would lower 'off'
When a pointer points to a empty name, the "return '.'" special case used to
kick in which is not pointer-aware so it would reset the parsing offset to
the pointer target

This was independently found and fixed in c13d4ee, I'm submitting this patch
anyway as it seems a bit more robust and DRY [citation needed].
2015-08-05 00:18:02 +01:00
Filippo Valsorda
77aa064ef9 packStructValue: rewrite dns:"wks" packing which was writing out of bounds 2015-08-05 00:18:02 +01:00
Filippo Valsorda
0df69faa6e packStructValue: fix a overflow in NSEC packing 2015-08-05 00:18:02 +01:00
Filippo Valsorda
b5133fead4 unpackStructValue: drop rdlen, reslice msg instead 2015-08-05 00:18:02 +01:00
Filippo Valsorda
6313235fed unpackStructValue: fix a overflow in opt 2015-08-05 00:18:01 +01:00
Miek Gieben
14e381d23e fuzzzz 2015-07-27 21:48:46 +01:00
Miek Gieben
fcf516f280 fuzzzz 2015-07-27 20:57:02 +01:00
Miek Gieben
c13d4ee9cd domain names: fix compression of root-label
If the root label is compressed (which is 2 bytes, the root label
itself is only 1 byte, so why do it?), go dns incorrectly set the
offset when encountering such a name.

Fixes #234
2015-07-27 20:48:09 +01:00
Roland Shoemaker
259969e797 Better buffer size 2015-07-21 16:04:21 -07:00
Roland Shoemaker
3d5407e128 Fix CAA packing bug 2015-07-07 20:20:25 +01:00
Roland Shoemaker
52647ae7a7 Address miekg's comments 2015-06-18 19:17:02 -07:00
Roland Shoemaker
020002b9e0 Switch setCAA, CAA.String to presentation format, add various encoding helpers 2015-06-17 16:06:31 -07:00
Roland Shoemaker
522331911d Enable CAA parsing 2015-06-16 02:01:28 -07:00
Harvo Jones
57d8407ad7 Changes applied:
* Renamed EDNS0_CUSTOM to EDNS0_LOCAL
* Added EDNS0LOCAL constants
* Added documentation
2015-03-18 12:12:53 -07:00
Harvo Jones
8bd3ac773f Add support for custom EDNS options in GoDNS.
A handful of EDNS options have been standardized, and they each have a type defined in GoDNS.  However there is currently no way a development team can use GoDNS with internally defined options, or with new options that may be proposed in the future.

This change solves the problem by giving users an EDNS0_CUSTOM type to allow clients to send, and servers to receive, custom EDNS options.
2015-03-17 10:41:55 -07:00
Michael Haro
f1f17ffdbc Split Copy into Copy and CopyTo.
CopyTo allows bypassing allocating a new Msg to work towards less
allocation GC churn.
2015-02-23 23:11:31 -08:00
Miek Gieben
574544eb08 Documentation updates 2015-02-20 11:39:15 +00:00
Miek Gieben
faa311bf55 golint: more docs 2015-02-19 11:26:46 +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
Daniel Morsing
a4af4dd14e Used shared backing array for Msg.Copy
If you have a system with large amounts of copies, these slice
allocations start stacking up. Use a shared slice and then subslice
them with a cap limit so that append works properly.

Also, add a benchmark and test for Msg.Copy

Benchcmp:
benchmark         old ns/op     new ns/op     delta
BenchmarkCopy     1880          1672          -11.06%

benchmark         old allocs     new allocs     delta
BenchmarkCopy     13             11             -15.38%

benchmark         old bytes     new bytes     delta
BenchmarkCopy     528           528           +0.00%
2015-02-05 13:07:07 +00:00
Miek Gieben
b6ff23905a Finish implementing IPSECKEY
Remaining tests and unpack for IPSECKEY.
2015-01-25 12:24:39 +00:00
Miek Gieben
477cb4d3fa Implement IPSECKEY
IPSECKEY is kinda strange because it has a type selector which tells
what type a later rdata field has. The type can be a domainname, address
or v6 address. You sort of wish Go would have a union type for this, but
alas.
Currently this is implemented as:

	GatewayA    net.IP `dns:"a"`
	GatewayAAAA net.IP `dns:"aaaa"`
	GatewayName string `dns:"domain-name"`

In the IPSECKEY. Only one of these is active at any one time. When
parsing/packing and unpacking the value of GatewayType is checked
to see what to do.

Parsing from strings is also implemented properly and tested. The Unpack
function still needs work.
2015-01-25 10:58:30 +00:00
Filippo Valsorda
ed475ae9fa [DNSSEC] Make int to bytes conversions fixed length in ECDSA
ECDSA public keys consist of a single value, called "Q" in FIPS
  186-3.  In DNSSEC keys, Q is a simple bit string that represents the
  uncompressed form of a curve point, "x | y".

  The ECDSA signature is the combination of two non-negative integers,
  called "r" and "s" in FIPS 186-3.  The two integers, each of which is
  formatted as a simple octet string, are combined into a single longer
  octet string for DNSSEC as the concatenation "r | s".  (Conversion of
  the integers to bit strings is described in Section C.2 of FIPS
  186-3.)  For P-256, each integer MUST be encoded as 32 octets; for
  P-384, each integer MUST be encoded as 48 octets.
2014-12-05 20:17:11 +00:00
Filippo Valsorda
0f1b1184ae Rename and simplify packing helper functions 2014-12-05 19:27:44 +00:00
Andrew Tunnell-Jones
71436daebe Make TestDynamicUpdateZeroRdataUnpack pass
Straight up: took a guess and the tests pass.
2014-11-12 07:56:21 +00:00
Miek Gieben
34f43d398b Stop parsing when hitting rdlen
Stop parsing these records when we hit rdlen.
2014-11-09 16:17:06 +00:00
Miek Gieben
11bbb59419 Rename rdlen to lenrd
More in sync with lenmsg.
2014-11-09 16:16:41 +00:00
Miek Gieben
d33af8db79 Update test and gofmt 2014-11-09 16:09:49 +00:00
Miek Gieben
eff0e9354f Apply 433ab7b569 here too
The same Sprintf was used here, so this can be optimized as well.

Thanks to @andrewtj for the ping.
2014-11-09 08:03:03 +00:00
Daniel Morsing
433ab7b569 Reduce amount of work done when unpacking unprintable characters.
Instead of going through the fmt package, we can use append int,
which saves an allocation.

benchmark                                old ns/op     new ns/op     delta
BenchmarkUnpackDomainNameUnprintable     2147          506           -76.43%
2014-11-06 13:51:29 +00:00
Andrew Tunnell-Jones
91b8c69a22 Implement SIG(0) signing and verification
This is based on @miekg's sig0 branch. That branch diverged from master
and I didn't want to wander off on a rebase.

As implemented there's no allowance for multi-envelope (TCP) support.

TODO:

* unpackUint32() could be moved out and used elsewhere
* tests
* multi-envelope support (if useful)
2014-11-01 11:32:46 +00:00
Miek Gieben
6bbae6c6ea Add CDNSKEY support 2014-10-23 22:18:23 +01:00
Miek Gieben
467e368cc1 check for overflowing msg len when unpacking A
unclebadtouches catched this.

closes #141
2014-10-22 21:08:34 +01:00
Miek Gieben
3d0face066 Fixup tests 2014-10-08 14:35:23 +00:00
Miek Gieben
de954625b6 Add ErrExtendedRcode and fix up the callers 2014-10-08 14:31:28 +00:00
Filippo Valsorda
9088298b2b Add support for extended RCODEs and detect bad RCODEs 2014-09-26 12:18:36 +01:00
Miek Gieben
9c455b0214 PrivateRR: naming naming naming
Try to find better (=more in sync with the rest of the lib) naming. My
guess is that these are better, but YMMV.
2014-09-21 08:28:38 +01:00
Alex Sergeyev
fcf9302ae1 Changed logic to typeswitch and added comments.
And also added my name to contrib list as promised before.
2014-09-20 18:15:42 -04:00
Alex Sergeyev
8aab8c6fb2 Lots of renamed funcs and structures. More readability. 2014-09-20 18:07:36 -04:00
Alex Sergeyev
5b8552609c Added docstrings, tests and example for PrivateRRs.
(renamed CustomRR to PrivateRR)
2014-09-19 17:30:10 -04:00
Alex Sergeyev
7c507e7592 New functionality for adding private RRs to dns lib. 2014-09-19 17:28:53 -04:00
Miek Gieben
02dd474056 Dont export typeToRR (old rr_mk) 2014-09-16 07:31:20 +01:00
Miek Gieben
bcb640ccaf Make rr_mk public and call it TypeToRR 2014-09-16 07:15:06 +01:00
Miek Gieben
0aa3021a83 Remove all copyright notices
Use the central COPYRIGHT file.
2014-09-11 20:57:37 +01:00
Miek Gieben
8fecf17714 Check that off <= lenmsg
Defense in depth, this should happen, but it happens... So check
for it and return an error.

Maybe (there is no testcase) fixes #106
2014-08-23 07:43:00 +01:00
Miek Gieben
34f5a12bfc Don't crash on emtpy string in compressionLenSearch
Fixes #105
2014-08-22 08:46:24 +00:00
Miek Gieben
4d3dac9c36 Add the OPENPGPKEY RR. 2014-08-14 09:18:08 +01:00
Miek Gieben
4dd48338af documentation tweaks 2014-07-30 07:35:06 +01:00
Miek Gieben
1243dcbc89 Make Id a variable to points to id (renamed from Id())
This way the Id function can be overruled by clients to have
another implementation for the Id function:

To make it static: dns.Id = func() uint16 { return 1234 }
2014-07-30 07:17:13 +01:00
Miek Gieben
060e66250e Add IsMsg()
A quick validating function that checks if a buffer is a valid
DNS message.
The code is *far* from complete.
2014-05-18 09:02:00 +01:00
Andrew Tunnell-Jones
8772f9064c Make PackRR enforce RR data length limit
• Make rawSetRdlength return false if length would overflow
• Make PackRR assume rawSetRdlength returning false indicates an overflow
2014-04-29 05:03:01 +00:00
Miek Gieben
b7a8c14d7d Add dns.Name as a type
This can be used for printing names.
2014-04-23 21:06:17 +01:00
Miek Gieben
fcbb2e7a9a Check and better errors 2014-04-08 00:09:26 +01:00
Miek Gieben
abe6de223d Add some more checks 2014-04-05 08:06:49 +01:00
Miek Gieben
a211645d0a Also check for msg length 2014-04-04 19:43:39 +01:00
Miek Gieben
541776149c Merge pull request #85 from andrewtj/atj-encoding
Parsing and Stringer Changes
2014-03-02 16:48:46 +00:00
Andrew Tunnell-Jones
38d78bafe4 Escape @ when printing/unpacking domain names 2014-03-01 22:30:52 +00:00
Andrew Tunnell-Jones
3ba746b6ca Convention is Txt not TXT in msg.go function names 2014-03-01 22:25:24 +00:00
Marek Majkowski
999a3ce301 Reduce number of memory allocations in msg.Copy
Right now we allocate memory even for empty slices. This is inefficient, sticking "nil" as a slice is good enough if there are no items.
2014-02-28 07:03:21 -08:00
Andrew Tunnell-Jones
3f834a04fb Update domain name and TXT string escape behaviour
Changes to domain name packing and unpacking:
* Escape dot, backslash, brackets, double-quote, semi-colon and space
* Tab, line feed and carriage return become \t, \n and \r

Changes to TXT string packing and unpacking:
* Escape backslash and double-quote
* Tab, line feed and carriage return become \t, \n and \r
* Other unprintables to \DDD

Stringers do the equivalent of putting domain names and TXT strings
to the wire and back.

There is some duplication of logic. I found performance suffered when
I broke the logic out into smaller functions. I think this may have
been due to functions not being inlined for various reasons.
2014-02-26 10:55:11 +00:00
Andrew Tunnell-Jones
c500de0e7a Fix HIP record unpacking
* limit decoding of Hit to HitLength
* limit decoding of PublicKey to PublicKeyLength
* limit decoding of RendezvousServers to rdata's length
2014-02-22 05:28:48 +00:00
Andrew Tunnell-Jones
4bf3023c78 Handle label ending in an escaped dot in PackDomain 2014-02-15 00:40:53 +00:00
Miek Gieben
87b380cad5 Revert "Use dLen for domain name length"
This reverts commit b595183834.

Fix up the tests too.
2014-02-14 20:20:22 +00:00
Miek Gieben
89cc033428 Be much more precice in msg.Len()
There is still a one-off in EDNS0 records, but I'm not too bothered with
that one.
2014-02-12 12:59:42 +00:00
Miek Gieben
31102c38b7 Make Len() much more accurate for compressed messages.
Lots of changes made and bugs fixed.
2014-02-11 23:01:47 +00:00
Miek Gieben
8f334b52a0 Merge branch 'master' of github.com:miekg/dns 2014-02-10 15:31:20 +00:00
Miek Gieben
6293844a72 Check compression lengths 2014-02-10 12:43:38 +00:00
Miek Gieben
0cba5240c3 More tests lenght 2014-02-10 12:43:09 +00:00
Miek Gieben
56e0bb46d8 Remove packLen() and fix bug in Len()
packLen() was a featureless mirror of Len(). Remove it, and just use
Len() internally too.
Fix bug in Len() too, where the length of the additional section was
not counted.
2014-02-10 12:23:53 +00:00
Miek Gieben
5ecc38c003 Better docs 2014-02-06 10:32:38 +00:00
Miek Gieben
4f6fef6777 If the TC bit is set return a valid but smaller message
If the TC bit is set in a message, we will probably try to parse
half a message, which will fail. To fix this just return a message
header and the question section and don't parse the rest.
2014-02-05 21:47:26 +00:00
Miek Gieben
95fd782f44 Fix documentation for these public functions 2014-02-05 21:38:12 +00:00
Alex Ciuba
16d6ebe1c1 Use slice to build domain string 2014-02-01 01:29:00 -05:00
Miek Gieben
9ba617e870 Revert "Share the message buffer if we have room"
This reverts commit 17ce0cd52f.
2014-01-28 22:43:48 +00:00
Miek Gieben
27abc83e6a Merge pull request #80 from millerkil/optimize
A couple optimizations
2014-01-27 23:58:06 -08:00
Alex Ciuba
17ce0cd52f Share the message buffer if we have room 2014-01-27 19:45:45 -05:00
Miek Gieben
9c0ff1489b Merge branch 'master' of github.com:miekg/dns 2014-01-27 14:32:07 +00:00
Miek Gieben
bb2ef9e3fc Add generic Copy function that copies RRs
Don't export all the copy() functions, instead add a Copy() function
that use the RR interface
2014-01-27 14:25:24 +00:00
Alex Ciuba
b8262501a8 Minimize reflection calls 2014-01-26 16:14:32 -05:00
Alex Ciuba
f73d400eb2 Reduce string allocations 2014-01-26 16:14:32 -05:00
Alex Ciuba
3768fa0083 Optimize compressionLenHelper 2014-01-25 21:09:28 -05:00
Miek Gieben
0364de3abf Make EDNS0 unpack return error on failure
Report these errors upwards when unpacking a message.
2014-01-24 10:09:22 +00:00
Miek Gieben
ce360dab57 fmt 2014-01-12 10:22:04 +00:00
Miek Gieben
00a08d77fc PackBuffer: slight cleanup in docs 2014-01-12 10:21:23 +00:00
Miek Gieben
7f8964662e Merge branch 'majek/packwithbuffer' of https://github.com/majek/dns into bufpack 2014-01-12 10:17:35 +00:00
Miek Gieben
a56060b558 Cleanups for Copy()
Docs and slight code formatting issues.
2014-01-12 10:04:38 +00:00
Marek Majkowski
2cfad667d7 msg.Copy() makes a deep-copy of the msg object
There was a copy function that did shallow copies of the msg
object. Export it and make it support proper deep copying.
2014-01-10 08:49:45 -08:00
Marek Majkowski
d18d87b37d Introduce msg.PackBuffer() - it's like msg.Pack() but can reuse a byte buffer
msg.Pack() always allocates a byte slice. This is good for simplicity,
but in a serious application it's preferable to reuse byte slices to
reduce the GC overhead. This patch introduces a new public method:
PackBuffer(). It's exaclty like Pack() but is able to reuse a
given byte slice. It will still allocate a new slice if the given one
is too small.
2014-01-10 07:46:24 -08:00
Miek Gieben
9f5db7b72c Disable the unfinished CAA support
CAA was partially implemented, it's better to do it 100% until that
time handle CAA as an unknown record.

Closes #70:
2014-01-07 07:44:06 +00:00
Miek Gieben
7a27e05cb7 Remove setting compress to nil
Useless operation as compress is already nil from the
initialization.
2014-01-05 08:06:29 +00:00
soh335
e8a5f90957 if txt rdlength is 0, not read anymore 2014-01-04 17:30:08 +09:00
Miek Gieben
70ee966106 Fix the unknown record sign test
Don't make up new error in msg.Pack when there are perfectly fine
errors to return.
2013-12-06 09:43:26 +00:00
Miek Gieben
ca52132cef reverse this until I have evidence it would be needed 2013-12-05 19:48:08 +00:00
Skinner, Alex
edd235088a Added TYPE65534 record type so that zone scanning doesn't die upon encountering one. Fixed DNSSEC signature verification. 2013-12-04 12:58:20 -05:00
Miek Gieben
9b8e8578e4 comment tweak 2013-11-10 18:41:55 +00:00
Miek Gieben
27263c64b1 gofmt 2013-10-19 21:41:13 +01:00
Miek Gieben
ff7806469c Implement EID and NIMLOC records 2013-10-19 21:31:12 +01:00
Miek Gieben
f569ea2f95 Allow "dns:-" tag in msg to mean dont pack this 2013-10-17 18:26:26 +01:00
Miek Gieben
b435d836c6 gofmt 2013-10-15 14:21:47 +00:00
Miek Gieben
35bcc78d76 Implement PX record 2013-10-13 13:23:02 +01:00
Miek Gieben
cc2c42cc91 Implement GPOS record 2013-10-13 13:01:33 +01:00
Miek Gieben
961e137891 Add NSAP and NSAP-PTR record 2013-10-13 12:25:08 +01:00
Miek Gieben
fc7a8472dc isnt used 2013-10-01 10:27:08 +00:00
Miek Gieben
67065da09c Fix the CAA type 2013-09-27 08:51:20 +00:00
Miek Gieben
4e6b3a5afc Check for the end of the message 2013-09-22 19:35:10 +01:00
Ask Bjørn Hansen
55c1f95213 Support the new RFC6891 EDNS0 SUBNET option code
Also keep support for the old draft code
2013-09-19 22:31:28 -07:00
Miek Gieben
9c1ee5d5ca Update IsDomainName
This new functions just compiles the domain to wire format, if that
works, the name is deemed OK. It is also much less strict than the
older code. Almost everything is allowed in the name, except two
dots back to back (there is an explicit test for that).
2013-09-10 18:09:22 +00:00
Miek Gieben
b6a2d1fb5e Allow empty rdata in records
Empty or no rdata is allowed for dynamic updates, so test if this
works for packing/unpacking. It only fails for TSIG (which is
never seen in zone files), SOA (which is not seen like this in dyn.
updates) and WKS (just an old record).
2013-08-31 20:24:52 +01:00
Miek Gieben
fdcdc6dbf6 Add test to zero rdata (for dyn updates)
This triggerd a bunch of failures, the most important one
is the packing and zero length domain name now works.
2013-08-26 21:11:24 -07:00
Miek Gieben
6ef2debe4e Add copy for an entire message, private for now 2013-08-23 22:53:05 +00:00
Miek Gieben
09d7d3e79d Some TODO updates 2013-06-29 09:50:43 +01:00
Miek Gieben
9fa50d8ac2 Fix the nsec/3 length calculation
This overshoots, 'cause it only counts the windows, not the
actual bitmap sizes in the window. But it keeps the code
simple and fast.
2013-06-27 20:19:02 +01:00
Miek Gieben
55aa4480c7 Fix some typos 2013-06-27 19:46:26 +01:00
Miek Gieben
61919d8713 Add all the compressible types to Len()
Len() now performs its duty, question is, *is* this now faster/better
than just packing a Msg, checkings its lenght and discarding the buffer.
2013-06-27 09:07:01 +00:00
Miek Gieben
1ad76fe65b Added packLen
packLen() returns the length of an uncompressed packet buffer, this
is used when packing a packet. This is needed for compression. When
compression is used, we first create the full packet and *then*
compress it. If we use Len() which accounts for compression, we can
get buffer overruns, when packing the (then still uncompressed) packet.
2013-06-26 22:18:09 +01:00
Miek Gieben
38ea608d79 Rename the Label* functions
SplitLabels -> SplitDomainName
CompareLabels -> CompareDomainName
LenLabels -> CountLabel
          -> NextLabel was added as a simple iterator-like function
2013-06-22 07:21:15 +00:00
Miek Gieben
a317648fa3 Add some more TODOs to Pack and kill the println
This closes #46 (for now :-) )
2013-06-20 07:28:51 +01:00
Miek Gieben
5f6228d4cc Use the non-exported version err 2013-06-20 07:27:28 +01:00
Miek Gieben
70f9c6b964 Make err non-exported 2013-06-20 07:25:29 +01:00
Miek Gieben
b697d25ed9 Remove unneed string conversion here 2013-06-14 11:38:04 +00:00
Miek Gieben
9ee7c27e18 Fix rawSetRdlength
When searching for the start of the rdata, the offset wasn't properly
calculated. This only impacted names with \DDD in it (weirdly enough).
2013-06-14 11:35:06 +00:00
Miek Gieben
3f348f173b \DDD to buf parsing fails (sometimes)
Added test (that fails for now)
2013-06-14 07:31:22 +01:00
Miek Gieben
c66494c6c5 Resolv merge conflicts 2013-05-12 19:08:37 +02:00
Miek Gieben
98b677a97c Update the copy right for the original GO files 2013-05-12 16:07:06 +02:00
Miek Gieben
320d981509 Add Algo-signal-draft impl. for EDNS0 2013-05-11 21:02:17 +02:00
Miek Gieben
ec9ac92fad Half the parsing of the EDNS LLQ package 2013-05-08 23:03:02 +02:00
Miek Gieben
6ecde82c20 Remove UPDATE_LEASE to UL
The "other" edns0 option will then become LONG_LIVED_QUERIES which
is way to long to be practical, so I want to make it LLQ, UPDATE_LEASE
then needs to be come UL.

This will probably impact no-one, because noone uses this (I hope)
2013-05-08 22:28:19 +02:00
Miek Gieben
709d11aa2c update documentation 2013-05-06 22:23:13 +02:00
Miek Gieben
d53d9eab81 gofmt 2013-05-05 20:30:44 +02:00