From 2b73d241b605628243dfd3a7d509e23b0dca1f3a Mon Sep 17 00:00:00 2001 From: Tim Beatham Date: Thu, 4 Jan 2024 22:29:30 +0000 Subject: [PATCH] 81-serparate-procs - nil dereference again --- pkg/ctrlserver/ctrlserver.go | 2 +- pkg/mesh/config.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/ctrlserver/ctrlserver.go b/pkg/ctrlserver/ctrlserver.go index bbe94ff..cdd25bb 100644 --- a/pkg/ctrlserver/ctrlserver.go +++ b/pkg/ctrlserver/ctrlserver.go @@ -107,7 +107,7 @@ func NewCtrlServer(params *NewCtrlServerParams) (*MeshCtrlServer, error) { logging.Log.WriteErrorf(err.Error()) } - return err + return nil }, 1) heartbeatTimer := lib.NewTimer(func() error { diff --git a/pkg/mesh/config.go b/pkg/mesh/config.go index b1d3406..2d42a7d 100644 --- a/pkg/mesh/config.go +++ b/pkg/mesh/config.go @@ -234,8 +234,8 @@ func (m *WgMeshConfigApplyer) getClientConfig(params *GetConfigParams) (*wgtypes routesForMesh := lib.Map(lib.MapValues(params.routes), func(rns []routeNode) []routeNode { return lib.Filter(rns, func(rn routeNode) bool { - _, ipNet, _ := net.ParseCIDR(rn.gateway) - return meshNet.Contains(ipNet.IP) || ipNet.Contains(meshNet.IP) + node, err := params.mesh.GetNode(rn.gateway) + return node != nil && err == nil }) })