Skip to content

Commit

Permalink
node: allow VPN IP address attribution to fail
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmouchet committed Sep 28, 2021
1 parent 4b20509 commit d32d25a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/network/vpn.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"golang.org/x/sys/unix"
"golang.zx2c4.com/wireguard/wgctrl"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"log"
"net"
"time"
)
Expand Down Expand Up @@ -77,8 +78,14 @@ func AssignVPNIP(name string, ipv4 utils.IPWithMask, ipv6 utils.IPWithMask) {
}
}

check(netlink.AddrReplace(link, addr4))
check(netlink.AddrReplace(link, addr6))
err = netlink.AddrReplace(link, addr4)
if err != nil {
log.Printf("Failed to set IPv4 for link %s: %s\n", name, err)
}
err = netlink.AddrReplace(link, addr6)
if err != nil {
log.Printf("Failed to set IPv6 for link %s: %s\n", name, err)
}
}

func AddPeer(name string, peer v1alpha.VPNPeer) {
Expand Down

0 comments on commit d32d25a

Please sign in to comment.