wgengine/router{windows}: return the output from the firewallTweaker

on error.

While debugging a customer issue where the firewallTweaker was failing
the only message we have is `router: firewall: error adding
Tailscale-Process rule: exit status 1` which is not really helpful.
This will help diagnose firewall tweaking failures.

Signed-off-by: Maisem Ali <maisem@tailscale.com>
(cherry picked from commit d24a8f7b5a)
This commit is contained in:
Maisem Ali 2021-12-13 09:45:09 -08:00 committed by Brad Fitzpatrick
parent 7dd677043d
commit 7d6407a632

View File

@ -183,7 +183,10 @@ func (ft *firewallTweaker) runFirewall(args ...string) (time.Duration, error) {
args = append([]string{"advfirewall", "firewall"}, args...) args = append([]string{"advfirewall", "firewall"}, args...)
cmd := exec.Command("netsh", args...) cmd := exec.Command("netsh", args...)
cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true} cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
err := cmd.Run() b, err := cmd.CombinedOutput()
if err != nil {
err = fmt.Errorf("%w: %v", err, string(b))
}
return time.Since(t0).Round(time.Millisecond), err return time.Since(t0).Round(time.Millisecond), err
} }