NLnetLabs / ldns

LDNS is a DNS library that facilitates DNS tool programming
https://nlnetlabs.nl/ldns
BSD 3-Clause "New" or "Revised" License
285 stars 94 forks source link

Simple way to specify EDNS0 pseudo-header in ldns-testns #222

Open pemensik opened 1 year ago

pemensik commented 1 year ago

Is there any way to properly include EDNS0 header in responses from ldns-testns? I have tried to hack something up, but that failed.

;SECTION ADDITIONAL
; Hackish specification of ENDS0 OPT response
;.   32768 CLASS1232 OPT
;.   32768 CLASS1232 TYPE41

Because I haven't found a way to print also EDNS0 in dig +unknown format, I am not sure how can I create response including EDNS0. I would like some simple human readable way to do that, at least for EDNS0 buffer size and DO flag.

Is there a simple way to include customized EDNS0 response? Ideally not in such cryptic ways. Used ldns-1.8.3-6.fc38.x86_64

wtoorop commented 1 year ago

I recently needed this too, and this is how I did it too.

I'll discuss it internally with @gthess and @wcawijngaards , cause testbound (based on ldns-testns) does have some more extensions to this. Maybe we can copy that.

pemensik commented 1 year ago

Well the commented out example did not work to me. I am not sure how the TTL part should look like. I received Syntax error, value expected: . 128 CLASS1232 OPT, but not sure how to fix this.

wtoorop commented 1 year ago

You need to specify empty rdata. I did it like this:

.       32768   CLASS1232       TYPE41  \# 0
pemensik commented 1 year ago

Oh, thanks! OPT record type is recognized, but other parts needs to be this non-intuitive way.