mirror of
https://github.com/gravitl/netmaker.git
synced 2025-02-27 01:23:00 +08:00
check for unique mac address on node creation
This commit is contained in:
parent
147cc18be0
commit
8522911524
1 changed files with 5 additions and 0 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue