summaryrefslogtreecommitdiffhomepage
path: root/table/message.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-12-17 21:49:32 -0800
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-12-17 21:49:32 -0800
commitf8929462982c77f6be2022c9cf42fe05bf3a4b92 (patch)
tree30ecff2ee8c45274c515ba7d38b74db9b6b8cfbe /table/message.go
parent52ce66ef711d4f2cd356ec654e57ad6e2732981d (diff)
bmp: fix post-policy bmp message creation
post-policy code creates paths from bgp update and then create the message from the modified paths. MP_UNREACH needs to be handled diffently. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'table/message.go')
-rw-r--r--table/message.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/table/message.go b/table/message.go
index 97ec3b16..ee31f18d 100644
--- a/table/message.go
+++ b/table/message.go
@@ -160,8 +160,15 @@ func createUpdateMsgFromPath(path *Path, msg *bgp.BGPMessage) *bgp.BGPMessage {
} else {
clonedAttrs := cloneAttrSlice(path.GetPathAttrs())
idx, attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI)
- reach := attr.(*bgp.PathAttributeMpReachNLRI)
- clonedAttrs[idx] = bgp.NewPathAttributeMpUnreachNLRI(reach.Value)
+ if attr == nil {
+ // for bmp post-policy
+ idx, attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_MP_UNREACH_NLRI)
+ reach := attr.(*bgp.PathAttributeMpUnreachNLRI)
+ clonedAttrs[idx] = bgp.NewPathAttributeMpUnreachNLRI(reach.Value)
+ } else {
+ reach := attr.(*bgp.PathAttributeMpReachNLRI)
+ clonedAttrs[idx] = bgp.NewPathAttributeMpUnreachNLRI(reach.Value)
+ }
return bgp.NewBGPUpdateMessage(nil, clonedAttrs, nil)
}
} else {