wgengine/router: explicitly detect and complain about busybox's ip.

Defensive programming against #368 in environments other than Docker,
e.g. if you try using Tailscale in Alpine Linux directly, sans
container.

Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
David Anderson 2020-05-10 23:53:02 +00:00 committed by Dave Anderson
parent e00b814a24
commit 21ac65d3da

View File

@ -391,6 +391,14 @@ func (r *linuxRouter) addBypassRule() error {
func (r *linuxRouter) delBypassRule() error { func (r *linuxRouter) delBypassRule() error {
out, err := exec.Command("ip", "rule", "list", "priority", "10000").CombinedOutput() out, err := exec.Command("ip", "rule", "list", "priority", "10000").CombinedOutput()
if err != nil { if err != nil {
// Busybox ships an `ip` binary that doesn't understand
// uncommon rules. Try to detect this explicitly, and steer
// the user towards the correct fix. See
// https://github.com/tailscale/tailscale/issues/368 for an
// example of this issue.
if bytes.Contains(out, []byte("ip: ignoring all arguments")) {
return errors.New("cannot list ip rules, `ip` appears to be the busybox implementation. Please install iproute2")
}
return fmt.Errorf("listing ip rules: %v\n%s", err, out) return fmt.Errorf("listing ip rules: %v\n%s", err, out)
} }
if len(out) == 0 { if len(out) == 0 {