diff options
-rw-r--r-- | server/peer.go | 2 | ||||
-rw-r--r-- | server/server.go | 4 | ||||
-rw-r--r-- | table/adj.go | 4 | ||||
-rw-r--r-- | table/table_manager_test.go | 2 |
4 files changed, 5 insertions, 7 deletions
diff --git a/server/peer.go b/server/peer.go index 13238e54..1ae83afd 100644 --- a/server/peer.go +++ b/server/peer.go @@ -117,7 +117,7 @@ func NewPeer(g *config.Global, conf *config.Neighbor, loc *table.TableManager, p peer.tableId = table.GLOBAL_RIB_NAME } rfs, _ := config.AfiSafis(conf.AfiSafis).ToRfList() - peer.adjRibIn = table.NewAdjRib(peer.ID(), rfs) + peer.adjRibIn = table.NewAdjRib(rfs) return peer } diff --git a/server/server.go b/server/server.go index a6015d8e..f6d0a8b8 100644 --- a/server/server.go +++ b/server/server.go @@ -1938,7 +1938,7 @@ func (s *BgpServer) GetAdjRib(addr string, family bgp.RouteFamily, in bool, pref if in { adjRib = peer.adjRibIn } else { - adjRib = table.NewAdjRib(id, peer.configuredRFlist()) + adjRib = table.NewAdjRib(peer.configuredRFlist()) accepted, _ := s.getBestFromLocal(peer, peer.configuredRFlist()) adjRib.Update(accepted) } @@ -1983,7 +1983,7 @@ func (s *BgpServer) GetAdjRibInfo(addr string, family bgp.RouteFamily, in bool) if in { adjRib = peer.adjRibIn } else { - adjRib = table.NewAdjRib(peer.ID(), peer.configuredRFlist()) + adjRib = table.NewAdjRib(peer.configuredRFlist()) accepted, _ := s.getBestFromLocal(peer, peer.configuredRFlist()) adjRib.Update(accepted) } diff --git a/table/adj.go b/table/adj.go index 86e760b7..8c7f0de7 100644 --- a/table/adj.go +++ b/table/adj.go @@ -22,18 +22,16 @@ import ( ) type AdjRib struct { - id string accepted map[bgp.RouteFamily]int table map[bgp.RouteFamily]map[string]*Path } -func NewAdjRib(id string, rfList []bgp.RouteFamily) *AdjRib { +func NewAdjRib(rfList []bgp.RouteFamily) *AdjRib { table := make(map[bgp.RouteFamily]map[string]*Path) for _, rf := range rfList { table[rf] = make(map[string]*Path) } return &AdjRib{ - id: id, table: table, accepted: make(map[bgp.RouteFamily]int), } diff --git a/table/table_manager_test.go b/table/table_manager_test.go index 53e226f8..ee94d7e5 100644 --- a/table/table_manager_test.go +++ b/table/table_manager_test.go @@ -2129,7 +2129,7 @@ func TestProcessBGPUpdate_Timestamp(t *testing.T) { nlri := []*bgp.IPAddrPrefix{bgp.NewIPAddrPrefix(24, "10.10.10.0")} - adjRib := NewAdjRib("test", []bgp.RouteFamily{bgp.RF_IPv4_UC, bgp.RF_IPv6_UC}) + adjRib := NewAdjRib([]bgp.RouteFamily{bgp.RF_IPv4_UC, bgp.RF_IPv6_UC}) m1 := bgp.NewBGPUpdateMessage(nil, pathAttributes, nlri) peer := peerR1() pList1 := ProcessMessage(m1, peer, time.Now()) |