From 218ee302064088cdd5b2b89bf01fce29d2484612 Mon Sep 17 00:00:00 2001 From: Adam Chalmers Date: Fri, 4 Sep 2020 10:05:32 -0500 Subject: [PATCH] TUN-3377: Tunnel route should check dns/lb before checking tunnel ID --- cmd/cloudflared/tunnel/subcommands.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cmd/cloudflared/tunnel/subcommands.go b/cmd/cloudflared/tunnel/subcommands.go index a9fb1cae..f9792d15 100644 --- a/cmd/cloudflared/tunnel/subcommands.go +++ b/cmd/cloudflared/tunnel/subcommands.go @@ -412,20 +412,25 @@ func routeCommand(c *cli.Context) error { } const tunnelIDIndex = 1 - tunnelID, err := sc.findID(c.Args().Get(tunnelIDIndex)) - if err != nil { - return err - } routeType := c.Args().First() var r tunnelstore.Route + var tunnelID uuid.UUID switch routeType { case "dns": + tunnelID, err = sc.findID(c.Args().Get(tunnelIDIndex)) + if err != nil { + return err + } r, err = dnsRouteFromArg(c, tunnelID) if err != nil { return err } case "lb": + tunnelID, err = sc.findID(c.Args().Get(tunnelIDIndex)) + if err != nil { + return err + } r, err = lbRouteFromArg(c, tunnelID) if err != nil { return err