diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile index 61185cdfc..2e841a534 100644 --- a/package/network/services/dnsmasq/Makefile +++ b/package/network/services/dnsmasq/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dnsmasq PKG_VERSION:=2.80 -PKG_RELEASE:=9 +PKG_RELEASE:=12 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init index 18d66e135..59874a5c7 100644 --- a/package/network/services/dnsmasq/files/dnsmasq.init +++ b/package/network/services/dnsmasq/files/dnsmasq.init @@ -832,6 +832,8 @@ dnsmasq_start() append_bool "$cfg" filter_aaaa "--filter-aaaa" append_parm "$cfg" logfacility "--log-facility" + + append_parm "$cfg" mini_ttl "--min-ttl" append_parm "$cfg" cachesize "--cache-size" append_parm "$cfg" dnsforwardmax "--dns-forward-max" diff --git a/package/network/services/dnsmasq/patches/999-filter-aaaa.patch b/package/network/services/dnsmasq/patches/900-filter-aaaa.patch similarity index 100% rename from package/network/services/dnsmasq/patches/999-filter-aaaa.patch rename to package/network/services/dnsmasq/patches/900-filter-aaaa.patch diff --git a/package/network/services/dnsmasq/patches/910-mini-ttl.patch b/package/network/services/dnsmasq/patches/910-mini-ttl.patch new file mode 100644 index 000000000..84fce3b8d --- /dev/null +++ b/package/network/services/dnsmasq/patches/910-mini-ttl.patch @@ -0,0 +1,108 @@ +diff --git a/src/dnsmasq.h b/src/dnsmasq.h +--- a/src/dnsmasq.h 2018-10-19 02:21:55.000000000 +0800 ++++ b/src/dnsmasq.h 2020-01-13 10:38:16.940067371 +0800 +@@ -1017,7 +1017,7 @@ + int max_logs; /* queue limit */ + 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; + struct hostsfile *addn_hosts; + struct dhcp_context *dhcp, *dhcp6; +diff --git a/src/option.c b/src/option.c +--- a/src/option.c 2018-10-19 02:21:55.000000000 +0800 ++++ b/src/option.c 2020-01-13 17:21:13.925164926 +0800 +@@ -106,6 +106,7 @@ + #define LOPT_PROXY 295 + #define LOPT_GEN_NAMES 296 + #define LOPT_MAXTTL 297 ++#define LOPT_MINTTL 397 + #define LOPT_NO_REBIND 298 + #define LOPT_LOC_REBND 299 + #define LOPT_ADD_MAC 300 +@@ -282,6 +283,7 @@ + { "dhcp-broadcast", 2, 0, LOPT_BROADCAST }, + { "neg-ttl", 1, 0, LOPT_NEGTTL }, + { "max-ttl", 1, 0, LOPT_MAXTTL }, ++ { "min-ttl", 1, 0, LOPT_MINTTL }, + { "min-cache-ttl", 1, 0, LOPT_MINCTTL }, + { "max-cache-ttl", 1, 0, LOPT_MAXCTTL }, + { "dhcp-alternate-port", 2, 0, LOPT_ALTPORT }, +@@ -411,6 +413,7 @@ + { '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_MAXTTL, ARG_ONE, "", gettext_noop("Specify time-to-live in seconds for maximum TTL to send to clients."), NULL }, ++ { LOPT_MINTTL, ARG_ONE, "", gettext_noop("Specify time-to-live in seconds for minimum 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 }, + { 'u', ARG_ONE, "", gettext_noop("Change to this user after startup. (defaults to %s)."), CHUSER }, +@@ -2747,6 +2750,7 @@ + case 'T': /* --local-ttl */ + case LOPT_NEGTTL: /* --neg-ttl */ + case LOPT_MAXTTL: /* --max-ttl */ ++ case LOPT_MINTTL: /* --min-ttl */ + case LOPT_MINCTTL: /* --min-cache-ttl */ + case LOPT_MAXCTTL: /* --max-cache-ttl */ + case LOPT_AUTHTTL: /* --auth-ttl */ +@@ -2759,6 +2763,8 @@ + daemon->neg_ttl = (unsigned long)ttl; + else if (option == LOPT_MAXTTL) + daemon->max_ttl = (unsigned long)ttl; ++ else if (option == LOPT_MINTTL) ++ daemon->min_ttl = (unsigned long)ttl; + else if (option == LOPT_MINCTTL) + { + if (ttl > TTL_FLOOR_LIMIT) +diff --git a/src/rfc1035.c b/src/rfc1035.c +--- a/src/rfc1035.c 2018-10-19 02:21:55.000000000 +0800 ++++ b/src/rfc1035.c 2020-01-13 17:12:25.455445871 +0800 +@@ -664,11 +664,20 @@ + GETSHORT(aqtype, p1); + GETSHORT(aqclass, p1); + GETLONG(attl, p1); ++ unsigned long mttl = 0; + if ((daemon->max_ttl != 0) && (attl > daemon->max_ttl) && !is_sign) + { +- (p1) -= 4; +- PUTLONG(daemon->max_ttl, p1); +- } ++ 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(mttl, p1); ++ } + GETSHORT(ardlen, p1); + endrr = p1+ardlen; + +@@ -755,11 +764,20 @@ + GETSHORT(aqtype, p1); + GETSHORT(aqclass, p1); + GETLONG(attl, p1); ++ unsigned long mttl = 0; + if ((daemon->max_ttl != 0) && (attl > daemon->max_ttl) && !is_sign) +- { +- (p1) -= 4; +- PUTLONG(daemon->max_ttl, p1); +- } ++ { ++ 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(mttl, p1); ++ } + GETSHORT(ardlen, p1); + endrr = p1+ardlen; +