diff options
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() |