mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-20 02:38:32 +00:00
Add --max-cache-ttl option.
This commit is contained in:
@@ -25,6 +25,9 @@ version 2.64
|
|||||||
Fix build with later Lua libraries. Thansk to Cristian
|
Fix build with later Lua libraries. Thansk to Cristian
|
||||||
Rodriguez for the patch.
|
Rodriguez for the patch.
|
||||||
|
|
||||||
|
Add --max-cache-ttl option. Thanks to Dennis Kaarsemaker
|
||||||
|
for the patch.
|
||||||
|
|
||||||
|
|
||||||
version 2.63
|
version 2.63
|
||||||
Do duplicate dhcp-host address check in --test mode.
|
Do duplicate dhcp-host address check in --test mode.
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ maximum TTL will be given to clients instead of the true TTL value if it is
|
|||||||
lower. The true TTL value is however kept in the cache to avoid flooding
|
lower. The true TTL value is however kept in the cache to avoid flooding
|
||||||
the upstream DNS servers.
|
the upstream DNS servers.
|
||||||
.TP
|
.TP
|
||||||
|
.B --max-cache-ttl=<time>
|
||||||
|
Set a maximum TTL value for entries in the cache.
|
||||||
|
.TP
|
||||||
.B \-k, --keep-in-foreground
|
.B \-k, --keep-in-foreground
|
||||||
Do not go into the background at startup but otherwise run as
|
Do not go into the background at startup but otherwise run as
|
||||||
normal. This is intended for use when dnsmasq is run under daemontools
|
normal. This is intended for use when dnsmasq is run under daemontools
|
||||||
|
|||||||
@@ -371,6 +371,9 @@ struct crec *cache_insert(char *name, struct all_addr *addr,
|
|||||||
int freed_all = flags & F_REVERSE;
|
int freed_all = flags & F_REVERSE;
|
||||||
int free_avail = 0;
|
int free_avail = 0;
|
||||||
|
|
||||||
|
if(daemon->max_cache_ttl < ttl)
|
||||||
|
ttl = daemon->max_cache_ttl;
|
||||||
|
|
||||||
/* Don't log keys */
|
/* Don't log keys */
|
||||||
if (flags & (F_IPV4 | F_IPV6))
|
if (flags & (F_IPV4 | F_IPV6))
|
||||||
log_query(flags | F_UPSTREAM, name, addr, NULL);
|
log_query(flags | F_UPSTREAM, name, addr, NULL);
|
||||||
|
|||||||
@@ -751,7 +751,7 @@ extern struct daemon {
|
|||||||
int max_logs; /* queue limit */
|
int max_logs; /* queue limit */
|
||||||
int cachesize, ftabsize;
|
int cachesize, ftabsize;
|
||||||
int port, query_port, min_port;
|
int port, query_port, min_port;
|
||||||
unsigned long local_ttl, neg_ttl, max_ttl;
|
unsigned long local_ttl, neg_ttl, max_ttl, max_cache_ttl;
|
||||||
struct hostsfile *addn_hosts;
|
struct hostsfile *addn_hosts;
|
||||||
struct dhcp_context *dhcp, *dhcp6, *ra_contexts;
|
struct dhcp_context *dhcp, *dhcp6, *ra_contexts;
|
||||||
struct dhcp_config *dhcp_conf;
|
struct dhcp_config *dhcp_conf;
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ struct myoption {
|
|||||||
#define LOPT_TFTP_LC 309
|
#define LOPT_TFTP_LC 309
|
||||||
#define LOPT_RR 310
|
#define LOPT_RR 310
|
||||||
#define LOPT_CLVERBIND 311
|
#define LOPT_CLVERBIND 311
|
||||||
|
#define LOPT_MAXCTTL 312
|
||||||
|
|
||||||
#ifdef HAVE_GETOPT_LONG
|
#ifdef HAVE_GETOPT_LONG
|
||||||
static const struct option opts[] =
|
static const struct option opts[] =
|
||||||
@@ -223,6 +224,7 @@ static const struct myoption opts[] =
|
|||||||
{ "dhcp-broadcast", 2, 0, LOPT_BROADCAST },
|
{ "dhcp-broadcast", 2, 0, LOPT_BROADCAST },
|
||||||
{ "neg-ttl", 1, 0, LOPT_NEGTTL },
|
{ "neg-ttl", 1, 0, LOPT_NEGTTL },
|
||||||
{ "max-ttl", 1, 0, LOPT_MAXTTL },
|
{ "max-ttl", 1, 0, LOPT_MAXTTL },
|
||||||
|
{ "max-cache-ttl", 1, 0, LOPT_MAXCTTL },
|
||||||
{ "dhcp-alternate-port", 2, 0, LOPT_ALTPORT },
|
{ "dhcp-alternate-port", 2, 0, LOPT_ALTPORT },
|
||||||
{ "dhcp-scriptuser", 1, 0, LOPT_SCRIPTUSR },
|
{ "dhcp-scriptuser", 1, 0, LOPT_SCRIPTUSR },
|
||||||
{ "min-port", 1, 0, LOPT_MINPORT },
|
{ "min-port", 1, 0, LOPT_MINPORT },
|
||||||
@@ -1930,6 +1932,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
|||||||
case 'T': /* --local-ttl */
|
case 'T': /* --local-ttl */
|
||||||
case LOPT_NEGTTL: /* --neg-ttl */
|
case LOPT_NEGTTL: /* --neg-ttl */
|
||||||
case LOPT_MAXTTL: /* --max-ttl */
|
case LOPT_MAXTTL: /* --max-ttl */
|
||||||
|
case LOPT_MAXCTTL: /* --max-cache-ttl */
|
||||||
{
|
{
|
||||||
int ttl;
|
int ttl;
|
||||||
if (!atoi_check(arg, &ttl))
|
if (!atoi_check(arg, &ttl))
|
||||||
@@ -1938,6 +1941,8 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
|
|||||||
daemon->neg_ttl = (unsigned long)ttl;
|
daemon->neg_ttl = (unsigned long)ttl;
|
||||||
else if (option == LOPT_MAXTTL)
|
else if (option == LOPT_MAXTTL)
|
||||||
daemon->max_ttl = (unsigned long)ttl;
|
daemon->max_ttl = (unsigned long)ttl;
|
||||||
|
else if (option == LOPT_MAXCTTL)
|
||||||
|
daemon->max_cache_ttl = (unsigned long)ttl;
|
||||||
else
|
else
|
||||||
daemon->local_ttl = (unsigned long)ttl;
|
daemon->local_ttl = (unsigned long)ttl;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user