Files
Martin Minkus 16dacb0c50 wgengine/router/osrouter: don't destroy the FreeBSD tun from Close
freebsdRouter.Close ran "ifconfig tailscale0 destroy" while this process
still holds the tun open: the engine closes the router before the tun
device, and FreeBSD's tun(4) makes SIOCIFDESTROY sleep until the last
descriptor closes. tailscaled therefore deadlocks against its own child
ifconfig on every shutdown, and "service tailscaled restart" hangs
forever:

  51709  -  I   /usr/local/bin/tailscaled -port 41641 -tun tailscale0 ...
  52455  -  I   ifconfig tailscale0 destroy
  52403  1  I+  /bin/sh /usr/local/etc/rc.d/tailscaled restart

Do only the PF cleanup at Close time. The interface left behind at
process exit is destroyed by the next startup's cleanUp hook
(router.HookCleanUp), which exists for exactly that and runs when
nothing holds the device.

Updates #5573

Change-Id: I7b739d948718bfb460240d2c0dd74658fc40ac82
Signed-off-by: Martin Minkus <martin.minkus@sonic.com>
2026-09-03 12:40:44 -07:00
..