Hi, looks like a long due change switch to default on current: https://lists.freebsd.org/archives/freebsd-net/2024-November/005983.html --- VBoxNetFlt-freebsd.o --- VBoxNetFlt-freebsd.c:343:24: error: incomplete definition of type 'struct ifnet' 343 | VBOXCURVNET_SET(ifp->if_vnet); | ~~~^
Can you suggest a patch?
(In reply to Vladimir Druzenko from comment #1) As far as I have tried, #include <net/if_private.h> to the following two files, it seems to build and use them without any problem. ${WRKSRC}/src/VBox/HostDrivers/VBoxNetAdp/freebsd/VBoxNetAdp-freebsd.c ${WRKSRC}/src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c
(In reply to Ken DEGUCHI from comment #2) The current plan is to remove inclusion of if_private.h
(In reply to Olivier Cochard from comment #3) Okay, you told how not to do it. Can you tell how to do? :-D
(In reply to Vladimir Druzenko from comment #4) Yes because it is a lot more easy to tell how to not doing it :-) Following this announcement: https://lists.freebsd.org/archives/freebsd-net/2024-November/005983.html There is an helper script in instruction, but you need some coding skills which I don’t have. cd /usr/ports/emulators/virtualbox-ose-kmod/ make patch cd work/VirtualBox-6.1.50 /usr/src/tools/ifnet/convert_ifapi.sh ./src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c Conversion for ./src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c started, please wait: \ 7 lines could not be converted to IFAPI Look for /* XXX - IFAPI */ in the converted file And this is where my skillset end :-) I would start looking for all existing NIC drivers that were migrated by listing all commit with the name "IfAPI": https://cgit.freebsd.org/src/log/?qt=grep&q=IfAPI
The "easy" thing to do after running the script on the file is to check: * Any place you see foo->if_xxx = <N>, look for a if_setxxx in net/if_var.h. If something doesn't exist, there may be an equivalent, or a new API may be needed. * Any place you see N = foo->if_xxx, look for if_getxxx in net/if_var.h. Now, there will probably be cases where the script messed up the conversion, and you went from something like: xxx_ifp->if_mtu = 42; to: xxx_if_setmtu(ifp, 42); This needs cleaned up to: if_setmtu(xxx_ifp, 42); These above are the most common issues with the conversion script. If you still have issues after applying changes I listed here, please let me know, either filing a PR, or email (freebsd-net list, CC me). Since all in-tree drivers have been converted to IfAPI, the vast majority of use cases have been dealt with, and any new cases found are likely very special-case, so would be handled as needed.
Created attachment 255491 [details] ifnet.patch Mechanical conversion to new ifnet KPI
There may be more 'struct ifnet *' -> if_t conversion required but I am too lazy to do it
(In reply to Vladimir Kondratyev from comment #7) Thanks for doing the work, one comment, though: * You changed `struct ifnet *` to `if_t *`, but `if_t` is `struct ifnet *`, so `if_t *` is a pointer to a pointer now. You just want `if_t foo` instead.
Created attachment 255492 [details] ifnet.patch if_t * -> if_t
(In reply to Vladimir Kondratyev from comment #10) Looks good. Might want to make that patch conditional on the FreeBSD version in the port, though. If it's just supporting FreeBSD 14 and later, though, I think you can skip it, since almost everything has been in place since FreeBSD 14 was still -CURRENT.
It seems that 13-STABLE implements most or may be all of interfaces required by the patch. Someone running FreeBSD 13 should check that.
I can commit this patch, but I can't test it - I don't have hosts with 15-CURRENT. Now I can test build on 13.4 and 14.1 only. Run on 14.1. Update to 14.2 planned on NY holidays. Can anyone help with testing on 15-CURRENT?
(In reply to Vladimir Druzenko from comment #13) Worked for me. $ uname -srv FreeBSD 15.0-CURRENT FreeBSD 15.0-CURRENT #0 main-n274384-371a4ee9a384: Thu Dec 19 07:11:42 UTC 2024 root@releng3.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC $ VBoxManage --version 6.1.50r161033 John groenveld@acm.org
(In reply to groenveld from comment #14) Tested build and work emulators/virtualbox-ose-kmod on live system 14.1. Testing build in poudriere 13.4. I have to apply it to emulators/virtualbox-ose-kmod-legacy.
Error in 13.4: VBoxNetFlt-freebsd.c:343:5: error: incompatible integer to pointer conversion assigning to 'struct vnet *' from 'int' [-Wint-conversion] 343 | VBOXCURVNET_SET(if_getvnet(ifp)); | ^ ~~~~~~~~~~~~~~~ VBoxNetFlt-freebsd.c:451:5: error: incompatible integer to pointer conversion assigning to 'struct vnet *' from 'int' [-Wint-conversion] 451 | VBOXCURVNET_SET(if_getvnet(ifp)); | ^ ~~~~~~~~~~~~~~~
Created attachment 256112 [details] emulators/virtualbox-ose-legacy v1 Tested build on 13.4 and 14.1 amd64 (test build on i386 in progress). Need testing on recent 15-CURRENT. Patch for emulators/virtualbox-ose I'll create later.
Created attachment 256117 [details] emulators/virtualbox-ose-legacy v2 emulators/virtualbox-ose-kmod-legacy: tested build in poudriere 13.4 and 14.1, i386 and amd64. Need testing on recent 15-CURRENT.
Created attachment 256118 [details] emulators/virtualbox-ose v1 emulators/virtualbox-ose-kmod: tested build in poudriere 13.4 and 14.1 amd64. Need testing on recent 15-CURRENT.
(In reply to Vladimir Druzenko from comment #18) Worked for me. $ uname -srv FreeBSD 15.0-CURRENT FreeBSD 15.0-CURRENT #0 main-n274384-371a4ee9a384: Thu Dec 19 07:11:42 UTC 2024 root@releng3.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC $ VBoxManage --version 5.2.44r139111 John groenveld@acm.org
(In reply to Vladimir Druzenko from comment #19) This worked for me too...thank you! $ uname -srv FreeBSD 15.0-CURRENT FreeBSD 15.0-CURRENT #0 main-n274384-371a4ee9a384: Thu Dec 19 07:11:42 UTC 2024 root@releng3.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC $ VBoxManage --version 6.1.50r161033 John groenveld@acm.org
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=3528379355540d3fa2c7c1aee40963742016303a commit 3528379355540d3fa2c7c1aee40963742016303a Author: Vladimir Druzenko <vvd@FreeBSD.org> AuthorDate: 2024-12-25 09:48:45 +0000 Commit: Vladimir Druzenko <vvd@FreeBSD.org> CommitDate: 2024-12-25 09:48:45 +0000 emulators/virtualbox-ose-kmod-legacy: Fix build error since 1500027 (struct ifnet is now hidden) Based on patch from wulf. PR: 282780 Tested by: groenveld@acm.org ...Drivers-VBoxNetAdp-freebsd-VBoxNetAdp-freebsd.c | 137 ++++++++++++- ...Drivers_VBoxNetFlt_freebsd_VBoxNetFlt-freebsd.c | 215 ++++++++++++++++++--- 2 files changed, 326 insertions(+), 26 deletions(-)
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=1b244fbbf4d6340c647b5ee550347b0acb175f11 commit 1b244fbbf4d6340c647b5ee550347b0acb175f11 Author: Vladimir Druzenko <vvd@FreeBSD.org> AuthorDate: 2024-12-25 09:37:37 +0000 Commit: Vladimir Druzenko <vvd@FreeBSD.org> CommitDate: 2024-12-25 09:37:37 +0000 emulators/virtualbox-ose-kmod: Fix build error since 1500027 (struct ifnet is now hidden) Based on patch from wulf. PR: 282780 Tested by: groenveld@acm.org ...oxNetAdp_freebsd_VBoxNetAdp-freebsd.c.bak (new) | 147 +++++++++++++++ ...Drivers_VBoxNetFlt_freebsd_VBoxNetFlt-freebsd.c | 209 ++++++++++++++++++--- 2 files changed, 335 insertions(+), 21 deletions(-)
Thanks!
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=7481fae4ff18b9843153b41470ea1dc910c6c311 commit 7481fae4ff18b9843153b41470ea1dc910c6c311 Author: Vladimir Druzenko <vvd@FreeBSD.org> AuthorDate: 2025-01-04 18:30:10 +0000 Commit: Vladimir Druzenko <vvd@FreeBSD.org> CommitDate: 2025-01-04 18:30:10 +0000 emulators/virtualbox-ose: Rename patch from *.bak to * PR: 282780 Fixes: 1b244fbbf4d6 (Fix build error since 1500027 (struct ifnet is now hidden)) ...=> patch-src_VBox_HostDrivers_VBoxNetAdp_freebsd_VBoxNetAdp-freebsd.c} | 0 1 file changed, 0 insertions(+), 0 deletions(-)