diff --git a/protocols/bgp/server/fsm.go b/protocols/bgp/server/fsm.go index de4fca43bf829e5aa5e99713f5f4110896b35978..1d353675374d6f8f79fdce314357b92d1eb5013a 100644 --- a/protocols/bgp/server/fsm.go +++ b/protocols/bgp/server/fsm.go @@ -83,8 +83,8 @@ type FSM struct { msgRecvFailCh chan msgRecvErr stopMsgRecvCh chan struct{} - adjRibIn *rt.LPM - adjRibOut *rt.LPM + adjRibIn *rt.RT + adjRibOut *rt.RT } type msgRecvMsg struct { diff --git a/rt/routing_table.go b/rt/routing_table.go index 0ca9812a3a681890e346d7664eaea8e8bf7d6350..c86526e966c28329a45381f59bf1741d358887da 100644 --- a/rt/routing_table.go +++ b/rt/routing_table.go @@ -4,7 +4,7 @@ import ( "github.com/bio-routing/bio-rd/net" ) -type LPM struct { +type RT struct { root *node nodes uint64 } @@ -18,8 +18,8 @@ type node struct { } // New creates a new empty LPM -func New() *LPM { - return &LPM{} +func New() *RT { + return &RT{} } func newNode(route *Route, skip uint8, dummy bool) *node { @@ -32,7 +32,7 @@ func newNode(route *Route, skip uint8, dummy bool) *node { } // LPM performs a longest prefix match for pfx on lpm -func (lpm *LPM) LPM(pfx *net.Prefix) (res []*Route) { +func (lpm *RT) LPM(pfx *net.Prefix) (res []*Route) { if lpm.root == nil { return nil } @@ -42,16 +42,16 @@ func (lpm *LPM) LPM(pfx *net.Prefix) (res []*Route) { } // RemovePath removes a path from the trie -func (lpm *LPM) RemovePath(route *Route) { +func (lpm *RT) RemovePath(route *Route) { lpm.root.removePath(route) } -func (lpm *LPM) RemovePfx(pfx *net.Prefix) { +func (lpm *RT) RemovePfx(pfx *net.Prefix) { lpm.root.removePfx(pfx) } // Get get's prefix pfx from the LPM -func (lpm *LPM) Get(pfx *net.Prefix, moreSpecifics bool) (res []*Route) { +func (lpm *RT) Get(pfx *net.Prefix, moreSpecifics bool) (res []*Route) { if lpm.root == nil { return nil } @@ -71,7 +71,7 @@ func (lpm *LPM) Get(pfx *net.Prefix, moreSpecifics bool) (res []*Route) { } // Insert inserts a route into the LPM -func (lpm *LPM) Insert(route *Route) { +func (lpm *RT) Insert(route *Route) { if lpm.root == nil { lpm.root = newNode(route, route.Pfxlen(), false) return @@ -288,7 +288,7 @@ func (n *node) insertBefore(route *Route, parentPfxLen uint8) *node { return new } -func (lpm *LPM) Dump() []*Route { +func (lpm *RT) Dump() []*Route { res := make([]*Route, 0) return lpm.root.dump(res) }