[Dnsmasq-discuss] DNSMASQ Cache

Simon Kelley simon at thekelleys.org.uk
Sun Jun 19 21:48:14 UTC 2022


On 13/06/2022 08:16, John Gilmour via Dnsmasq-discuss wrote:
> Hello,
> 
> 
> First time user so please bear with me.
> 
> 
> I have some quite specific in-house code that relies on the "cache->ttd" 
> value.  I have noticed that the function "cache_reload" in "src/cache.c" 
> defines the following variable:
> struct crec lrec
> 
> 
> Further down in this function it makes non-terminal records for all 
> locally-defined RRs.  It may be more of a question but why are the 
> "ttd", "uid" and "ns_id" fields not initialized before the various calls 
> to "make_non_terminals(&lrec)".   When I check the value of the 
> "cache->ttd" in this function it's clearly just going to be random.
> 

cache entries which don't expire are marked by setting the F_IMMORTAL 
flag in the ->flags field. If that flag is set then the value of ->ttd 
is meaningless and unused. It's done this way rather than assigning a 
special value to ttd because the time scale varies in different 
installations and there isn't a suitable "special" time value that will 
always work.


> 
> Is this just an oversight or is deliberately not set?

See above.


Cheers,

Simon.

> 
> 
> Best regards,
> 
> 
> John.
> 
> 
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss




More information about the Dnsmasq-discuss mailing list