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.