dnsmasq: remove outdated min-ttl patch
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
(cherry picked from commit 8e1fbfe312)
This commit is contained in:
parent
232f25f890
commit
75eb596357
@ -24,7 +24,7 @@ config dnsmasq
|
|||||||
option filter_a 0
|
option filter_a 0
|
||||||
option filter_aaaa 0
|
option filter_aaaa 0
|
||||||
option cachesize 8000
|
option cachesize 8000
|
||||||
option mini_ttl 3600
|
option min_cache_ttl 3600
|
||||||
option dns_redirect 1
|
option dns_redirect 1
|
||||||
option ednspacket_max 1232
|
option ednspacket_max 1232
|
||||||
option filter_aaaa 0
|
option filter_aaaa 0
|
||||||
|
|||||||
@ -967,7 +967,6 @@ dnsmasq_start()
|
|||||||
|
|
||||||
append_bool "$cfg" filter_a "--filter-A"
|
append_bool "$cfg" filter_a "--filter-A"
|
||||||
append_bool "$cfg" filter_aaaa "--filter-AAAA"
|
append_bool "$cfg" filter_aaaa "--filter-AAAA"
|
||||||
append_parm "$cfg" mini_ttl "--min-ttl"
|
|
||||||
|
|
||||||
append_parm "$cfg" logfacility "--log-facility"
|
append_parm "$cfg" logfacility "--log-facility"
|
||||||
config_get logfacility "$cfg" "logfacility"
|
config_get logfacility "$cfg" "logfacility"
|
||||||
|
|||||||
@ -1,102 +0,0 @@
|
|||||||
--- a/src/dnsmasq.h
|
|
||||||
+++ b/src/dnsmasq.h
|
|
||||||
@@ -1156,7 +1156,7 @@ extern struct daemon {
|
|
||||||
int randport_limit; /* Maximum number of source ports for query. */
|
|
||||||
int cachesize, ftabsize;
|
|
||||||
int port, query_port, min_port, max_port;
|
|
||||||
- unsigned long local_ttl, neg_ttl, max_ttl, min_cache_ttl, max_cache_ttl, auth_ttl, dhcp_ttl, use_dhcp_ttl;
|
|
||||||
+ unsigned long local_ttl, neg_ttl, min_ttl, max_ttl, min_cache_ttl, max_cache_ttl, auth_ttl, dhcp_ttl, use_dhcp_ttl;
|
|
||||||
char *dns_client_id;
|
|
||||||
u32 umbrella_org;
|
|
||||||
u32 umbrella_asset;
|
|
||||||
--- a/src/option.c
|
|
||||||
+++ b/src/option.c
|
|
||||||
@@ -105,6 +105,7 @@ struct myoption {
|
|
||||||
#define LOPT_TAG_IF 294
|
|
||||||
#define LOPT_PROXY 295
|
|
||||||
#define LOPT_GEN_NAMES 296
|
|
||||||
+#define LOPT_MINTTL 400
|
|
||||||
#define LOPT_MAXTTL 297
|
|
||||||
#define LOPT_NO_REBIND 298
|
|
||||||
#define LOPT_LOC_REBND 299
|
|
||||||
@@ -308,6 +309,7 @@ static const struct myoption opts[] =
|
|
||||||
{ "dhcp-name-match", 1, 0, LOPT_NAME_MATCH },
|
|
||||||
{ "dhcp-broadcast", 2, 0, LOPT_BROADCAST },
|
|
||||||
{ "neg-ttl", 1, 0, LOPT_NEGTTL },
|
|
||||||
+ { "min-ttl", 1, 0, LOPT_MINTTL },
|
|
||||||
{ "max-ttl", 1, 0, LOPT_MAXTTL },
|
|
||||||
{ "min-cache-ttl", 1, 0, LOPT_MINCTTL },
|
|
||||||
{ "max-cache-ttl", 1, 0, LOPT_MAXCTTL },
|
|
||||||
@@ -452,6 +454,7 @@ static struct {
|
|
||||||
{ 't', ARG_ONE, "<host_name>", gettext_noop("Specify default target in an MX record."), NULL },
|
|
||||||
{ 'T', ARG_ONE, "<integer>", gettext_noop("Specify time-to-live in seconds for replies from /etc/hosts."), NULL },
|
|
||||||
{ LOPT_NEGTTL, ARG_ONE, "<integer>", gettext_noop("Specify time-to-live in seconds for negative caching."), NULL },
|
|
||||||
+ { LOPT_MINTTL, ARG_ONE, "<integer>", gettext_noop("Specify time-to-live in seconds for minimum TTL to send to clients."), NULL },
|
|
||||||
{ LOPT_MAXTTL, ARG_ONE, "<integer>", gettext_noop("Specify time-to-live in seconds for maximum TTL to send to clients."), NULL },
|
|
||||||
{ LOPT_MAXCTTL, ARG_ONE, "<integer>", gettext_noop("Specify time-to-live ceiling for cache."), NULL },
|
|
||||||
{ LOPT_MINCTTL, ARG_ONE, "<integer>", gettext_noop("Specify time-to-live floor for cache."), NULL },
|
|
||||||
@@ -3404,6 +3407,7 @@ static int one_opt(int option, char *arg
|
|
||||||
|
|
||||||
case 'T': /* --local-ttl */
|
|
||||||
case LOPT_NEGTTL: /* --neg-ttl */
|
|
||||||
+ case LOPT_MINTTL: /* --min-ttl */
|
|
||||||
case LOPT_MAXTTL: /* --max-ttl */
|
|
||||||
case LOPT_MINCTTL: /* --min-cache-ttl */
|
|
||||||
case LOPT_MAXCTTL: /* --max-cache-ttl */
|
|
||||||
@@ -3415,6 +3419,8 @@ static int one_opt(int option, char *arg
|
|
||||||
ret_err(gen_err);
|
|
||||||
else if (option == LOPT_NEGTTL)
|
|
||||||
daemon->neg_ttl = (unsigned long)ttl;
|
|
||||||
+ else if (option == LOPT_MINTTL)
|
|
||||||
+ daemon->min_ttl = (unsigned long)ttl;
|
|
||||||
else if (option == LOPT_MAXTTL)
|
|
||||||
daemon->max_ttl = (unsigned long)ttl;
|
|
||||||
else if (option == LOPT_MINCTTL)
|
|
||||||
--- a/src/rfc1035.c
|
|
||||||
+++ b/src/rfc1035.c
|
|
||||||
@@ -683,6 +683,7 @@ int extract_addresses(struct dns_header
|
|
||||||
for (j = 0; j < ntohs(header->ancount); j++)
|
|
||||||
{
|
|
||||||
int secflag = 0;
|
|
||||||
+ unsigned long mttl = 0;
|
|
||||||
if (!(res = extract_name(header, qlen, &p1, name, 0, 10)))
|
|
||||||
return 2; /* bad packet */
|
|
||||||
|
|
||||||
@@ -691,6 +692,14 @@ int extract_addresses(struct dns_header
|
|
||||||
GETLONG(attl, p1);
|
|
||||||
|
|
||||||
if ((daemon->max_ttl != 0) && (attl > daemon->max_ttl) && !is_sign)
|
|
||||||
+ {
|
|
||||||
+ mttl = daemon->max_ttl;
|
|
||||||
+ }
|
|
||||||
+ if ((daemon->min_ttl != 0) && (attl < daemon->min_ttl) && !is_sign)
|
|
||||||
+ {
|
|
||||||
+ mttl = daemon->min_ttl;
|
|
||||||
+ }
|
|
||||||
+ if (mttl != 0)
|
|
||||||
{
|
|
||||||
(p1) -= 4;
|
|
||||||
PUTLONG(daemon->max_ttl, p1);
|
|
||||||
@@ -798,6 +807,7 @@ int extract_addresses(struct dns_header
|
|
||||||
for (j = 0; j < ntohs(header->ancount); j++)
|
|
||||||
{
|
|
||||||
int secflag = 0;
|
|
||||||
+ unsigned long mttl = 0;
|
|
||||||
|
|
||||||
if (!(res = extract_name(header, qlen, &p1, name, 0, 10)))
|
|
||||||
return 2; /* bad packet */
|
|
||||||
@@ -806,6 +816,14 @@ int extract_addresses(struct dns_header
|
|
||||||
GETSHORT(aqclass, p1);
|
|
||||||
GETLONG(attl, p1);
|
|
||||||
if ((daemon->max_ttl != 0) && (attl > daemon->max_ttl) && !is_sign)
|
|
||||||
+ {
|
|
||||||
+ mttl = daemon->max_ttl;
|
|
||||||
+ }
|
|
||||||
+ if ((daemon->min_ttl != 0) && (attl < daemon->min_ttl) && !is_sign)
|
|
||||||
+ {
|
|
||||||
+ mttl = daemon->min_ttl;
|
|
||||||
+ }
|
|
||||||
+ if (mttl != 0)
|
|
||||||
{
|
|
||||||
(p1) -= 4;
|
|
||||||
PUTLONG(daemon->max_ttl, p1);
|
|
||||||
Loading…
Reference in New Issue
Block a user