Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
MacCache.AddForced needs to return conflicting peer
Browse files Browse the repository at this point in the history
otherwise NetworkRouter.handleForwardedPacket fails to clear out the
now invalid flows.
  • Loading branch information
rade authored and brb committed Oct 19, 2016
1 parent ebfaf11 commit 17c8dc9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions router/mac_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,21 @@ func (cache *MacCache) add(mac net.HardwareAddr, peer *mesh.Peer, force bool) (b
return true, nil
}

var conflictPeer *mesh.Peer

if entry.peer != peer {
conflictPeer = entry.peer
if !force {
return false, entry.peer
return false, conflictPeer
}

entry.peer = peer
}

if now.After(entry.lastSeen.Add(cache.maxAge / 10)) {
entry.lastSeen = now
}

return false, nil
return false, conflictPeer
}

func (cache *MacCache) Add(mac net.HardwareAddr, peer *mesh.Peer) (bool, *mesh.Peer) {
Expand Down

0 comments on commit 17c8dc9

Please sign in to comment.