git: 592a171c6a63 - main - dns/dnsmasq-devel: update to v2.91test2 plus warning fixes

From: Matthias Andree <mandree_at_FreeBSD.org>
Date: Sun, 29 Dec 2024 21:10:59 UTC
The branch main has been updated by mandree:

URL: https://cgit.FreeBSD.org/ports/commit/?id=592a171c6a63a22b9962ab75e8c49dd972af2786

commit 592a171c6a63a22b9962ab75e8c49dd972af2786
Author:     Matthias Andree <mandree@FreeBSD.org>
AuthorDate: 2024-12-22 10:48:13 +0000
Commit:     Matthias Andree <mandree@FreeBSD.org>
CommitDate: 2024-12-29 21:10:25 +0000

    dns/dnsmasq-devel: update to v2.91test2 plus warning fixes
    
    I am also adding a set of fixes I've also sent upstream,
    to make this compile without GNU extensions under -pedantic-errors.
    
    Upstream Git history since test1, author Simon Kelley unless stated
    otherwise.
    
    * 0f437b3 2024-12-20 | Banish compiler warnings. (tag: v2.91test2, origin/master, origin/HEAD)
    * 8a5fe8c 2024-12-20 | Extend the code to effciently close unwanted file descriptors to *BSD.
    * 2a664c0 2024-12-20 | bpf.c: Follow callback updates. [Matthias Andree]
    * 4902807 2024-12-20 | Fix [-Wgnu-variable-sized-type-not-at-end] warning.
    * 742af6e 2024-12-20 | Refactor receive_query() to removed duplicated code.
    * 3eb008c 2024-12-19 | Further refactoring of the TCP DNS codepath.
    * 32248eb 2024-12-19 | Fix thinko in 3b74df4f55b1107b051183d6b628eb02933cb00a
---
 dns/dnsmasq-devel/Makefile                    |  2 +-
 dns/dnsmasq-devel/distinfo                    |  6 +-
 dns/dnsmasq-devel/files/patch-bpf.c           | 19 -------
 dns/dnsmasq-devel/files/patch-src_arp.c       | 11 ++++
 dns/dnsmasq-devel/files/patch-src_blockdata.c | 11 ++++
 dns/dnsmasq-devel/files/patch-src_dnsmasq.h   | 20 +++++++
 dns/dnsmasq-devel/files/patch-src_edns0.c     | 11 ++++
 dns/dnsmasq-devel/files/patch-src_forward.c   | 11 ++++
 dns/dnsmasq-devel/files/patch-src_loop.c      | 11 ++++
 dns/dnsmasq-devel/files/patch-src_network.c   | 11 ++++
 dns/dnsmasq-devel/files/patch-src_outpacket.c | 52 ++++++++++++++++++
 dns/dnsmasq-devel/files/patch-src_rfc3315.c   | 79 +++++++++++++++++++++++++++
 dns/dnsmasq-devel/files/patch-src_util.c      | 11 ++++
 13 files changed, 232 insertions(+), 23 deletions(-)

diff --git a/dns/dnsmasq-devel/Makefile b/dns/dnsmasq-devel/Makefile
index fae20417cefa..01f6b54c8000 100644
--- a/dns/dnsmasq-devel/Makefile
+++ b/dns/dnsmasq-devel/Makefile
@@ -1,5 +1,5 @@
 PORTNAME=	dnsmasq
-DISTVERSION=	2.91test1 # remember to bump PORTEPOCH when going from test to rc!
+DISTVERSION=	2.91test2 # remember to bump PORTEPOCH when going from test to rc!
 # Leave the PORTREVISION in even if 0 to avoid accidental PORTEPOCH bumps:
 PORTREVISION=	0
 PORTEPOCH=	5
