Skip to content

net/netutil: check actual IP forwarding sysctls on FreeBSD - #20732

Draft
mminkus wants to merge 1 commit into
tailscale:mainfrom
mminkus:martin/freebsd-ip-forward
Draft

net/netutil: check actual IP forwarding sysctls on FreeBSD#20732
mminkus wants to merge 1 commit into
tailscale:mainfrom
mminkus:martin/freebsd-ip-forward

Conversation

@mminkus

@mminkus mminkus commented Aug 3, 2026

Copy link
Copy Markdown

On FreeBSD, CheckIPForwarding currently returns "IP forwarding is not supported on this OS" regardless of the machine's actual configuration, so a FreeBSD subnet router with forwarding correctly enabled still reports an unhealthy state, and one with forwarding disabled gets no warning that its subnet routes will not work.

Read the real sysctls instead:

  • net.inet.ip.forwarding for IPv4
  • net.inet6.ip6.forwarding for IPv6

and report only on the address families the node actually advertises routes for, matching the existing Linux behavior.

Tests cover the protocol-selection logic and the no-routes case.

Split out per @bradfitz's request in #19312. This is independent of the rest of that work -- it applies to main as-is and does not depend on the FreeBSD native-routing branch.

CheckIPForwarding unconditionally returned a "not currently officially
supported" warning on FreeBSD without ever reading the forwarding
sysctls. Subnet routers on FreeBSD therefore got a spurious "IP
forwarding is disabled" health warning and admin console banner even
with net.inet.ip.forwarding=1 and net.inet6.ip6.forwarding=1 set.

Read the sysctls instead, and only warn for the protocols actually
required by the advertised routes. FreeBSD has no per-interface
forwarding knob, so only the global sysctls are checked.

dragonfly, netbsd and openbsd keep the previous unsupported warning.

Updates tailscale#5573

Signed-off-by: Martin Minkus <[email protected]>
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