avoid downing non-existent iface

This commit is contained in:
Leo Antunes 2019-03-27 22:48:54 +01:00
parent 0165b7a504
commit 856150866e
1 changed files with 3 additions and 0 deletions

View File

@ -84,6 +84,9 @@ func (wg *wgState) writeConf(nodes []node) error {
} }
func (wg *wgState) downInterface() 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() return exec.Command("wg-quick", "down", wg.iface).Run()
} }