From c8c27e8ce05cb0e118a6c7aa85d87de9c9787bad Mon Sep 17 00:00:00 2001 From: Callan Bryant Date: Fri, 30 Oct 2020 12:34:35 +0000 Subject: [PATCH] add IPv6 to interface --- up.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/up.go b/up.go index 8824f7b..89ad419 100644 --- a/up.go +++ b/up.go @@ -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)