From 856150866e7ddff5455ec576a4588fef8d6b8f6c Mon Sep 17 00:00:00 2001 From: Leo Antunes Date: Wed, 27 Mar 2019 22:48:54 +0100 Subject: [PATCH] avoid downing non-existent iface --- wireguard.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wireguard.go b/wireguard.go index 041ba4a..3ef2b5c 100644 --- a/wireguard.go +++ b/wireguard.go @@ -84,6 +84,9 @@ func (wg *wgState) writeConf(nodes []node) error { } func (wg *wgState) downInterface() error { + if err := exec.Command("wg", "show", wg.iface).Run(); err != nil { + return nil // assume a failure means the interface is not there + } return exec.Command("wg-quick", "down", wg.iface).Run() }