diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-09-08 10:57:43 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-09-08 13:13:34 +0900 |
commit | 9298e5eeca78e8bb02ff34b500add622b73b4f5f (patch) | |
tree | 857f7646d93ba770527e61edd76dd1838b440249 /table/message.go | |
parent | 89b904b7417932e78c8c6fea2ad5d8a35891b0a4 (diff) |
*: kill bgp.NLRInfo and bgp.WithdrawnRoute
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'table/message.go')
-rw-r--r-- | table/message.go | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/table/message.go b/table/message.go index 0066fc36..3ec0ef62 100644 --- a/table/message.go +++ b/table/message.go @@ -132,23 +132,22 @@ func createUpdateMsgFromPath(path *Path, msg *bgp.BGPMessage) *bgp.BGPMessage { rf := path.GetRouteFamily() if rf == bgp.RF_IPv4_UC { + nlri := path.GetNlri().(*bgp.IPAddrPrefix) if path.IsWithdraw { - draw := path.GetNlri().(*bgp.WithdrawnRoute) if msg != nil { u := msg.Body.(*bgp.BGPUpdate) - u.WithdrawnRoutes = append(u.WithdrawnRoutes, *draw) + u.WithdrawnRoutes = append(u.WithdrawnRoutes, nlri) return nil } else { - return bgp.NewBGPUpdateMessage([]bgp.WithdrawnRoute{*draw}, []bgp.PathAttributeInterface{}, []bgp.NLRInfo{}) + return bgp.NewBGPUpdateMessage([]*bgp.IPAddrPrefix{nlri}, nil, nil) } } else { - nlri := path.GetNlri().(*bgp.NLRInfo) if msg != nil { u := msg.Body.(*bgp.BGPUpdate) - u.NLRI = append(u.NLRI, *nlri) + u.NLRI = append(u.NLRI, nlri) } else { pathAttrs := path.GetPathAttrs() - return bgp.NewBGPUpdateMessage([]bgp.WithdrawnRoute{}, pathAttrs, []bgp.NLRInfo{*nlri}) + return bgp.NewBGPUpdateMessage(nil, pathAttrs, []*bgp.IPAddrPrefix{nlri}) } } } else { @@ -163,7 +162,7 @@ func createUpdateMsgFromPath(path *Path, msg *bgp.BGPMessage) *bgp.BGPMessage { idx, attr := path.getPathAttr(bgp.BGP_ATTR_TYPE_MP_REACH_NLRI) reach := attr.(*bgp.PathAttributeMpReachNLRI) clonedAttrs[idx] = bgp.NewPathAttributeMpUnreachNLRI(reach.Value) - return bgp.NewBGPUpdateMessage([]bgp.WithdrawnRoute{}, clonedAttrs, []bgp.NLRInfo{}) + return bgp.NewBGPUpdateMessage(nil, clonedAttrs, nil) } } else { if msg != nil { @@ -177,7 +176,7 @@ func createUpdateMsgFromPath(path *Path, msg *bgp.BGPMessage) *bgp.BGPMessage { // might merge path to this message in // the future so let's clone anyway. clonedAttrs := cloneAttrSlice(path.GetPathAttrs()) - return bgp.NewBGPUpdateMessage([]bgp.WithdrawnRoute{}, clonedAttrs, []bgp.NLRInfo{}) + return bgp.NewBGPUpdateMessage(nil, clonedAttrs, nil) } } } |