diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-12-21 20:33:34 -0800 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-12-21 20:33:34 -0800 |
commit | d84250491a53d3aefc00fe643d5bb45aea83b757 (patch) | |
tree | 9a75f09ba2c764ce1f40e52f90091bf0b5cf6940 /table/path.go | |
parent | 73d7ec4471158abd320c056dc28ed76708f6ba65 (diff) |
server: update AdjRibOut table
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'table/path.go')
-rw-r--r-- | table/path.go | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/table/path.go b/table/path.go index 846c7e16..4ef9c070 100644 --- a/table/path.go +++ b/table/path.go @@ -39,7 +39,7 @@ type Path interface { getPrefix() net.IP setMedSetByTargetNeighbor(medSetByTargetNeighbor bool) getMedSetByTargetNeighbor() bool - Clone() Path + Clone(IsWithdraw bool) Path } type PathDefault struct { @@ -74,15 +74,18 @@ func NewPathDefault(rf RouteFamily, source *PeerInfo, nlri bgp.AddrPrefixInterfa } // create new PathAttributes -func (pd *PathDefault) Clone() Path { - copiedAttrs := append([]bgp.PathAttributeInterface(nil), pd.pathAttrs...) - for i, attr := range copiedAttrs { - t, v := reflect.TypeOf(attr), reflect.ValueOf(attr) - newAttrObjp := reflect.New(t.Elem()) - newAttrObjp.Elem().Set(v.Elem()) - copiedAttrs[i] = newAttrObjp.Interface().(bgp.PathAttributeInterface) +func (pd *PathDefault) Clone(isWithdraw bool) Path { + copiedAttrs := []bgp.PathAttributeInterface(nil) + if !isWithdraw { + copiedAttrs = append(copiedAttrs, pd.pathAttrs...) + for i, attr := range copiedAttrs { + t, v := reflect.TypeOf(attr), reflect.ValueOf(attr) + newAttrObjp := reflect.New(t.Elem()) + newAttrObjp.Elem().Set(v.Elem()) + copiedAttrs[i] = newAttrObjp.Interface().(bgp.PathAttributeInterface) + } } - return CreatePath(pd.source, pd.nlri, copiedAttrs, pd.withdraw) + return CreatePath(pd.source, pd.nlri, copiedAttrs, isWithdraw) } func (pd *PathDefault) getRouteFamily() RouteFamily { |