Skip to content

Commit

Permalink
add IPv6 to interface
Browse files Browse the repository at this point in the history
  • Loading branch information
naggie committed Oct 30, 2020
1 parent 227ed20 commit c8c27e8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions up.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit c8c27e8

Please sign in to comment.