From eeccbccd08626fd968f849a86eac9d39ebd94f12 Mon Sep 17 00:00:00 2001 From: Todd Neal Date: Sun, 5 Dec 2021 20:26:38 -0600 Subject: [PATCH] support running in a FreeBSD jail Since devd apparently can't be made to work in a FreeBSD jail fall back to polling. Fixes tailscale#2858 Signed-off-by: Todd Neal --- wgengine/monitor/monitor_freebsd.go | 5 +++-- wgengine/monitor/polling.go | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/wgengine/monitor/monitor_freebsd.go b/wgengine/monitor/monitor_freebsd.go index 1230d56ff..7e0e8c258 100644 --- a/wgengine/monitor/monitor_freebsd.go +++ b/wgengine/monitor/monitor_freebsd.go @@ -25,10 +25,11 @@ type devdConn struct { conn net.Conn } -func newOSMon(logf logger.Logf, _ *Mon) (osMon, error) { +func newOSMon(logf logger.Logf, m *Mon) (osMon, error) { conn, err := net.Dial("unixpacket", "/var/run/devd.seqpacket.pipe") if err != nil { - return nil, fmt.Errorf("devd dial error: %v", err) + logf("devd dial error: %v, falling back to polling method", err) + return newPollingMon(logf, m) } return &devdConn{conn}, nil } diff --git a/wgengine/monitor/polling.go b/wgengine/monitor/polling.go index 2b2d6d99d..85f980ae7 100644 --- a/wgengine/monitor/polling.go +++ b/wgengine/monitor/polling.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !freebsd && !windows && !darwin -// +build !freebsd,!windows,!darwin +//go:build !windows && !darwin +// +build !windows,!darwin package monitor