net/tstun: diagnose /dev/net/tun fd leak, give better failure message

Updates #5029

Change-Id: Ibee5e0c9076fe764eb5d856d5ef8b09f4d0e2921
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2022-07-16 14:10:20 -07:00
committed by Brad Fitzpatrick
parent 931f18b575
commit 0d52674a84
4 changed files with 17 additions and 6 deletions

View File

@@ -17,7 +17,7 @@ func init() {
tunDiagnoseFailure = diagnoseDarwinTUNFailure
}
func diagnoseDarwinTUNFailure(tunName string, logf logger.Logf) {
func diagnoseDarwinTUNFailure(tunName string, logf logger.Logf, err error) {
if os.Getuid() != 0 {
logf("failed to create TUN device as non-root user; use 'sudo tailscaled', or run under launchd with 'sudo tailscaled install-system-daemon'")
}