On a recent FreeBSD 14-0-CURRENT amd64 I get the following breakage, when I try to build net/wireguard-kmod: --- if_wg.o --- if_wg.c:696:37: error: used type 'udp_tun_func_t' (aka '_Bool (struct mbuf *, int, struct inpcb *, const struct sockaddr *, void *)') where arithmetic or pointer type is required rc = udp_set_kernel_tunneling(so4, (udp_tun_func_t)wg_input, NULL, sc); ^ ~~~~~~~~ if_wg.c:707:37: error: used type 'udp_tun_func_t' (aka '_Bool (struct mbuf *, int, struct inpcb *, const struct sockaddr *, void *)') where arithmetic or pointer type is required rc = udp_set_kernel_tunneling(so6, (udp_tun_func_t)wg_input, NULL, sc); ^ ~~~~~~~~ 2 errors generated. *** [if_wg.o] Error code 1 make[1]: stopped in /usr/ports/net/wireguard-kmod/work/wireguard-freebsd-0.0.20220615/src 1 error make[1]: stopped in /usr/ports/net/wireguard-kmod/work/wireguard-freebsd-0.0.20220615/src ===> Compilation failed unexpectedly. This seems to happen after removing some old code in base with commit c0fc81e [1]. Most likely net/wireguard-kmod has to follow these changes? Unfortunately I don't have the skills to propose a patch for this breakage, sorry. [1] https://freshbsd.org/freebsd/src/commit/c0fc81e9138b4bc636333285087f1c3e1c7bc1e5
I am afraid I gave a wrong commit in comment #0. It is more likely, that commit bb77f0 is the right one. Sorry for the misleading. [1] https://freshbsd.org/freebsd/src/commit/bb77f0c2049311f0661c2493838d81a5a66c449c
Created attachment 237263 [details] Fixes the build error
Due to the change of the typedef to a non-pointer type the type cast should now read "(*udp_tun_func_t)". However, simply removing the type cast is the best solution as it is not required anymore. With the attached patch the port builds successfully. This will most likely break older releases so it should get guarded by an appropriate #if __FreeBSD_version. The problem has already been reported upstream (no response yet): https://lists.zx2c4.com/pipermail/wireguard/2022-October/007843.html
Created attachment 237968 [details] Fix with conditionals Hi, I've added #if __FreeBSD_version conditionals to your patch. I could not find an exact __FreeBSD_version for the braking change, so I picked the nearest one, that also happens to not be documented in the porter's handbook unluckily. Hope this patch can help land the fix.
I just want to note: As wireguard has landed in FreeBSD 14-CURRENT (see <https://cgit.freebsd.org/src/tree/sys/dev/wg>) the port is not required anymore for this version.
(In reply to Stefan Haller from comment #5) Good point, I actually forgot. Technically the patch should be included anyway, but I agree it is of much minor importance now.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=17a45735bde9d35b8bbdf2c72145573d8b8abf09 commit 17a45735bde9d35b8bbdf2c72145573d8b8abf09 Author: Bernhard Froehlich <decke@FreeBSD.org> AuthorDate: 2022-12-21 14:00:26 +0000 Commit: Bernhard Froehlich <decke@FreeBSD.org> CommitDate: 2022-12-21 14:00:26 +0000 net/wireguard-kmod: Chase udp_tun_func_t typedef change in FreeBSD 14-current (bb77f0) PR: 266914 Submitted by: Stefan Haller <stefan+freebsd@stha.de>, Guido Falsi <madpilot@FreeBSD.org> net/wireguard-kmod/Makefile | 1 + net/wireguard-kmod/files/patch-if__wg.c (new) | 32 +++++++++++++++++++++++++++ 2 files changed, 33 insertions(+)
Sorry that it took me so long to integrate the patch and thanks to everyone contributing to the fix! Patch is not integrated upstream yet.