dnsmasq: include latest patches
authorKevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Fri, 25 Feb 2022 10:54:40 +0000 (10:54 +0000)
committerPaul Spooren <mail@aparcar.org>
Fri, 4 Mar 2022 14:17:32 +0000 (15:17 +0100)
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
package/network/services/dnsmasq/patches/0001-Fix-missing-reverse-records-from-dynamic-host.patch [new file with mode: 0644]
package/network/services/dnsmasq/patches/0002-Fix-longjump-compiler-warnings.patch [new file with mode: 0644]
package/network/services/dnsmasq/patches/0003-Fix-memory-leak-when-DBUS-connection-fails.patch [new file with mode: 0644]

diff --git a/package/network/services/dnsmasq/patches/0001-Fix-missing-reverse-records-from-dynamic-host.patch b/package/network/services/dnsmasq/patches/0001-Fix-missing-reverse-records-from-dynamic-host.patch
new file mode 100644 (file)
index 0000000..d518a39
--- /dev/null
@@ -0,0 +1,35 @@
+From f4c87b504b444efb05892b8c7fc295e886f70789 Mon Sep 17 00:00:00 2001
+From: Simon Kelley <simon@thekelleys.org.uk>
+Date: Fri, 18 Feb 2022 20:53:56 +0000
+Subject: [PATCH 1/3] Fix missing reverse-records from --dynamic-host.
+
+Thanks to Sten Spans for spotting the bug.
+---
+ src/rfc1035.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/rfc1035.c b/src/rfc1035.c
+index 34eaf0a..60ef272 100644
+--- a/src/rfc1035.c
++++ b/src/rfc1035.c
+@@ -1597,7 +1597,7 @@ size_t answer_request(struct dns_header *header, char *limit, size_t qlen,
+                   
+                   if (addrlist)
+                     break;
+-                  else
++                  else if (!(intr->flags & INP4))
+                     while (intr->next && strcmp(intr->intr, intr->next->intr) == 0)
+                       intr = intr->next;
+                 }
+@@ -1612,7 +1612,7 @@ size_t answer_request(struct dns_header *header, char *limit, size_t qlen,
+                   
+                   if (addrlist)
+                     break;
+-                  else
++                  else if (!(intr->flags & INP6))
+                     while (intr->next && strcmp(intr->intr, intr->next->intr) == 0)
+                       intr = intr->next;
+                 }
+-- 
+2.34.1
+
diff --git a/package/network/services/dnsmasq/patches/0002-Fix-longjump-compiler-warnings.patch b/package/network/services/dnsmasq/patches/0002-Fix-longjump-compiler-warnings.patch
new file mode 100644 (file)
index 0000000..c595553
--- /dev/null
@@ -0,0 +1,112 @@
+From bb6f6bae0ba6a95f481485f9d74a89072f2c800c Mon Sep 17 00:00:00 2001
+From: Simon Kelley <simon@thekelleys.org.uk>
+Date: Tue, 22 Feb 2022 21:56:48 +0000
+Subject: [PATCH 2/3] Fix longjump() compiler warnings.
+
+---
+ src/option.c | 36 +++++++++++++++---------------------
+ 1 file changed, 15 insertions(+), 21 deletions(-)
+
+diff --git a/src/option.c b/src/option.c
+index d9dd6a3..c354ddf 100644
+--- a/src/option.c
++++ b/src/option.c
+@@ -4974,26 +4974,20 @@ err:
+   return 1;
+ }
+-static void read_file(char *file, FILE *f, int hard_opt)      
++static void read_file(char *file, FILE *f, int hard_opt, int from_script)     
+ {
+   volatile int lineno = 0;
+   char *buff = daemon->namebuff;
+   
+   while (fgets(buff, MAXDNAME, f))
+     {
+-      int white, i, script = 0;
++      int white, i;
+       volatile int option;
+       char *errmess, *p, *arg, *start;
+       size_t len;
+-      if (hard_opt == LOPT_CONF_SCRIPT)
+-      {
+-        hard_opt = 0;
+-        script = 1;
+-      }
+-      
+       option = (hard_opt == LOPT_REV_SERV) ? 0 : hard_opt;
+- 
++
+       /* Memory allocation failure longjmps here if mem_recover == 1 */ 
+       if (option != 0 || hard_opt == LOPT_REV_SERV)
+       {
+@@ -5001,7 +4995,7 @@ static void read_file(char *file, FILE *f, int hard_opt)
+           continue;
+         mem_recover = 1;
+       }
+-      
++
+       arg = NULL;
+       lineno++;
+       errmess = NULL;
+@@ -5107,7 +5101,7 @@ static void read_file(char *file, FILE *f, int hard_opt)
+         
+       if (errmess || !one_opt(option, arg, daemon->namebuff, _("error"), 0, hard_opt == LOPT_REV_SERV))
+       {
+-        if (script)
++        if (from_script)
+           sprintf(daemon->namebuff + strlen(daemon->namebuff), _(" in output from %s"), file);
+         else
+           sprintf(daemon->namebuff + strlen(daemon->namebuff), _(" at line %d of %s"), lineno, file);
+@@ -5153,8 +5147,14 @@ static int one_file(char *file, int hard_opt)
+       hard_opt = 0;
+       nofile_ok = 1;
+     }
+-  
+-  if (hard_opt == 0 && strcmp(file, "-") == 0)
++
++   if (hard_opt == LOPT_CONF_SCRIPT)
++     {
++       hard_opt = 0;
++       do_popen = 1;
++     }
++   
++   if (hard_opt == 0 && !do_popen && strcmp(file, "-") == 0)
+     {
+       if (read_stdin == 1)
+       return 1;
+@@ -5167,12 +5167,6 @@ static int one_file(char *file, int hard_opt)
+       /* ignore repeated files. */
+       struct stat statbuf;
+     
+-      if (hard_opt == LOPT_CONF_SCRIPT)
+-      {
+-        hard_opt = 0;
+-        do_popen = 1;
+-      }
+-      
+       if (hard_opt == 0 && stat(file, &statbuf) == 0)
+       {
+         struct fileread *r;
+@@ -5211,7 +5205,7 @@ static int one_file(char *file, int hard_opt)
+       } 
+     }
+   
+-  read_file(file, f, do_popen ? LOPT_CONF_SCRIPT : hard_opt);
++   read_file(file, f, hard_opt, do_popen);
+   if (do_popen)
+     {
+@@ -5365,7 +5359,7 @@ void read_servers_file(void)
+     }
+   
+   mark_servers(SERV_FROM_FILE);
+-  read_file(daemon->servers_file, f, LOPT_REV_SERV);
++  read_file(daemon->servers_file, f, LOPT_REV_SERV, 0);
+   fclose(f);
+   cleanup_servers();
+   check_servers(0);
+-- 
+2.34.1
+
diff --git a/package/network/services/dnsmasq/patches/0003-Fix-memory-leak-when-DBUS-connection-fails.patch b/package/network/services/dnsmasq/patches/0003-Fix-memory-leak-when-DBUS-connection-fails.patch
new file mode 100644 (file)
index 0000000..565c10a
--- /dev/null
@@ -0,0 +1,30 @@
+From c27cfeaa7b9bfa09b347f3f26390af39177190db Mon Sep 17 00:00:00 2001
+From: Simon Kelley <simon@thekelleys.org.uk>
+Date: Thu, 24 Feb 2022 23:18:54 +0000
+Subject: [PATCH 3/3] Fix memory leak when DBUS connection fails.
+
+---
+ src/dbus.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/src/dbus.c b/src/dbus.c
+index 0c55ea5..bf6b661 100644
+--- a/src/dbus.c
++++ b/src/dbus.c
+@@ -761,8 +761,11 @@ char *dbus_init(void)
+   dbus_error_init (&dbus_error);
+   if (!(connection = dbus_bus_get (DBUS_BUS_SYSTEM, &dbus_error)))
+-    return NULL;
+-    
++    {
++      dbus_error_free(&dbus_error);
++      return NULL;
++    }
++  
+   dbus_connection_set_exit_on_disconnect(connection, FALSE);
+   dbus_connection_set_watch_functions(connection, add_watch, remove_watch, 
+                                     NULL, NULL, NULL);
+-- 
+2.34.1
+