mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-12 05:37:32 +00:00
all: illumos/solaris userspace only support
Updates #14565 Change-Id: I743148144938794db0a224873ce76c10dbe6fa5f Signed-off-by: Nahum Shalman <nahamu@gmail.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
6ddeae7556
commit
9373a1b902
@@ -63,6 +63,11 @@ func CheckIPForwarding(routes []netip.Prefix, state *netmon.State) (warn, err er
|
||||
switch runtime.GOOS {
|
||||
case "dragonfly", "freebsd", "netbsd", "openbsd":
|
||||
return fmt.Errorf("Subnet routing and exit nodes only work with additional manual configuration on %v, and is not currently officially supported.", runtime.GOOS), nil
|
||||
case "illumos", "solaris":
|
||||
_, err := ipForwardingEnabledSunOS(ipv4, "")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Couldn't check system's IP forwarding configuration, subnet routing/exit nodes may not work: %w%s", err, "")
|
||||
}
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
@@ -325,3 +330,24 @@ func reversePathFilterValueLinux(iface string) (int, error) {
|
||||
}
|
||||
return v, nil
|
||||
}
|
||||
|
||||
func ipForwardingEnabledSunOS(p protocol, iface string) (bool, error) {
|
||||
var proto string
|
||||
if p == ipv4 {
|
||||
proto = "ipv4"
|
||||
} else if p == ipv6 {
|
||||
proto = "ipv6"
|
||||
} else {
|
||||
return false, fmt.Errorf("unknown protocol")
|
||||
}
|
||||
|
||||
ipadmCmd := "\"ipadm show-prop " + proto + " -p forwarding -o CURRENT -c\""
|
||||
bs, err := exec.Command("ipadm", "show-prop", proto, "-p", "forwarding", "-o", "CURRENT", "-c").Output()
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("couldn't check %s (%v).\nSubnet routes won't work without IP forwarding.", ipadmCmd, err)
|
||||
}
|
||||
if string(bs) != "on\n" {
|
||||
return false, fmt.Errorf("IP forwarding is set to off. Subnet routes won't work. Try 'routeadm -u -e %s-forwarding'", proto)
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user