From f4a41b5c42a7849fb890550d71198950a94a5133 Mon Sep 17 00:00:00 2001 From: Callan Bryant Date: Wed, 4 Mar 2020 21:09:12 +0000 Subject: [PATCH] also bring iface up --- up.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/up.go b/up.go index 13d51bd..236c449 100644 --- a/up.go +++ b/up.go @@ -24,7 +24,7 @@ func CreateInterface(conf *DsnetConfig) { err := netlink.LinkAdd(link) if err != nil { - ExitFail("Could not add interface '%s' (%v)", linkAttrs.Name, err) + ExitFail("Could not add interface '%s' (%v)", conf.InterfaceName, err) } addr := &netlink.Addr{ @@ -49,16 +49,16 @@ func CreateInterface(conf *DsnetConfig) { wg, err := wgctrl.New() check(err) - err = wg.ConfigureDevice(linkAttrs.Name, wgConfig) + err = wg.ConfigureDevice(conf.InterfaceName, wgConfig) if err != nil { - ExitFail("Could not configure device '%s' (%v)", linkAttrs.Name, err) + ExitFail("Could not configure device '%s' (%v)", conf.InterfaceName, err) } - // bring up interface (needs conf first) - //err = netlink.LinkSetUp(link) - // - //if err != nil { - // ExitFail("Could not bring up device '%s' (%v)", linkAttrs.Name, err) - //} + // bring up interface (UNKNOWN state, a wireguard thing) + err = netlink.LinkSetUp(link) + + if err != nil { + ExitFail("Could not bring up device '%s' (%v)", conf.InterfaceName, err) + } }