Re: What is the proper way to handle the wireguard module now that it's part of the base system?

From: Ed Maste <emaste_at_freebsd.org>
Date: Wed, 12 Apr 2023 19:29:36 UTC
On Wed, 12 Apr 2023 at 11:28, Morgan Wesström
<freebsd-database@pp.dyndns.biz> wrote:
>
> I just upgraded to FreeBSD 13.2-RELEASE and made sure to deinstall the
> net/wireguard-kmod package before I rebooted. I had to force deinstall it since
> it's still a dependency to net/wireguard. No problems though - VPN-tunnel is up
> with the base kernel module and seems to be working just fine. A few questions
> though:
>
> 1) What happens if there are two identically named modules on the system - one
> in /boot/kernel and the other in /boot/modules? Which one gets priority and can
> this be controlled?

You can check the kern.module_path sysctl. By default it looks like
/boot/kernel (or whatever kernel you boot) comes before /boot/modules.
I think (but haven't checked) that everything would have been fine if
wireguard-kmod was still installed.

> 2) Depending on the answer to question 1, should I perhaps have left
> net/wireguard-kmod in place? If not, shouldn't there be a check in the Makefile
> for net/wireguard so it doesn't pull in net/wireguard-kmod as a dependency on
> FreeBSD 13.2?

net/wireguard/Makefile has:
RUN_DEPENDS+=   ${KMODDIR}/if_wg.ko:net/wireguard-kmod
so the package should have a dependency on net/wireguard-kmod iff
if_wg.ko is not present in the target FreeBSD version.