mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-03 14:55:47 +00:00
Merge eb0496441f1636c216ff77cf3418fd365e6bae31 into 156cd53e7734407dc42e30af2f12cf6956cd9e24
This commit is contained in:
commit
5a366fbbd5
@ -11,6 +11,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
|
"golang.org/x/sys/unix"
|
||||||
"tailscale.com/types/logger"
|
"tailscale.com/types/logger"
|
||||||
"tailscale.com/version/distro"
|
"tailscale.com/version/distro"
|
||||||
)
|
)
|
||||||
@ -36,6 +37,14 @@ func diagnoseLinuxTUNFailure(tunName string, logf logger.Logf, createErr error)
|
|||||||
kernel := utsReleaseField(&un)
|
kernel := utsReleaseField(&un)
|
||||||
logf("Linux kernel version: %s", kernel)
|
logf("Linux kernel version: %s", kernel)
|
||||||
|
|
||||||
|
const dev = "/dev/net/tun"
|
||||||
|
// Check for read/write access to /dev/net/tun before the modprobe check because modprobe would almost always
|
||||||
|
// fail in containerized environments, see https://github.com/tailscale/tailscale/issues/14277
|
||||||
|
if err := unix.Access(dev, unix.O_RDWR); err != nil {
|
||||||
|
logf("tailscaled likely does not have read or write access to %q, access check failed with: %v", dev, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
modprobeOut, err := exec.Command("/sbin/modprobe", "tun").CombinedOutput()
|
modprobeOut, err := exec.Command("/sbin/modprobe", "tun").CombinedOutput()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
logf("'modprobe tun' successful")
|
logf("'modprobe tun' successful")
|
||||||
@ -45,7 +54,6 @@ func diagnoseLinuxTUNFailure(tunName string, logf logger.Logf, createErr error)
|
|||||||
//
|
//
|
||||||
// So if there's a problem at this point, it's
|
// So if there's a problem at this point, it's
|
||||||
// probably because /dev/net/tun doesn't exist.
|
// probably because /dev/net/tun doesn't exist.
|
||||||
const dev = "/dev/net/tun"
|
|
||||||
if fi, err := os.Stat(dev); err != nil {
|
if fi, err := os.Stat(dev); err != nil {
|
||||||
logf("tun module loaded in kernel, but %s does not exist", dev)
|
logf("tun module loaded in kernel, but %s does not exist", dev)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user