My GSoC 2026 project is to implement udmabuf, which needs to pass
variable-length structures (flexible arrays) to the kernel. Neither FreeBSD's
native ioctl nor linuxkpi ioctl supports this well. Therefore, we plan to use
generic netlink, which natively supports flexible arrays.
The problem is that FreeBSD's netlink is asynchronous. It uses a taskqueue,
meaning the callback is not executed in the user's thread context. Because of
this, operations that depend on the user's process, such as translating an fd
to a file structure, cannot be implemented.
A similar issue was solved in Linux, see commit cd40b7d3983c
("[NET]: make netlink user -> kernel interface synchronious").
To solve this problem, this diff adds a sync path in nl_sosend and introduces
a new socket option NETLINK_SND_SYNC to turn it on.