pkg/server: handleUpdate() should not inject echo route from RR

This commit is contained in:
Yichen Wang
2018-08-16 19:58:00 -07:00
parent f0b7248783
commit 540ee758f0
2 changed files with 18 additions and 15 deletions
+18
View File
@@ -491,6 +491,24 @@ func (peer *Peer) handleUpdate(e *FsmMsg) ([]*table.Path, []bgp.RouteFamily, *bg
continue
}
}
// RFC4456 8. Avoiding Routing Information Loops
// A router that recognizes the ORIGINATOR_ID attribute SHOULD
// ignore a route received with its BGP Identifier as the ORIGINATOR_ID.
peer.fsm.lock.RLock()
isIBGPPeer := peer.isIBGPPeer()
routerId := peer.fsm.gConf.Config.RouterId
peer.fsm.lock.RUnlock()
if isIBGPPeer {
if id := path.GetOriginatorID(); routerId == id.String() {
log.WithFields(log.Fields{
"Topic": "Peer",
"Key": peer.ID(),
"OriginatorID": id,
"Data": path,
}).Debug("Originator ID is mine, ignore")
continue
}
}
paths = append(paths, path)
}
peer.adjRibIn.Update(e.PathList)
-15
View File
@@ -423,21 +423,6 @@ func filterpath(peer *Peer, path, old *table.Path) *table.Path {
if info.AS != peer.AS() {
ignore = false
}
// RFC4456 8. Avoiding Routing Information Loops
// A router that recognizes the ORIGINATOR_ID attribute SHOULD
// ignore a route received with its BGP Identifier as the ORIGINATOR_ID.
peer.fsm.lock.RLock()
routerId := peer.fsm.gConf.Config.RouterId
peer.fsm.lock.RUnlock()
if id := path.GetOriginatorID(); routerId == id.String() {
log.WithFields(log.Fields{
"Topic": "Peer",
"Key": peer.ID(),
"OriginatorID": id,
"Data": path,
}).Debug("Originator ID is mine, ignore")
return nil
}
if info.RouteReflectorClient {
ignore = false
}