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 /table | |
parent | aa5a11501251da31a542553c0abcb81d5857b924 (diff) |
server: avoid unnecessary path clone with route server
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'table')
-rw-r--r-- | table/path.go | 6 |
1 files changed, 4 insertions, 2 deletions
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 { |