From 6f62bbae7921452db4a7bb8e73e98abfe5db6ffd Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Thu, 13 May 2021 14:58:49 -0700 Subject: [PATCH] cmd/tailscale: make ping --until-direct require direct connection to exit 0 If --until-direct is set, the goal is to make a direct connection. If we failed at that, say so, and exit with an error. RELNOTE=tailscale ping --until-direct (the default) now exits with a non-zero exit code if no direct connection was established. Signed-off-by: Josh Bleecher Snyder --- cmd/tailscale/cli/ping.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/tailscale/cli/ping.go b/cmd/tailscale/cli/ping.go index 3f08cc138..25470aa69 100644 --- a/cmd/tailscale/cli/ping.go +++ b/cmd/tailscale/cli/ping.go @@ -139,6 +139,9 @@ func runPing(ctx context.Context, args []string) error { if !anyPong { return errors.New("no reply") } + if pingArgs.untilDirect { + return errors.New("direct connection not established") + } return nil } }