garypang13 4 years ago
parent
commit
c81555357f

+ 2 - 0
devices/common/diy.sh

@@ -14,6 +14,8 @@ wget -O target/linux/generic/pending-5.4/601-add-kernel-imq-support.patch https:
 rm -rf package/network/services/ppp package/libs/libnfnetlink
 svn co https://github.com/openwrt/openwrt/trunk/package/network/services/ppp package/network/services/ppp
 svn co https://github.com/openwrt/openwrt/trunk/package/libs/libnfnetlink package/libs/libnfnetlink
+rm -rf package/network/services/dnsmasq
+svn co https://github.com/immortalwrt/immortalwrt/branches/master/package/network/services/dnsmasq package/network/services/dnsmasq
 sed -i "s/'class': 'table'/'class': 'table memory'/g" package/*/*/luci-mod-status/htdocs/luci-static/resources/view/status/include/20_memory.js
 sed -i 's/+acme\( \|$\)/+acme +acme-dnsapi\1/g' package/*/*/luci-app-acme/Makefile
 sed -i '$a /etc/sysupgrade.conf' package/base-files/files/lib/upgrade/keep.d/base-files-essential

+ 0 - 102
devices/common/diy/package/network/services/dnsmasq/patches/910-mini-ttl.patch

@@ -1,102 +0,0 @@
---- a/src/dnsmasq.h
-+++ b/src/dnsmasq.h
-@@ -1042,7 +1042,7 @@ extern struct daemon {
-   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;
---- a/src/option.c
-+++ b/src/option.c
-@@ -168,6 +168,7 @@ struct myoption {
- #define LOPT_SINGLE_PORT   359
- #define LOPT_SCRIPT_TIME   360
- #define LOPT_PXE_VENDOR    361
-+#define LOPT_MINTTL        362
-  
- #ifdef HAVE_GETOPT_LONG
- static const struct option opts[] =  
-@@ -286,6 +287,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 },
-@@ -413,6 +415,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 },
-@@ -2823,6 +2826,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
-       
-     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 */
-@@ -2834,6 +2838,8 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
- 	  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
-@@ -606,6 +606,7 @@ int extract_addresses(struct dns_header *header, size_t qlen, char *name, time_t
- 	      for (j = 0; j < ntohs(header->ancount); j++) 
- 		{
- 		  int secflag = 0;
-+		  unsigned long mttl = 0;
- 		  unsigned char *tmp = namep;
- 		  /* the loop body overwrites the original name, so get it back here. */
- 		  if (!extract_name(header, qlen, &tmp, name, 1, 0) ||
-@@ -616,6 +617,14 @@ int extract_addresses(struct dns_header *header, size_t qlen, char *name, time_t
- 		  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);
-@@ -704,6 +713,7 @@ int extract_addresses(struct dns_header *header, size_t qlen, char *name, time_t
- 	  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 0; /* bad packet */
-@@ -712,6 +722,14 @@ int extract_addresses(struct dns_header *header, size_t qlen, char *name, time_t
- 	      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);

+ 0 - 68
devices/common/diy/package/network/services/dnsmasq/patches/911-dnsmasq-filter-aaaa.patch

@@ -1,68 +0,0 @@
-From 966471712184cfb3b067f2ae8dad9d8e2a896cae Mon Sep 17 00:00:00 2001
-From: Bearice Ren <[email protected]>
-Date: Tue, 20 Sep 2016 11:52:08 +0800
-Subject: [PATCH] add filter-aaaa option
-
----
- src/dnsmasq.h | 3 ++-
- src/option.c  | 3 +++
- src/rfc1035.c | 9 +++++++++
- 3 files changed, 14 insertions(+), 1 deletion(-)
-
---- a/src/dnsmasq.h
-+++ b/src/dnsmasq.h
-@@ -269,7 +269,8 @@
- #define OPT_IGNORE_CLID    59
- #define OPT_SINGLE_PORT    60
- #define OPT_LEASE_RENEW    61
--#define OPT_LAST           62
-+#define OPT_FILTER_AAAA    62
-+#define OPT_LAST           63
- 
- #define OPTION_BITS (sizeof(unsigned int)*8)
- #define OPTION_SIZE ( (OPT_LAST/OPTION_BITS)+((OPT_LAST%OPTION_BITS)!=0) )
---- a/src/option.c
-+++ b/src/option.c
-@@ -169,6 +169,7 @@ struct myoption {
- #define LOPT_SCRIPT_TIME   360
- #define LOPT_PXE_VENDOR    361
- #define LOPT_MINTTL        362
-+#define LOPT_FILTER_AAAA   363
-  
- #ifdef HAVE_GETOPT_LONG
- static const struct option opts[] =  
-@@ -343,6 +344,7 @@ static const struct myoption opts[] =
-     { "dumpfile", 1, 0, LOPT_DUMPFILE },
-     { "dumpmask", 1, 0, LOPT_DUMPMASK },
-     { "dhcp-ignore-clid", 0, 0,  LOPT_IGNORE_CLID },
-+    { "filter-aaaa", 0, 0, LOPT_FILTER_AAAA },
-     { NULL, 0, 0, 0 }
-   };
- 
-@@ -524,6 +526,7 @@ static struct {
-   { LOPT_DUMPFILE, ARG_ONE, "<path>", gettext_noop("Path to debug packet dump file"), NULL },
-   { LOPT_DUMPMASK, ARG_ONE, "<hex>", gettext_noop("Mask which packets to dump"), NULL },
-   { LOPT_SCRIPT_TIME, OPT_LEASE_RENEW, NULL, gettext_noop("Call dhcp-script when lease expiry changes."), NULL },
-+  { LOPT_FILTER_AAAA, OPT_FILTER_AAAA, NULL, gettext_noop("Filter all AAAA requests."), NULL },
-   { 0, 0, NULL, NULL, NULL }
- }; 
- 
---- a/src/rfc1035.c
-+++ b/src/rfc1035.c
-@@ -1926,6 +1926,16 @@ size_t answer_request(struct dns_header *header, char *limit, size_t qlen,
- 	    }
- 	}
- 
-+      /* patch to filter aaaa forwards */
-+      if (qtype == T_AAAA && option_bool(OPT_FILTER_AAAA))
-+        {
-+          /* return a null reply */
-+          ans = 1;
-+          if (!dryrun)
-+            log_query(F_CONFIG | F_IPV6 | F_NEG, name, &addr, NULL);
-+          break;
-+        }
-+
-       if (!ans)
- 	return 0; /* failed to answer a question */
-     }