diff --git a/dns/dnsmasq-devel/distinfo b/dns/dnsmasq-devel/distinfo
index d83bf3e06fb4..225d87b8396c 100644
--- a/dns/dnsmasq-devel/distinfo
+++ b/dns/dnsmasq-devel/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1734696522
-SHA256 (dnsmasq-2.91test1.tar.xz) = 8687368b8e8632ffdc2e19a83197ac4aca703cb002e55fc8ac4017dbdc9d87ec
-SIZE (dnsmasq-2.91test1.tar.xz) = 570964
+TIMESTAMP = 1734864288
+SHA256 (dnsmasq-2.91test2.tar.xz) = a91d83b4507a5bce35daa95cf21506781501bbfa8750636423079a8dd1d45c32
+SIZE (dnsmasq-2.91test2.tar.xz) = 570940
diff --git a/dns/dnsmasq-devel/files/patch-bpf.c b/dns/dnsmasq-devel/files/patch-bpf.c
deleted file mode 100644
index 9f2082b5b0ac..000000000000
--- a/dns/dnsmasq-devel/files/patch-bpf.c
+++ /dev/null
@@ -1,19 +0,0 @@
---- src/bpf.c.orig	2024-12-19 00:36:42 UTC
-+++ src/bpf.c
-@@ -100,14 +100,14 @@ int arp_enumerate(void *parm, callback_t callback)
- #endif /* defined(HAVE_BSD_NETWORK) && !defined(__APPLE__) */
- 
- 
--int iface_enumerate(int family, void *parm, int (*callback)())
-+int iface_enumerate(int family, void *parm, callback_t callback)
- {
-   struct ifaddrs *head, *addrs;
-   int errsave, fd = -1, ret = 0;
- 
-   if (family == AF_UNSPEC)
- #if defined(HAVE_BSD_NETWORK) && !defined(__APPLE__)
--    return  arp_enumerate(parm, callback.af_unspec);
-+    return  arp_enumerate(parm, callback);
- #else
-   return 0; /* need code for Solaris and MacOS*/
- #endif
diff --git a/dns/dnsmasq-devel/files/patch-src_arp.c b/dns/dnsmasq-devel/files/patch-src_arp.c
new file mode 100644
index 000000000000..bfdedbfa1d6f
--- /dev/null
+++ b/dns/dnsmasq-devel/files/patch-src_arp.c
@@ -0,0 +1,11 @@
+--- src/arp.c.orig	2024-12-20 21:57:21 UTC
++++ src/arp.c
+@@ -35,7 +35,7 @@ static time_t last = 0;
+ static struct arp_record *arps = NULL, *old = NULL, *freelist = NULL;
+ static time_t last = 0;
+ 
+-static int filter_mac(int family, char *addrp, char *mac, size_t maclen, void *parmv)
++static int filter_mac(int family, void *addrp, char *mac, size_t maclen, void *parmv)
+ {
+   struct arp_record *arp;
+ 
diff --git a/dns/dnsmasq-devel/files/patch-src_blockdata.c b/dns/dnsmasq-devel/files/patch-src_blockdata.c
new file mode 100644
index 000000000000..4c60efc7a2b5
--- /dev/null
+++ b/dns/dnsmasq-devel/files/patch-src_blockdata.c
@@ -0,0 +1,11 @@
+--- src/blockdata.c.orig	2024-12-20 21:57:21 UTC
++++ src/blockdata.c
+@@ -193,7 +193,7 @@ void *blockdata_retrieve(struct blockdata *block, size
+ {
+   size_t blen;
+   struct  blockdata *b;
+-  void *new, *d;
++  uint8_t *new, *d;
+   
+   static unsigned int buff_len = 0;
+   static unsigned char *buff = NULL;
diff --git a/dns/dnsmasq-devel/files/patch-src_dnsmasq.h b/dns/dnsmasq-devel/files/patch-src_dnsmasq.h
new file mode 100644
index 000000000000..6e03d92098e6
--- /dev/null
+++ b/dns/dnsmasq-devel/files/patch-src_dnsmasq.h
@@ -0,0 +1,20 @@
+--- src/dnsmasq.h.orig	2024-12-20 21:57:21 UTC
++++ src/dnsmasq.h
+@@ -339,7 +339,7 @@ union all_addr {
+   struct datablock {
+     unsigned short rrtype;
+     unsigned char datalen; /* also length of SOA in negative records. */
+-    char data[];
++    char data[1];
+   } rrdata;
+ };
+ 
+@@ -1667,7 +1667,7 @@ typedef union {
+ 
+ /* bpf.c or netlink.c */
+ typedef union {
+-	int (*af_unspec)(int family, char *addrp, char *mac, size_t maclen, void *parmv);
++	int (*af_unspec)(int family, void *addrp, char *mac, size_t maclen, void *parmv);
+ 	int (*af_inet)(struct in_addr local, int if_index, char *label, struct in_addr netmask, struct in_addr broadcast, void *vparam);
+ 	int (*af_inet6)(struct in6_addr *local, int prefix, int scope, int if_index, int flags, unsigned int preferred, unsigned int valid, void *vparam);
+ 	int (*af_local)(int index, unsigned int type, char *mac, size_t maclen, void *parm);
diff --git a/dns/dnsmasq-devel/files/patch-src_edns0.c b/dns/dnsmasq-devel/files/patch-src_edns0.c
new file mode 100644
index 000000000000..31b72a560d1f
--- /dev/null
+++ b/dns/dnsmasq-devel/files/patch-src_edns0.c
@@ -0,0 +1,11 @@
+--- src/edns0.c.orig	2024-12-20 21:57:21 UTC
++++ src/edns0.c
+@@ -491,7 +491,7 @@ static size_t add_umbrella_opt(struct dns_header *head
+ {
+   *cacheable = 0;
+ 
+-  struct umbrella_opt opt = {{"ODNS"}, UMBRELLA_VERSION, 0, {}};
++  struct umbrella_opt opt = {{"ODNS"}, UMBRELLA_VERSION, 0, {0}};
+   u8 *u = &opt.fields[0];
+   int family = source->sa.sa_family;
+   int size = family == AF_INET ? INADDRSZ : IN6ADDRSZ;
diff --git a/dns/dnsmasq-devel/files/patch-src_forward.c b/dns/dnsmasq-devel/files/patch-src_forward.c
new file mode 100644
index 000000000000..ba9671d8c8b4
--- /dev/null
+++ b/dns/dnsmasq-devel/files/patch-src_forward.c
@@ -0,0 +1,11 @@
+--- src/forward.c.orig	2024-12-20 21:57:21 UTC
++++ src/forward.c
+@@ -3054,7 +3054,7 @@ static struct frec *lookup_frec(char *target, int clas
+ }
+ 
+ /* Send query packet again, if we can. */
+-void resend_query()
++void resend_query(void)
+ {
+   if (daemon->srv_save)
+     server_send(daemon->srv_save, daemon->fd_save,
diff --git a/dns/dnsmasq-devel/files/patch-src_loop.c b/dns/dnsmasq-devel/files/patch-src_loop.c
new file mode 100644
index 000000000000..f071e430b996
--- /dev/null
+++ b/dns/dnsmasq-devel/files/patch-src_loop.c
@@ -0,0 +1,11 @@
+--- src/loop.c.orig	2024-12-20 21:57:21 UTC
++++ src/loop.c
+@@ -19,7 +19,7 @@ static ssize_t loop_make_probe(u32 uid);
+ #ifdef HAVE_LOOP
+ static ssize_t loop_make_probe(u32 uid);
+ 
+-void loop_send_probes()
++void loop_send_probes(void)
+ {
+    struct server *serv;
+    struct randfd_list *rfds = NULL;
diff --git a/dns/dnsmasq-devel/files/patch-src_network.c b/dns/dnsmasq-devel/files/patch-src_network.c
new file mode 100644
index 000000000000..2aa5a005df7b
--- /dev/null
+++ b/dns/dnsmasq-devel/files/patch-src_network.c
@@ -0,0 +1,11 @@
+--- src/network.c.orig	2024-12-20 21:57:21 UTC
++++ src/network.c
+@@ -647,7 +647,7 @@ static int iface_allowed_v4(struct in_addr local, int 
+ /*
+  * Clean old interfaces no longer found.
+  */
+-static void clean_interfaces()
++static void clean_interfaces(void)
+ {
+   struct irec *iface;
+   struct irec **up = &daemon->interfaces;
diff --git a/dns/dnsmasq-devel/files/patch-src_outpacket.c b/dns/dnsmasq-devel/files/patch-src_outpacket.c
new file mode 100644
index 000000000000..f491fd1052b5
--- /dev/null
+++ b/dns/dnsmasq-devel/files/patch-src_outpacket.c
@@ -0,0 +1,52 @@
+--- src/outpacket.c.orig	2024-12-20 21:57:21 UTC
++++ src/outpacket.c
+@@ -23,7 +23,7 @@ void end_opt6(int container)
+ 
+ void end_opt6(int container)
+ {
+-   void *p = daemon->outpacket.iov_base + container + 2;
++   uint8_t *p = (uint8_t *)daemon->outpacket.iov_base + container + 2;
+    u16 len = outpacket_counter - container - 4 ;
+    
+    PUTSHORT(len, p);
+@@ -50,11 +50,11 @@ void *expand(size_t headroom)
+ 
+ void *expand(size_t headroom)
+ {
+-  void *ret;
++  uint8_t *ret;
+ 
+   if (expand_buf(&daemon->outpacket, outpacket_counter + headroom))
+     {
+-      ret = daemon->outpacket.iov_base + outpacket_counter;
++      ret = (uint8_t *)daemon->outpacket.iov_base + outpacket_counter;
+       outpacket_counter += headroom;
+       return ret;
+     }
+@@ -65,7 +65,7 @@ int new_opt6(int opt)
+ int new_opt6(int opt)
+ {
+   int ret = outpacket_counter;
+-  void *p;
++  unsigned char *p;
+ 
+   if ((p = expand(4)))
+     {
+@@ -88,7 +88,7 @@ void put_opt6_long(unsigned int val)
+   
+ void put_opt6_long(unsigned int val)
+ {
+-  void *p;
++  unsigned char *p;
+   
+   if ((p = expand(4)))  
+     PUTLONG(val, p);
+@@ -96,7 +96,7 @@ void put_opt6_short(unsigned int val)
+ 
+ void put_opt6_short(unsigned int val)
+ {
+-  void *p;
++  uint8_t *p;
+ 
+   if ((p = expand(2)))
+     PUTSHORT(val, p);   
diff --git a/dns/dnsmasq-devel/files/patch-src_rfc3315.c b/dns/dnsmasq-devel/files/patch-src_rfc3315.c
new file mode 100644
index 000000000000..27be9efa08d9
--- /dev/null
+++ b/dns/dnsmasq-devel/files/patch-src_rfc3315.c
@@ -0,0 +1,79 @@
+--- src/rfc3315.c.orig	2024-12-20 21:57:21 UTC
++++ src/rfc3315.c
+@@ -39,8 +39,8 @@ static void log6_quiet(struct state *state, char *type
+ static void log6_opts(int nest, unsigned int xid, void *start_opts, void *end_opts);
+ static void log6_packet(struct state *state, char *type, struct in6_addr *addr, char *string);
+ static void log6_quiet(struct state *state, char *type, struct in6_addr *addr, char *string);
+-static void *opt6_find (void *opts, void *end, unsigned int search, unsigned int minsize);
+-static void *opt6_next(void *opts, void *end);
++static void *opt6_find (uint8_t *opts, uint8_t *end, unsigned int search, unsigned int minsize);
++static void *opt6_next(uint8_t *opts, uint8_t *end);
+ static unsigned int opt6_uint(unsigned char *opt, int offset, int size);
+ static void get_context_tag(struct state *state, struct dhcp_context *context);
+ static int check_ia(struct state *state, void *opt, void **endp, void **ia_option);
+@@ -61,11 +61,11 @@ static void calculate_times(struct dhcp_context *conte
+ 
+ #define opt6_len(opt) ((int)(opt6_uint(opt, -2, 2)))
+ #define opt6_type(opt) (opt6_uint(opt, -4, 2))
+-#define opt6_ptr(opt, i) ((void *)&(((unsigned char *)(opt))[4+(i)]))
++#define opt6_ptr(opt, i) ((void *)&(((uint8_t *)(opt))[4+(i)]))
+ 
+-#define opt6_user_vendor_ptr(opt, i) ((void *)&(((unsigned char *)(opt))[2+(i)]))
++#define opt6_user_vendor_ptr(opt, i) ((void *)&(((uint8_t *)(opt))[2+(i)]))
+ #define opt6_user_vendor_len(opt) ((int)(opt6_uint(opt, -4, 2)))
+-#define opt6_user_vendor_next(opt, end) (opt6_next(((void *) opt) - 2, end))
++#define opt6_user_vendor_next(opt, end) (opt6_next(((uint8_t *) opt) - 2, end))
+  
+ 
+ unsigned short dhcp6_reply(struct dhcp_context *context, int interface, char *iface_name,
+@@ -107,11 +107,11 @@ static int dhcp6_maybe_relay(struct state *state, unsi
+ static int dhcp6_maybe_relay(struct state *state, unsigned char *inbuff, size_t sz, 
+ 			     struct in6_addr *client_addr, int is_unicast, time_t now)
+ {
+-  void *end = inbuff + sz;
+-  void *opts = inbuff + 34;
++  uint8_t *end = inbuff + sz;
++  uint8_t *opts = inbuff + 34;
+   int msg_type = *inbuff;
+   unsigned char *outmsgtypep;
+-  void *opt;
++  uint8_t *opt;
+   struct dhcp_vendor *vendor;
+ 
+   /* if not an encapsulated relayed message, just do the stuff */
+@@ -232,7 +232,7 @@ static int dhcp6_maybe_relay(struct state *state, unsi
+   
+   for (opt = opts; opt; opt = opt6_next(opt, end))
+     {
+-      if (opt6_ptr(opt, 0) + opt6_len(opt) > end) 
++      if ((uint8_t *)opt6_ptr(opt, 0) + opt6_len(opt) > end)
+         return 0;
+      
+       /* Don't copy MAC address into reply. */
+@@ -1307,7 +1307,7 @@ static int dhcp6_no_relay(struct state *state, int msg
+      reallocated. */
+   ((unsigned char *)(daemon->outpacket.iov_base))[start_msg] = outmsgtype;
+ 
+-  log6_opts(0, state->xid, daemon->outpacket.iov_base + start_opts, daemon->outpacket.iov_base + save_counter(-1));
++  log6_opts(0, state->xid, (uint8_t *)daemon->outpacket.iov_base + start_opts, (uint8_t *)daemon->outpacket.iov_base + save_counter(-1));
+   
+   return 1;
+ 
+@@ -2093,7 +2093,7 @@ static void log6_packet(struct state *state, char *typ
+ 	      string ? string : "");
+ }
+ 
+-static void *opt6_find (void *opts, void *end, unsigned int search, unsigned int minsize)
++static void *opt6_find (uint8_t *opts, uint8_t *end, unsigned int search, unsigned int minsize)
+ {
+   u16 opt, opt_len;
+   void *start;
+@@ -2120,7 +2120,7 @@ static void *opt6_find (void *opts, void *end, unsigne
+     }
+ }
+ 
+-static void *opt6_next(void *opts, void *end)
++static void *opt6_next(uint8_t *opts, uint8_t *end)
+ {
+   u16 opt_len;
+   
diff --git a/dns/dnsmasq-devel/files/patch-src_util.c b/dns/dnsmasq-devel/files/patch-src_util.c
new file mode 100644
index 000000000000..b2fbf3f8ef79
--- /dev/null
+++ b/dns/dnsmasq-devel/files/patch-src_util.c
@@ -0,0 +1,11 @@
+--- src/util.c.orig	2024-12-20 21:57:21 UTC
++++ src/util.c
+@@ -41,7 +41,7 @@ static int outleft = 0;
+ static u32 out[8];
+ static int outleft = 0;
+ 
+-void rand_init()
++void rand_init(void)
+ {
+   int fd = open(RANDFILE, O_RDONLY);
+