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:
6
nodes.go
6
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()
|
||||
if id, exists := n.macIndex[macKey]; exists {
|
||||
if _, nodeExists := n.nodes[id]; nodeExists {
|
||||
if targetID == -1 {
|
||||
targetID = id
|
||||
} else if id != targetID {
|
||||
n.mergeNodes(targetID, id)
|
||||
}
|
||||
} else {
|
||||
delete(n.macIndex, macKey)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user