add IPv6 to interface

This commit is contained in:
Callan Bryant 2020-10-30 12:34:35 +00:00
parent 227ed206a4
commit c8c27e8ce0
No known key found for this signature in database
GPG Key ID: C31FA9DF3ACBFFAA

12
up.go
View File

@ -38,6 +38,18 @@ func CreateLink(conf *DsnetConfig) {
ExitFail("Could not add addr %s to interface %s", addr.IP, err)
}
addr6 := &netlink.Addr{
IPNet: &net.IPNet{
IP: conf.IP6,
Mask: conf.Network6.IPNet.Mask,
},
}
err = netlink.AddrAdd(link, addr6)
if err != nil {
ExitFail("Could not add addr %s to interface %s", addr.IP, err)
}
// bring up interface (UNKNOWN state instead of UP, a wireguard quirk)
err = netlink.LinkSetUp(link)