Do InvalidateRoutes when a forwarded packet updates a MAC cache entry
When we get a forwarded packet, we put its source MAC into the MAC cache, overriding any existing entry. But we could have a flow which says to forward packets destined to that MAC based on the old entry. Such a flow could be prolonged indefinitely by attempts to send to the MAC. This is obviously bad, so do InvalidateRoutes in such cases.
This commit is contained in:
1 parent
674c617c16
commit
d2dfb0d15d
2 files changed
+14
-6
No files matched your search
+2
-3
@@ -68,9 +68,8 @@ func (cache *MacCache) Add(mac net.HardwareAddr, peer *Peer) (bool, *Peer) {
|
||||
return cache.add(mac, peer, false)
|
||||
}
|
||||
|
||||
func (cache *MacCache) AddForced(mac net.HardwareAddr, peer *Peer) bool {
|
||||
newMac, _ := cache.add(mac, peer, true)
|
||||
return newMac
|
||||
func (cache *MacCache) AddForced(mac net.HardwareAddr, peer *Peer) (bool, *Peer) {
|
||||
return cache.add(mac, peer, true)
|
||||
}
|
||||
|
||||
func (cache *MacCache) Lookup(mac net.HardwareAddr) *Peer {
|
||||
|
||||
Reference in new issue
Block a user