From 8522911524b97e170e457e63e70905ef22da645a Mon Sep 17 00:00:00 2001 From: Matthew R Kasun Date: Wed, 2 Feb 2022 16:35:37 -0500 Subject: [PATCH] check for unique mac address on node creation --- controllers/node_grpc.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/controllers/node_grpc.go b/controllers/node_grpc.go index ac47e5d6..1969f9c1 100644 --- a/controllers/node_grpc.go +++ b/controllers/node_grpc.go @@ -6,6 +6,7 @@ import ( "errors" "time" + "github.com/gravitl/netmaker/functions" nodepb "github.com/gravitl/netmaker/grpc" "github.com/gravitl/netmaker/logger" "github.com/gravitl/netmaker/logic" @@ -68,6 +69,10 @@ func (s *NodeServiceServer) CreateNode(ctx context.Context, req *nodepb.Object) return nil, errors.New("invalid key, and network does not allow no-key signups") } } + unique, _ := functions.IsMacAddressUnique(node.MacAddress, node.Network) + if !unique { + return nil, errors.New("macaddress is not unique") + } getServerAddrs(&node)