Browse Source

Merge branch 'feature_v0.14.7_explicit_routes' of https://github.com/gravitl/netmaker into feature_v0.14.7_explicit_routes

afeiszli 3 years ago
parent
commit
95ac301b68
1 changed files with 6 additions and 0 deletions
  1. 6 0
      netclient/local/routes.go

+ 6 - 0
netclient/local/routes.go

@@ -34,6 +34,9 @@ func SetPeerRoutes(iface string, oldPeers map[string]bool, newPeers []wgtypes.Pe
 				delete(oldPeers, allowedIP.String())
 			}
 		}
+		if peer.Endpoint == nil {
+			continue
+		}
 		if hasRoute && !ncutils.IpIsPrivate(peer.Endpoint.IP) {
 			ipNet, err := ncutils.GetIPNetFromString(peer.Endpoint.IP.String())
 			if err != nil {
@@ -71,6 +74,9 @@ func SetCurrentPeerRoutes(iface, currentAddr string, peers []wgtypes.PeerConfig)
 		for _, allowedIP := range peer.AllowedIPs {
 			setRoute(iface, &allowedIP, currentAddr)
 		}
+		if peer.Endpoint == nil {
+			continue
+		}
 		if hasRoute && !ncutils.IpIsPrivate(peer.Endpoint.IP) {
 			ipNet, err := ncutils.GetIPNetFromString(peer.Endpoint.IP.String())
 			if err != nil {