Simon,
I cannot compile v2.91test1 on FreeBSD 14.2, errors below. (Neither
tarball nor Git compile.) (2nd to last shown errors). Patch attached,
should be fine with git-am.
Adding multiple unions with variable size into some other aggregate
(union or struct) isn't portable, first shown warning below, might be an
error on other or strictly set compilers. This needs fixing not covered
by my patch.
./dnsmasq.h:1128:25: warning: field 'server' with variable sized type
'union all_addr' not at the end of a struct or class is a GNU extension
[-Wgnu-variable-sized-type-not-at-end]
1128 | union all_addr local, server;
| ^
bpf.c:94:40: warning: incompatible pointer types passing 'struct in_addr
*' to parameter of type 'char *' [-Wincompatible-pointer-types]
94 | if (!callback.af_unspec(AF_INET, &sin2->sin_addr,
LLADDR(sdl), sdl->sdl_alen, parm))
| ^~~~~~~~~~~~~~~
bpf.c:103:5: error: conflicting types for 'iface_enumerate'
103 | int iface_enumerate(int family, void *parm, int (*callback)())
| ^
./dnsmasq.h:1672:5: note: previous declaration is here
1672 | int iface_enumerate(int family, void *parm, callback_t callback);
| ^
bpf.c:110:41: error: member reference base type 'int (*)()' is not a
structure or union
110 | return arp_enumerate(parm, callback.af_unspec);
| ~~~~~~~~^~~~~~~~~~
bpf.c:150:21: error: member reference base type 'int (*)()' is not a
structure or union
150 | if (!callback.af_inet(addr, iface_index, NULL,
netmask, broadcast, parm))
| ~~~~~~~~^~~~~~~~
bpf.c:215:21: error: member reference base type 'int (*)()' is not a
structure or union
215 | if (!callback.af_inet6(addr, prefix, scope_id,
iface_index, flags,
| ~~~~~~~~^~~~~~~~~
bpf.c:226:14: error: member reference base type 'int (*)()' is not a
structure or union
226 | !callback.af_local(iface_index, ARPHRD_ETHER,
LLADDR(sdl), sdl->sdl_alen, parm))
| ~~~~~~~~^~~~~~~~~
9 warnings and 5 errors generated.
From 355acd8963abcfee1ae4d78c81103f68d2577f24 Mon Sep 17 00:00:00 2001
From: Matthias Andree <matthias.and...@gmx.de>
Date: Fri, 20 Dec 2024 13:25:38 +0100
Subject: [PATCH] bpf.c: Follow callback updates.
---
src/bpf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/bpf.c b/src/bpf.c
index 82d0125..83ee31d 100644
--- a/src/bpf.c
+++ b/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
--
2.47.1
_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss