forked from extern/smegmesh
74-perform-dad
- Fixing nil pointer dereference
This commit is contained in:
parent
90cfe820d2
commit
d0b1913796
@ -288,12 +288,12 @@ func (s *MeshManagerImpl) AddSelf(params *AddSelfParams) error {
|
||||
|
||||
collisionCount := uint8(0)
|
||||
|
||||
var nodeIP *net.IPNet
|
||||
var nodeIP net.IP
|
||||
|
||||
// Perform Duplicate Address Detection with the nodes
|
||||
// that are already in the network
|
||||
for {
|
||||
nodeIP, err := s.ipAllocator.GetIP(pubKey, params.MeshId, collisionCount)
|
||||
generatedIP, err := s.ipAllocator.GetIP(pubKey, params.MeshId, collisionCount)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
@ -313,13 +313,14 @@ func (s *MeshManagerImpl) AddSelf(params *AddSelfParams) error {
|
||||
if lib.Contains(lib.MapValues(snapshot.GetNodes()), proposition) {
|
||||
collisionCount++
|
||||
} else {
|
||||
nodeIP = generatedIP
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
node := s.nodeFactory.Build(&MeshNodeFactoryParams{
|
||||
PublicKey: &pubKey,
|
||||
NodeIP: nodeIP.IP,
|
||||
NodeIP: nodeIP,
|
||||
WgPort: params.WgPort,
|
||||
Endpoint: params.Endpoint,
|
||||
MeshConfig: mesh.GetConfiguration(),
|
||||
|
Loading…
Reference in New Issue
Block a user