diff options
author | Hitoshi Irino <irino@sfc.wide.ad.jp> | 2019-03-03 12:48:57 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-03-14 21:20:31 +0900 |
commit | 7228b3dc1f1c7dca64bdfd5053244252bccd6180 (patch) | |
tree | d7831e9174693a9293b3a20e738f8392c89a5e33 /internal/pkg/table | |
parent | 4967c82a36943d90d1f732bbe4af65b4b39542dc (diff) |
Refactoring source code for BGP/MPLS L3VPN with ZAPI 6
- Deleting receiveVrfId (which is introduced on 2 previous commit 90eeb5de870b95345650e3ee98741e040a0b6e93) from Path struct and Introducing pathVrf Map in zclient.
- Recovering logic (which is changed on 1 previous commit acfd5bedb6d94775392200db597a5ac420b31b2e) to use assignMplsLabel in server.go.
- Refectoring zclient's newIPRouteBody for deleating duplicate logic for IPv4 and IPv6.
Diffstat (limited to 'internal/pkg/table')
-rw-r--r-- | internal/pkg/table/path.go | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/internal/pkg/table/path.go b/internal/pkg/table/path.go index bdeb6ff2..b6080ffa 100644 --- a/internal/pkg/table/path.go +++ b/internal/pkg/table/path.go @@ -133,14 +133,13 @@ type Validation struct { } type Path struct { - info *originInfo - parent *Path - pathAttrs []bgp.PathAttributeInterface - dels []bgp.BGPAttrType - attrsHash uint32 - aslooped bool - reason BestPathReason - receiveVrfId uint32 //VRF in which the path was received. + info *originInfo + parent *Path + pathAttrs []bgp.PathAttributeInterface + dels []bgp.BGPAttrType + attrsHash uint32 + aslooped bool + reason BestPathReason // For BGP Nexthop Tracking, this field shows if nexthop is invalidated by IGP. IsNexthopInvalid bool @@ -168,9 +167,8 @@ func NewPath(source *PeerInfo, nlri bgp.AddrPrefixInterface, isWithdraw bool, pa timestamp: timestamp.Unix(), noImplicitWithdraw: noImplicitWithdraw, }, - IsWithdraw: isWithdraw, - pathAttrs: pattrs, - receiveVrfId: 0, + IsWithdraw: isWithdraw, + pathAttrs: pattrs, } } @@ -334,13 +332,6 @@ func (path *Path) IsIBGP() bool { return (as == path.GetSource().LocalAS) && as != 0 } -func (path *Path) ReceiveVrfId() uint32 { - return path.receiveVrfId -} -func (path *Path) SetReceiveVrfId(vrfId uint32) { - path.receiveVrfId = vrfId -} - // create new PathAttributes func (path *Path) Clone(isWithdraw bool) *Path { return &Path{ @@ -348,7 +339,6 @@ func (path *Path) Clone(isWithdraw bool) *Path { IsWithdraw: isWithdraw, IsNexthopInvalid: path.IsNexthopInvalid, attrsHash: path.attrsHash, - receiveVrfId: path.receiveVrfId, } } @@ -590,7 +580,6 @@ func (path *Path) String() string { if path.IsWithdraw { s.WriteString(", withdraw") } - s.WriteString(fmt.Sprintf(", receiveVrfId: %d", path.receiveVrfId)) s.WriteString(" }") return s.String() } @@ -1149,7 +1138,6 @@ func (p *Path) ToGlobal(vrf *Vrf) *Path { path.delPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP) path.setPathAttr(bgp.NewPathAttributeMpReachNLRI(nh.String(), []bgp.AddrPrefixInterface{nlri})) path.IsNexthopInvalid = p.IsNexthopInvalid - path.receiveVrfId = p.receiveVrfId return path } |