diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-06-27 17:45:12 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-07-01 11:06:04 +0900 |
commit | 9b35be73826689b15839105ce0f386bbdaf56f06 (patch) | |
tree | a4a52ea351d6ab86a24846ffbfe4498a71aad39e /table/message.go | |
parent | c0b4a5943a5157f0de2e7b03827f714db704922e (diff) |
table: refactor Path/Destination/Table struct
Path/Destination/Table was defined as interface.
Simplify by making them normal struct.
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'table/message.go')
-rw-r--r-- | table/message.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/table/message.go b/table/message.go index 4455e06b..7ae01152 100644 --- a/table/message.go +++ b/table/message.go @@ -128,15 +128,15 @@ func cloneAttrSlice(attrs []bgp.PathAttributeInterface) []bgp.PathAttributeInter return clonedAttrs } -func UpdatePathAttrs(path Path, global *config.Global, peer *config.Neighbor) { +func UpdatePathAttrs(path *Path, global *config.Global, peer *config.Neighbor) { path.updatePathAttrs(global, peer) } -func createUpdateMsgFromPath(path Path, msg *bgp.BGPMessage) *bgp.BGPMessage { +func createUpdateMsgFromPath(path *Path, msg *bgp.BGPMessage) *bgp.BGPMessage { rf := path.GetRouteFamily() if rf == bgp.RF_IPv4_UC { - if path.IsWithdraw() { + if path.IsWithdraw { draw := path.GetNlri().(*bgp.WithdrawnRoute) if msg != nil { u := msg.Body.(*bgp.BGPUpdate) @@ -156,7 +156,7 @@ func createUpdateMsgFromPath(path Path, msg *bgp.BGPMessage) *bgp.BGPMessage { } } } else if rf == bgp.RF_IPv6_UC || rf == bgp.RF_EVPN || rf == bgp.RF_ENCAP || rf == bgp.RF_RTC_UC { - if path.IsWithdraw() { + if path.IsWithdraw { if msg != nil { idx, _ := path.getPathAttr(bgp.BGP_ATTR_TYPE_MP_UNREACH_NLRI) u := msg.Body.(*bgp.BGPUpdate) @@ -207,7 +207,7 @@ func isSamePathAttrs(pList1 []bgp.PathAttributeInterface, pList2 []bgp.PathAttri return true } -func isMergeable(p1 Path, p2 Path) bool { +func isMergeable(p1, p2 *Path) bool { return false if p1 == nil { return false @@ -221,8 +221,8 @@ func isMergeable(p1 Path, p2 Path) bool { return false } -func CreateUpdateMsgFromPaths(pathList []Path) []*bgp.BGPMessage { - var pre Path +func CreateUpdateMsgFromPaths(pathList []*Path) []*bgp.BGPMessage { + var pre *Path var msgs []*bgp.BGPMessage for _, path := range pathList { y := isMergeable(pre, path) |