diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-03-20 22:10:09 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-03-20 22:10:09 +0900 |
commit | 9355715ea394cb232d933ca20e8365b126ae6302 (patch) | |
tree | 9b22046329a177a457b7d66dbe71a7e19fcd3649 /table/message.go | |
parent | a307c5bc7a4cea293400e4475ea504b4e2b450f4 (diff) |
peer: update pathattr for non-route-server client
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'table/message.go')
-rw-r--r-- | table/message.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/table/message.go b/table/message.go index 12a51cf6..b19bcec2 100644 --- a/table/message.go +++ b/table/message.go @@ -17,6 +17,7 @@ package table import ( "bytes" + "github.com/osrg/gobgp/config" "github.com/osrg/gobgp/packet" ) @@ -127,6 +128,16 @@ func cloneAttrSlice(attrs []bgp.PathAttributeInterface) []bgp.PathAttributeInter return clonedAttrs } +func CloneAndUpdatePathAttrs(pathList []Path, global *config.Global, peer *config.Neighbor) []Path { + newPathList := make([]Path, 0, len(pathList)) + for _, p := range pathList { + clone := p.clone(p.IsWithdraw()) + clone.updatePathAttrs(global, peer) + newPathList = append(newPathList, clone) + } + return newPathList +} + func createUpdateMsgFromPath(path Path, msg *bgp.BGPMessage) *bgp.BGPMessage { rf := path.GetRouteFamily() |