when the kernel does not have 'options INET', wg(8) doesn't work: # uname -v FreeBSD 15.0-CURRENT #1 lf/main-n269054-1557b4dd4096: Tue Jun 18 02:22:42 BST 2024 srcmastr@daphne.eden.le-fay.org:/src/obj/src/freebsd/lf/main/arm64.aarch64/sys/LFV6 # wg Unable to list interfaces: Address family not supported by protocol family # truss: socket(PF_INET,SOCK_DGRAM,0) ERR#47 'Address family not supported by protocol family' issetugid() = 0 (0x0) fstatat(AT_FDCWD,"/usr/share/nls/C/libc.cat",0x4bf984865b90,0x0) ERR#2 'No such file or directory' fstatat(AT_FDCWD,"/usr/share/nls/libc/C",0x4bf984865b90,0x0) ERR#2 'No such file or directory' fstatat(AT_FDCWD,"/usr/local/share/nls/C/libc.cat",0x4bf984865b90,0x0) ERR#2 'No such file or directory' fstatat(AT_FDCWD,"/usr/local/share/nls/libc/C",0x4bf984865b90,0x0) ERR#2 'No such file or directory' Unable to list interfaces: Address family not supported by protocol family writev(2,[{"Unable to list interfaces",25},{": ",2},{"Address family not supported by "...,47},{"\n",1}],4) = 75 (0x4b)
How does this feel? diff --git a/contrib/wireguard-tools/ipc-freebsd.h b/contrib/wireguard-tools/ipc-freebsd.h index fa74edda5a3d..446f13cacac2 100644 --- a/contrib/wireguard-tools/ipc-freebsd.h +++ b/contrib/wireguard-tools/ipc-freebsd.h @@ -15,7 +15,7 @@ static int get_dgram_socket(void) { static int sock = -1; if (sock < 0) - sock = socket(AF_INET, SOCK_DGRAM, 0); + sock = socket(AF_LOCAL, SOCK_DGRAM, 0); return sock; }
From running `truss wg` on a system with IPv4 support in the kernel and a single unconfigured WireGuard interface it looks like the socket is used at least for the SIOCGIFGMEMB and SIOCGWG: ioctl(3,SIOCGIFGMEMB,0x1...) = 0 (0x0) ioctl(3,SIOCGIFGMEMB,0x1...) = 0 (0x0) ioctl(3,SIOCGWG,0x1...) = 0 (0x0) ioctl(3,SIOCGWG,0x1...) = 0 (0x0) Are those ioctl()s available on AF_UNIX and AF_INET6 sockets or only on AF_INET sockets?
(In reply to crest from comment #2) There's a patch in comment #1 that you're welcome to test.