summaryrefslogtreecommitdiffhomepage
path: root/table/path.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-12-22 02:52:33 -0800
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-12-22 02:52:33 -0800
commit275f20e96e674e3a0b654292f81240744c61665a (patch)
tree8f4a4e6b7b0d6d31cd9e4bea00b2435f67eb8e46 /table/path.go
parentc90dc7bcf1caadb23119e638ef7ed576e1c97187 (diff)
table: send withdraw when peer is down
When a peer becomes down, send withdraw for the best pathes of it. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'table/path.go')
-rw-r--r--table/path.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/table/path.go b/table/path.go
index 269f6129..b9362bd9 100644
--- a/table/path.go
+++ b/table/path.go
@@ -76,7 +76,12 @@ func NewPathDefault(rf RouteFamily, source *PeerInfo, nlri bgp.AddrPrefixInterfa
// create new PathAttributes
func (pd *PathDefault) Clone(isWithdraw bool) Path {
copiedAttrs := []bgp.PathAttributeInterface(nil)
- if !isWithdraw {
+ nlri := pd.nlri
+ if isWithdraw {
+ if !pd.IsWithdraw() {
+ nlri = &bgp.WithdrawnRoute{pd.nlri.(*bgp.NLRInfo).IPAddrPrefix}
+ }
+ } else {
copiedAttrs = append(copiedAttrs, pd.pathAttrs...)
for i, attr := range copiedAttrs {
t, v := reflect.TypeOf(attr), reflect.ValueOf(attr)
@@ -85,7 +90,7 @@ func (pd *PathDefault) Clone(isWithdraw bool) Path {
copiedAttrs[i] = newAttrObjp.Interface().(bgp.PathAttributeInterface)
}
}
- return CreatePath(pd.source, pd.nlri, copiedAttrs, isWithdraw)
+ return CreatePath(pd.source, nlri, copiedAttrs, isWithdraw)
}
func (pd *PathDefault) getRouteFamily() RouteFamily {