Bug 264105 - net/wireguard-kmod: Breakage on HEAD since improvement in sbcreatecontrol() of sockbuf
Summary: net/wireguard-kmod: Breakage on HEAD since improvement in sbcreatecontrol() o...
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-05-20 18:04 UTC by Rainer Hurling
Modified: 2022-06-11 11:01 UTC (History)
6 users (show)

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


Attachments
patch to add 'M_WAITOK' argument (2.70 KB, patch)
2022-05-21 09:09 UTC, Rainer Hurling
no flags Details | Diff
Alternative patch, using #define for sbcreatecontrol_now() (3.45 KB, patch)
2022-05-26 13:11 UTC, Dimitry Andric
no flags Details | Diff
updated port patch (3.25 KB, patch)
2022-05-30 17:29 UTC, Gleb Smirnoff
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-05-20 18:04:16 UTC
Since sbcreatecontrol() in sockbuf was improved on HEAD [1], the build of the port net/wireguard-kmod is broken with:

cc  -O2 -pipe -fno-strict-aliasing -include compat.h  -Werror -D_KERNEL -DKLD_MODULE -nostdinc   -include /usr/ports/net/wireguard-kmod/work/wireguard-freebsd-0.0.20211105/src/opt_global.h -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-common  -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-prefix-map=./machine=/usr/src/sys/amd64/include -fdebug-prefix-map=./x86=/usr/src/sys/x86/include     -MD  -MF.depend.if_wg.o -MTif_wg.o -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error=tautological-compare -Wno-error=empty-body -Wno-error=parentheses-equality -Wno-error=unused-function -Wno-error=pointer-sign -Wno-error=shift-negative-value -Wno-address-of-packed-member -Wno-format-zero-length   -mno-aes -mno-avx  -std=iso9899:1999 -c if_wg.c -o if_wg.o
if_wg.c:900:18: error: too few arguments to function call, expected 5, have 4
                            IPPROTO_IP);
                                      ^
/usr/src/sys/sys/sockbuf.h:161:2: note: 'sbcreatecontrol' declared here
        sbcreatecontrol(const void *p, u_int size, int type, int level,
        ^
if_wg.c:906:20: error: too few arguments to function call, expected 5, have 4
                            IPPROTO_IPV6);
                                        ^
/usr/src/sys/sys/sockbuf.h:161:2: note: 'sbcreatecontrol' declared here
        sbcreatecontrol(const void *p, u_int size, int type, int level,
        ^


[1] https://freshbsd.org/freebsd/src/commit/6890b588141a8298fc8a63700aeeea4ba36ca3f9
Comment 1 Rainer Hurling freebsd_committer freebsd_triage 2022-05-20 19:50:43 UTC
In fact, the error already occurs with the previous commit in HEAD [2], so base commit 2e5bf7c [3] is the last one to build net/wireguard-kmod with.

[2] https://freshbsd.org/freebsd/src/commit/b46667c63eb7f126a56e23af1401d98d77b912e8
[3] https://freshbsd.org/freebsd/src/commit/2e5bf7c49fd2b6440ac49dbfe80d4384d3f645f1
Comment 2 Poul-Henning Kamp freebsd_committer freebsd_triage 2022-05-20 22:04:39 UTC
Adding an extra M_WAITOK argument under proper #ifdef seems to be the way to go.
Comment 3 Rainer Hurling freebsd_committer freebsd_triage 2022-05-21 09:09:26 UTC
Created attachment 234075 [details]
patch to add 'M_WAITOK' argument

A probably not so elegant patch, which works for me on HEAD.
Comment 4 Dimitry Andric freebsd_committer freebsd_triage 2022-05-26 13:11:15 UTC
Created attachment 234232 [details]
Alternative patch, using #define for sbcreatecontrol_now()

I've been using this alternative patch, which uses a #define at the top of if_wg.c to go "back" to the old declaration of sbcreatecontrol_now(). This seems a bit simpler to me, and might be palatable for upstream.

Talking of upstream, the kmod snapshot is ~6 months old now, isn't there any newer version?
Comment 5 Gleb Smirnoff freebsd_committer freebsd_triage 2022-05-30 17:29:58 UTC
Created attachment 234331 [details]
updated port patch

I'd suggest patch like Dimitry's but the opposite. Leave the function calls as in newer FreeBSD, but create a define for older FreeBSD.

Here is patch-if_wg.c
Comment 6 Marek Zarychta 2022-06-11 08:02:03 UTC
(In reply to Gleb Smirnoff from comment #5)
This worked for me. Thank you, Gleb.
Probably the others are working too, but the maintainer should choose one of them and apply since the port is still broken on CURRENT.
Comment 7 Bernhard Froehlich freebsd_committer freebsd_triage 2022-06-11 10:41:08 UTC
Upstream has created a similar patch which is part of the next snapshot coming soon.

https://git.zx2c4.com/wireguard-freebsd/commit/?id=c66627f1ea5b94925078bd972a5db648aebf90fe
Comment 8 Bernhard Froehlich freebsd_committer freebsd_triage 2022-06-11 11:01:36 UTC
Thanks all, update to 0.0.20220610 contains a fix for this build issue.

https://cgit.freebsd.org/ports/commit/?id=b44715d91b98beefed44294caf090243e3ee1214