I’m able to set a maximum TTL value with Dnsmasq by --max-ttl
. But I wonder what the default value is if I don’t set --max-ttl
. Does anyone know about it?
The default value is 0
.
The --max-ttl
option sets up the max_ttl
attribute as witnessed there:
3060 else if (option == LOPT_MAXTTL)
3061 daemon->max_ttl = (unsigned long)ttl;
It is defined like that, in src/dnsmasq.h
:
extern struct daemon {
/* datastuctures representing the command-line and
config file arguments. All set (including defaults)
in option.c */
[..]
unsigned long local_ttl, neg_ttl, max_ttl, min_cache_ttl, max_cache_ttl, auth_ttl, dhcp_ttl, use_dhcp_ttl;
So its default value is 0
per the C standard.
Later, you can find tests on that value to trigger specific behavior in src/rfc1035.c
:
/* Return the Max TTL value if it is lower than the actual TTL */
if (daemon->max_ttl == 0 || ((unsigned)(crecp->ttd - now) < daemon->max_ttl))
return crecp->ttd - now;
else
return daemon->max_ttl;