From d32d25aec246fdc3413a775d962873e57e9995bb Mon Sep 17 00:00:00 2001 From: Maxime Mouchet Date: Tue, 28 Sep 2021 13:08:07 +0200 Subject: [PATCH] node: allow VPN IP address attribution to fail --- pkg/network/vpn.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkg/network/vpn.go b/pkg/network/vpn.go index 158ac12..a890fba 100644 --- a/pkg/network/vpn.go +++ b/pkg/network/vpn.go @@ -23,6 +23,7 @@ import ( "golang.org/x/sys/unix" "golang.zx2c4.com/wireguard/wgctrl" "golang.zx2c4.com/wireguard/wgctrl/wgtypes" + "log" "net" "time" ) @@ -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) {