merge nodes when update discovers mac belongs to different node
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
8
nodes.go
8
nodes.go
@@ -98,11 +98,15 @@ func (n *Nodes) Update(target *Node, mac net.HardwareAddr, ips []net.IP, ifaceNa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if targetID == -1 && mac != nil {
|
if mac != nil {
|
||||||
macKey := mac.String()
|
macKey := mac.String()
|
||||||
if id, exists := n.macIndex[macKey]; exists {
|
if id, exists := n.macIndex[macKey]; exists {
|
||||||
if _, nodeExists := n.nodes[id]; nodeExists {
|
if _, nodeExists := n.nodes[id]; nodeExists {
|
||||||
targetID = id
|
if targetID == -1 {
|
||||||
|
targetID = id
|
||||||
|
} else if id != targetID {
|
||||||
|
n.mergeNodes(targetID, id)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
delete(n.macIndex, macKey)
|
delete(n.macIndex, macKey)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user