From 75eb5963577a2bdb3fefa403f70ec4e7ebf30a57 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Tue, 20 Feb 2024 22:16:53 +0800 Subject: [PATCH] dnsmasq: remove outdated min-ttl patch Signed-off-by: Tianling Shen (cherry picked from commit 8e1fbfe312f16b1a51c0548cd1e697ce481dda83) --- .../network/services/dnsmasq/files/dhcp.conf | 2 +- .../services/dnsmasq/files/dnsmasq.init | 1 - .../dnsmasq/patches/910-mini-ttl.patch | 102 ------------------ 3 files changed, 1 insertion(+), 104 deletions(-) delete mode 100644 package/network/services/dnsmasq/patches/910-mini-ttl.patch diff --git a/package/network/services/dnsmasq/files/dhcp.conf b/package/network/services/dnsmasq/files/dhcp.conf index 58e9e076b3..a6223ead69 100644 --- a/package/network/services/dnsmasq/files/dhcp.conf +++ b/package/network/services/dnsmasq/files/dhcp.conf @@ -24,7 +24,7 @@ config dnsmasq option filter_a 0 option filter_aaaa 0 option cachesize 8000 - option mini_ttl 3600 + option min_cache_ttl 3600 option dns_redirect 1 option ednspacket_max 1232 option filter_aaaa 0 diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init index c64701c6b3..2b454a3038 100755 --- a/package/network/services/dnsmasq/files/dnsmasq.init +++ b/package/network/services/dnsmasq/files/dnsmasq.init @@ -967,7 +967,6 @@ dnsmasq_start() append_bool "$cfg" filter_a "--filter-A" append_bool "$cfg" filter_aaaa "--filter-AAAA" - append_parm "$cfg" mini_ttl "--min-ttl" append_parm "$cfg" logfacility "--log-facility" config_get logfacility "$cfg" "logfacility" diff --git a/package/network/services/dnsmasq/patches/910-mini-ttl.patch b/package/network/services/dnsmasq/patches/910-mini-ttl.patch deleted file mode 100644 index 25cd44ca21..0000000000 --- a/package/network/services/dnsmasq/patches/910-mini-ttl.patch +++ /dev/null @@ -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, "", gettext_noop("Specify default target in an MX record."), NULL }, - { 'T', ARG_ONE, "", gettext_noop("Specify time-to-live in seconds for replies from /etc/hosts."), NULL }, - { LOPT_NEGTTL, ARG_ONE, "", gettext_noop("Specify time-to-live in seconds for negative caching."), NULL }, -+ { LOPT_MINTTL, ARG_ONE, "", gettext_noop("Specify time-to-live in seconds for minimum TTL to send to clients."), NULL }, - { LOPT_MAXTTL, ARG_ONE, "", gettext_noop("Specify time-to-live in seconds for maximum TTL to send to clients."), NULL }, - { LOPT_MAXCTTL, ARG_ONE, "", gettext_noop("Specify time-to-live ceiling for cache."), NULL }, - { LOPT_MINCTTL, ARG_ONE, "", 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);