From b8a5545a43014bb848a3f28aeca24772296996c6 Mon Sep 17 00:00:00 2001 From: Daniel Lundin Date: Wed, 2 Oct 2019 13:48:27 +0200 Subject: [PATCH] Properly set link up for wireguard interface --- server.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/server.go b/server.go index 337ba5e..530554f 100644 --- a/server.go +++ b/server.go @@ -134,8 +134,14 @@ func (s *Server) initInterface() error { return err } - log.Debug("Adding NAT / IP masquerading using nftables") + log.Debug("Bringing up wireguard device: ", *wgLinkName) + err = netlink.LinkSetUp(&link) + if err != nil { + log.Error("Error bringing up device: ", *wgLinkName) + return err + } + log.Debug("Adding NAT / IP masquerading using nftables") ns, err := netns.Get() if err != nil { return err @@ -279,7 +285,7 @@ func (s *Server) Start() error { return err } - err := s.initInterface() + err = s.initInterface() if err != nil { return err }