mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-16 03:31:39 +00:00
net/netns: also don't err on tailscaled -fake as a regular user
That's one of my dev workflows.
This commit is contained in:
parent
7f68e097dd
commit
765695eaa2
@ -38,11 +38,22 @@ func control(network, address string, c syscall.RawConn) error {
|
|||||||
err := c.Control(func(fd uintptr) {
|
err := c.Control(func(fd uintptr) {
|
||||||
controlErr = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_MARK, tailscaleBypassMark)
|
controlErr = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_MARK, tailscaleBypassMark)
|
||||||
})
|
})
|
||||||
// Before returning some fatal error, see if we're just a regular user
|
// Before returning some fatal error, skip it in some cases.
|
||||||
// running cmd/tailscale (presumably netcheck) and ignore the error if so.
|
|
||||||
if (err != nil || controlErr != nil) && os.Getuid() != 0 {
|
if (err != nil || controlErr != nil) && os.Getuid() != 0 {
|
||||||
if v, _ := os.Executable(); filepath.Base(v) == "tailscale" {
|
v, _ := os.Executable()
|
||||||
return nil
|
switch filepath.Base(v) {
|
||||||
|
case "tailscale":
|
||||||
|
for _, arg := range os.Args {
|
||||||
|
if arg == "netcheck" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case "tailscaled":
|
||||||
|
for _, arg := range os.Args {
|
||||||
|
if arg == "-fake" || arg == "--fake" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user