Hello:
I am working on replacing libcares with unbound for my client on an OpenWrt platform. I am using async mode ( ub_resolve_async() ) for DNS queries and unbound is used as a forwarding server and not authoritative one. serve-expired is left at default which is 'no..
The issue I am facing is the application that uses unbound maintains its own cache and on expiry of ttl re-queries unbound which immediately returns an answer with ttl=0 and then sends a fresh query out. This is not desirable for our application. If the application re-queries after tt+1 second then unbound returns answer from fresh query instead serving expired with ttl=0.
-
Why does unbound return expired record with ttl=0 when serve-expired is left at default which is 'no.
-
Why does unbound always sends out new query only after 1 sec after ttl expiry instead of immediately sending new query?
Very First Query
Application —> Query -----------------> Unbound
Unbound —> Query —> Authoritative DNS Server
Unbound <— Answer (ttl = t) <— Authoritative DNS Server
Application <— Answer (ttl = t) < ----------Unbound
After ttl t secs expiry, Second Query
Application —> Query -----------------> Unbound
Application <— Answer (ttl = 0) < ---------Unbound. (NOT DESIRABLE)
Unbound 1 sec wait (NOT DESIRABLE)
Unbound —> Query —> Authoritative DNS Server
Unbound <— Answer (ttl = t) <— Authoritative DNS Server
This process of getting back ttl=0 repeats for all subsequent re-queries on ttl expiry and Application gets orig ttl only from answer to very first query.
As can be seen from the attached wireshark, the lowest ttl=5 and my application re-queries every 5 seconds but unbound sends query out only after 6 seconds as can be seen in wireshark.
Attached unbound.conf.
Any help will be appreciated.
Thanks
Sankar Raman
(attachments)
unbound.conf.txt (1.56 KB)
unbound-wireshark.pcapng (4.24 KB)