I'd like to get the TTL value for a DNS request. I looked at what it
would take to add this to struct ub_result and it doesn't look too
difficult - patch attached.
Is this the right approach? Or should I use ldns to parse the raw
packet bytes to get the ttl?
I'd like to get the TTL value for a DNS request. I looked at what it
would take to add this to struct ub_result and it doesn't look too
difficult - patch attached.
Please don't change the existing API. In this case it could be solved
just by recompiling all dependant programs, but generally changing
existing API causes a lot of troubles (beware not adding new functions
and data types - but really changing existing functions).
Is this the right approach? Or should I use ldns to parse the raw
packet bytes to get the ttl?
That depends on what your needs are? Do you need full validating
resolver (libunbound) or you just want to play around with DNS packets
(libldns)?
I'd like to get the TTL value for a DNS request. I looked at what it
would take to add this to struct ub_result and it doesn't look too
difficult - patch attached.
Please don't change the existing API. In this case it could be solved
just by recompiling all dependant programs, but generally changing
existing API causes a lot of troubles (beware not adding new functions
and data types - but really changing existing functions).
I agree - this patch breaks the ABI. I don't think this is an urgent
matter, so would it be acceptable to put this in the queue for
whenever the next major API changes happen?
I do want to use the full validating resolver (especially dnssec). I
also find the libunbound interface simpler, so my code is easy to
read. I'm trying to replace code that used a different dns resolver
library that has gone dormant and doesn't have dnssec support.
One possibility is to place unsigned* ttl at the end of struct
ub_result - then existing applications would not break. I think it
"looks nicer" where it is. Either way, it doesn't really matter.
Not sure what to do about this. Unbound already returns the TTL inside
the 'raw packet data' chunk in the result. I understand that that is
not really easy, since you need (say) ldns_wire2pkt to get at that TTL.
To me TTL is useful, obviously. Also, it is already available, but
not exposed through the libunbound interface. However, I can always
work around it if it's not exposed.