Disable Serving expired with ttl=0

George (Yorgos) Thessalonikefs george at nlnetlabs.nl
Thu Jun 29 10:50:02 UTC 2023


Hi Sankar,

A TTL of 0 does not mean that the record is expired.
Unbound returns the non-expired (0 TTL) record and starts prefetching; 
since I see that this is enabled in the configuration.

If you query 1 second later when the record is expired, Unbound will go 
to the network instead.

Best regards,
-- Yorgos

On 29/06/2023 12:26, Raman, Sankar via Unbound-users wrote:
> 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.
> 
> 1. Why does unbound return expired record with ttl=0 when serve-expired 
> is left at default which is 'no.
> 
> 2. 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
> 
> 
> 
> *Disclaimer*
> 
> This e-mail together with any attachments may contain information of 
> Ribbon Communications Inc. and its Affiliates that is confidential 
> and/or proprietary for the sole use of the intended recipient. Any 
> review, disclosure, reliance or distribution by others or forwarding 
> without express permission is strictly prohibited. If you are not the 
> intended recipient, please notify the sender immediately and then delete 
> all copies, including any attachments.
> 


More information about the Unbound-users mailing list