diff options
author | Yichen Wang <yicwang@cisco.com> | 2018-08-16 15:48:57 -0700 |
---|---|---|
committer | Yichen Wang <yicwang@cisco.com> | 2018-08-16 19:58:00 -0700 |
commit | 540ee758f07696cfc5f35127dd11dfcd103ebd50 (patch) | |
tree | 2b881b43606f962a1f9d8467e833d1338114faeb /pkg | |
parent | f0b724878360618dd0a950364709b048486771b6 (diff) |
pkg/server: handleUpdate() should not inject echo route from RR
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/server/peer.go | 18 | ||||
-rw-r--r-- | pkg/server/server.go | 15 |
2 files changed, 18 insertions, 15 deletions
diff --git a/pkg/server/peer.go b/pkg/server/peer.go index c125a5ba..1f67fd48 100644 --- a/pkg/server/peer.go +++ b/pkg/server/peer.go @@ -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) diff --git a/pkg/server/server.go b/pkg/server/server.go index 356ebf23..c4177ab0 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -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 } |