Bug 266914 - net/wireguard-kmod: Build fails on HEAD since base commit bb77f0
Summary: net/wireguard-kmod: Build fails on HEAD since base commit bb77f0
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Bernhard Froehlich
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-09 09:30 UTC by Rainer Hurling
Modified: 2022-12-21 14:04 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (decke)


Attachments
Fixes the build error (845 bytes, patch)
2022-10-13 13:47 UTC, Stefan Haller
no flags Details | Diff
Fix with conditionals (1.08 KB, patch)
2022-11-09 09:04 UTC, Guido Falsi
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Hurling freebsd_committer freebsd_triage 2022-10-09 09:30:30 UTC
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
Comment 1 Rainer Hurling freebsd_committer freebsd_triage 2022-10-09 09:51:09 UTC
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
Comment 2 Stefan Haller 2022-10-13 13:47:29 UTC
Created attachment 237263 [details]
Fixes the build error
Comment 3 Stefan Haller 2022-10-13 13:50:37 UTC
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
Comment 4 Guido Falsi freebsd_committer freebsd_triage 2022-11-09 09:04:06 UTC
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.
Comment 5 Stefan Haller 2022-11-09 09:13:10 UTC
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.
Comment 6 Guido Falsi freebsd_committer freebsd_triage 2022-11-09 10:08:58 UTC
(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.
Comment 7 commit-hook freebsd_committer freebsd_triage 2022-12-21 14:02:24 UTC
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(+)
Comment 8 Bernhard Froehlich freebsd_committer freebsd_triage 2022-12-21 14:04:47 UTC
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.