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

Commit

Permalink
don't drop captured packets from remote MAC
Browse files Browse the repository at this point in the history
We see such packets when a MAC that we previously saw at a remote peer
has been moved to ours. Dropping these packets cuts off network
connectivity for the new owner of the MAC.

Instead we update the MAC cache and flush the flows, to remove the now
incorrect entries for that MAC. And carry on as normal.
  • Loading branch information
rade committed Jul 10, 2016
1 parent c0c19fc commit a610fce
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions router/network_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,15 @@ func (router *NetworkRouter) handleCapturedPacket(key PacketKey) FlowOp {
srcMac := net.HardwareAddr(key.SrcMAC[:])
dstMac := net.HardwareAddr(key.DstMAC[:])

switch newSrcMac, conflictPeer := router.Macs.Add(srcMac, router.Ourself.Peer); {
switch newSrcMac, conflictPeer := router.Macs.AddForced(srcMac, router.Ourself.Peer); {
case newSrcMac:
log.Println("Discovered local MAC", srcMac)
log.Print("Discovered local MAC ", srcMac)
case conflictPeer != nil:
// The MAC cache has an entry for the source MAC
// associated with another peer. This probably means
// we are seeing a frame we injected ourself. That
// shouldn't happen, but discard it just in case.
log.Error("Captured frame from MAC (", srcMac, ") to (", dstMac, ") associated with another peer ", conflictPeer)
return DiscardingFlowOp{}
// The MAC cache has an entry for the source MAC associated
// with another peer. This can happen when a MAC has moved.
log.Print("Discovered local MAC ", srcMac, " (was at ", conflictPeer, ")")
// We need to clear out any flows with the MAC as the source.
router.Overlay.(NetworkOverlay).InvalidateRoutes()
}

// Discard STP broadcasts
Expand Down

0 comments on commit a610fce

Please sign in to comment.