also bring iface up

This commit is contained in:
Callan Bryant 2020-03-04 21:09:12 +00:00
parent 862cc820bc
commit f4a41b5c42
No known key found for this signature in database
GPG Key ID: C31FA9DF3ACBFFAA

18
up.go
View File

@ -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)
}
}