Commit Graph

373 Commits

Author SHA1 Message Date
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