Skip to content

netlink: create, move and modify links on FreeBSD - #10

Merged
ahze merged 1 commit into
mainfrom
feat/netlink-links-freebsd
Nov 13, 2026
Merged

ahze merged 1 commit into
mainfrom
feat/netlink-links-freebsd

Conversation

@ahze

@ahze ahze commented Nov 13, 2026

Copy link
Copy Markdown
Member

Found by running link operations against a VNET jail: FreeBSD has no
RTM_SETLINK (RTM_NEWLINK without NLM_F_CREATE modifies instead), its
strict mode rejects the header flags a link modification carries while
dumps filter fine without it, it reports errno positive, and
RTM_DELLINK takes an index, not a name.

So: link modifications go through one set_link helper that picks the
message type per OS; strict checking is only requested on Linux and the
FreeBSD socket shim drops it; netlink errors are normalized to the Linux
sign; del_link resolves a name to its index on FreeBSD. create_link
makes a bridge through the ioctl module and renames it, other kinds are
refused with a clear error, set_link_ns is SIOCSIFVNET and a set_mtu
helper joins the link setters. Linux paths are unchanged.

Signed-off-by: Michael Johnson buhnux@gmail.com

Found by running link operations against a VNET jail: FreeBSD has no
RTM_SETLINK (RTM_NEWLINK without NLM_F_CREATE modifies instead), its
strict mode rejects the header flags a link modification carries while
dumps filter fine without it, it reports errno positive, and
RTM_DELLINK takes an index, not a name.

So: link modifications go through one set_link helper that picks the
message type per OS; strict checking is only requested on Linux and the
FreeBSD socket shim drops it; netlink errors are normalized to the Linux
sign; del_link resolves a name to its index on FreeBSD. create_link
makes a bridge through the ioctl module and renames it, other kinds are
refused with a clear error, set_link_ns is SIOCSIFVNET and a set_mtu
helper joins the link setters. Linux paths are unchanged.

Signed-off-by: Michael Johnson <buhnux@gmail.com>
@ahze
ahze merged commit 611a4e3 into main Nov 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant