check for unique mac address on node creation

This commit is contained in:
Matthew R Kasun 2022-02-02 16:35:37 -05:00
parent 147cc18be0
commit 8522911524

View file

@ -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)