Commit Graph

19 Commits

Author SHA1 Message Date
Andrey Meshkov ba44371638
Fix edns keepalive (#1317)
* Fix un/packing of EDNS0 TCP keepalive extension

The current code is assuming the OPT code and length are part of the
data passed to the unpacker and that it should be appenedded during
packing while those fields are parsed by the caller.

This change fixes the parsing and make sure a request with a keepalive
won't fail.

* added tests for EDNS0_TCP_KEEPALIVE pack/unpack

* mark Length as deprecated

* removed named returns

* restored String

Co-authored-by: Olivier Poitrey <rs@rhapsodyk.net>
2021-12-23 09:45:02 +01:00
Alexandru Ionut Tripon 1630ffe2ca
Added support for ENUM Source-URI Extension (#1301) 2021-09-27 15:50:21 +02:00
Miek Gieben cce7f43db4
OPT: add Z and SetZ methods (#1246)
* OPT: add Z and SetZ methods

Fixes: #1169

Signed-off-by: Miek Gieben <miek@miek.nl>

* code review feedback

Change the mask and use and not (&^)

Signed-off-by: Miek Gieben <miek@miek.nl>

* Code review changes

Signed-off-by: Miek Gieben <miek@miek.nl>
2021-05-05 15:38:29 +02:00
Miek Gieben 730ff1f016
Revert "Export EDNS0 interface (#1041)" (#1046)
This reverts commit a98e771ba5.

This is breaking people
2019-12-06 21:23:18 +00:00
Omer Anson a98e771ba5 Export EDNS0 interface (#1041)
Replace all the private methods in the EDNS0 with public methods.
Additionally, as suggested in issue #857, made Pack receive a
pre-allocated byte array, introduce a Len method, and have Pack
and Unpack return the number of octets written and read (respectively)
if there was no error.

Closes #857
2019-12-06 10:56:57 +00:00
Andrew Tunnell-Jones 4334efe802 Update EDNS0_UL to draft-sekar-dns-ul-02 (#1028) 2019-10-14 09:29:56 +01:00
Tom Thorogood 11fb61cb84 Use copy instead of loop in EDNS0_SUBNET.unpack (#825) 2018-11-27 14:32:41 +00:00
chantra 1c9c9bf4c9 properly set extended rcode when packing (#791)
* properly set extended rcode when packing

When calling `SetExtendedRcode`, we expect to get the full extended
rcode, not the rcode after we shift 4 bytes right.

* fix extended rcode

* fix TestOPTTtl test

* set error messages in TestPackExtendedBadCookie

* Set Rcode with extended rcode

* |=

* Set extended RCODE field to 0 when RCODE is not an extended one.
+ unittests

* Force setting extended rcode if we have an OPT available.

* go fmt + @tmthrgd comments

* comments and nits

* reformat comment
2018-11-17 10:30:14 +10:30
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
Shane Kerr b96e5025a3 Simple function to clear the DO bit from an OPT resource record. (#407)
* Function to clear the DO bit from an OPT RR.

* Tests for ClearDo() function.

* Changed from ClearDo() to SetDo() with an optional argument.

* Update doc string for SetDo(). Make tests for SetDo() comprehensive.
2016-10-05 09:08:39 +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 3d0face066 Fixup tests 2014-10-08 14:35:23 +00:00
Filippo Valsorda 9088298b2b Add support for extended RCODEs and detect bad RCODEs 2014-09-26 12:18:36 +01:00
Filippo Valsorda 43fe5fb12c Fix the OPT RR Version get code and simplify DO get/set 2014-09-23 17:55:36 +01:00
Miek Gieben a1e2d21553 Fold more tests into 1 file 2011-01-15 22:53:04 +01:00
Miek Gieben 15dd65171b Split the package in multiple packages
dns - the standard rrtypes and such
    dnssec - validation, keytag calculation, etc
    resolver - for talking to servers
2010-12-30 13:42:52 +01:00
Miek Gieben fd9afcb44d Add signature helper function
Do this in dnssec.go so that all DNSSEC stuff in contained
in that file.
Add testing too
2010-12-24 11:50:42 +01:00
Miek Gieben 4ce23b71cf Fix the encoding a EDNS RR
Still need to handle the domain name packer, so that we can
detect we have an OPT RR, with the different encoding
2010-12-22 20:53:18 +01:00
Miek Gieben 0f05a2f434 Make a stab for EDNS 2010-12-22 12:26:50 +01:00