diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-04-23 16:41:45 -0700 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-04-27 16:00:54 +0900 |
commit | 738c350a6703e02e73992dd49ef0134cea22df0f (patch) | |
tree | 45daddaf55daf9668ddfd1a82f6df3714e3a0994 | |
parent | aa5a11501251da31a542553c0abcb81d5857b924 (diff) |
server: avoid unnecessary path clone with route server
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | server/peer.go | 3 | ||||
-rw-r--r-- | table/path.go | 6 |
2 files changed, 5 insertions, 4 deletions
diff --git a/server/peer.go b/server/peer.go index ed4d1ae4..cf9c183d 100644 --- a/server/peer.go +++ b/server/peer.go @@ -271,8 +271,7 @@ func (peer *Peer) filterpath(path, old *table.Path) *table.Path { return nil } - path = path.Clone(path.IsWithdraw) - path.UpdatePathAttrs(peer.fsm.gConf, peer.fsm.pConf, peer.fsm.peerInfo) + path = table.UpdatePathAttrs(peer.fsm.gConf, peer.fsm.pConf, peer.fsm.peerInfo, path) options := &table.PolicyOptions{ Info: peer.fsm.peerInfo, diff --git a/table/path.go b/table/path.go index b8db56a7..89c32a16 100644 --- a/table/path.go +++ b/table/path.go @@ -163,10 +163,11 @@ func cloneAsPath(asAttr *bgp.PathAttributeAsPath) *bgp.PathAttributeAsPath { return bgp.NewPathAttributeAsPath(newASparams) } -func (path *Path) UpdatePathAttrs(global *config.Global, peer *config.Neighbor, info *PeerInfo) { +func UpdatePathAttrs(global *config.Global, peer *config.Neighbor, info *PeerInfo, original *Path) *Path { if peer.RouteServer.Config.RouteServerClient { - return + return original } + path := original.Clone(original.IsWithdraw) for _, a := range path.GetPathAttrs() { if _, y := bgp.PathAttrFlags[a.GetType()]; !y { @@ -257,6 +258,7 @@ func (path *Path) UpdatePathAttrs(global *config.Global, peer *config.Neighbor, "Key": peer.Config.NeighborAddress, }).Warnf("invalid peer type: %d", peer.State.PeerType) } + return path } func (path *Path) GetTimestamp() time.Time { |