[Dnsmasq-discuss] v2.91test1 compile failure on FreeBSD

Matthias Andree matthias.andree at gmx.de
Fri Dec 20 12:27:04 UTC 2024


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-bpf.c-Follow-callback-updates.patch
Type: text/x-patch
Size: 976 bytes
Desc: not available
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20241220/aad830ab/attachment.bin>


More information about the Dnsmasq-discuss mailing list