From 85fa1b0d616b27fd294316d66178730feae33680 Mon Sep 17 00:00:00 2001 From: Maisem Ali Date: Mon, 18 Oct 2021 13:09:51 -0400 Subject: [PATCH] wgengine: fail NewUserspaceEngine if wireguard device doesn't come up Just something I ran across while debugging an unrelated failure. This is not in response to any bug/issue. Signed-off-by: Maisem Ali --- wgengine/userspace.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wgengine/userspace.go b/wgengine/userspace.go index 0bb1e319b..79ca15d40 100644 --- a/wgengine/userspace.go +++ b/wgengine/userspace.go @@ -388,7 +388,9 @@ func NewUserspaceEngine(logf logger.Logf, conf Config) (_ Engine, reterr error) }() e.logf("Bringing wireguard device up...") - e.wgdev.Up() + if err := e.wgdev.Up(); err != nil { + return nil, fmt.Errorf("wgdev.Up(): %w", err) + } e.logf("Bringing router up...") if err := e.router.Up(); err != nil { return nil, err