summaryrefslogtreecommitdiffhomepage
path: root/table/table_manager.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-03-08 15:13:07 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-03-08 15:13:07 +0900
commit1c982d8336c9d89732e8a481a8c90b3e7e283f6f (patch)
tree60c48bd57d3fb771ddab46a9e9e2b76b7715069b /table/table_manager.go
parent608d09c90e906ed43e9206e903443753f73d80b0 (diff)
server: support multiple route familes per peer
You can configure like the following: [Global] As = 65032 RouterId = "192.168.255.1" [[NeighborList]] NeighborAddress = "10.0.255.1" PeerAs = 65001 [NeighborList.RouteServer] RouteServerClient = true [[NeighborList.AfiSafiList]] AfiSafiName = "ipv4-unicast" [[NeighborList.AfiSafiList]] AfiSafiName = "ipv6-unicast" Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'table/table_manager.go')
-rw-r--r--table/table_manager.go25
1 files changed, 21 insertions, 4 deletions
diff --git a/table/table_manager.go b/table/table_manager.go
index 59b0a275..e135f58e 100644
--- a/table/table_manager.go
+++ b/table/table_manager.go
@@ -241,8 +241,11 @@ func (manager *TableManager) calculate(destinationList []Destination) ([]Path, [
}
func (manager *TableManager) DeletePathsforPeer(peerInfo *PeerInfo, rf bgp.RouteFamily) ([]Path, []Path, error) {
- destinationList := manager.Tables[rf].DeleteDestByPeer(peerInfo)
- return manager.calculate(destinationList)
+ if _, ok := manager.Tables[rf]; ok {
+ destinationList := manager.Tables[rf].DeleteDestByPeer(peerInfo)
+ return manager.calculate(destinationList)
+ }
+ return []Path{}, []Path{}, nil
}
func (manager *TableManager) ProcessPaths(pathList []Path) ([]Path, []Path, error) {
@@ -339,24 +342,38 @@ func (adj *AdjRib) getPathList(rib map[string]*ReceivedRoute) []Path {
}
func (adj *AdjRib) GetInPathList(rf bgp.RouteFamily) []Path {
+ if _, ok := adj.adjRibIn[rf]; !ok {
+ return []Path{}
+ }
return adj.getPathList(adj.adjRibIn[rf])
}
func (adj *AdjRib) GetOutPathList(rf bgp.RouteFamily) []Path {
+ if _, ok := adj.adjRibOut[rf]; !ok {
+ return []Path{}
+ }
return adj.getPathList(adj.adjRibOut[rf])
}
func (adj *AdjRib) GetInCount(rf bgp.RouteFamily) int {
+ if _, ok := adj.adjRibIn[rf]; !ok {
+ return 0
+ }
return len(adj.adjRibIn[rf])
}
func (adj *AdjRib) GetOutCount(rf bgp.RouteFamily) int {
+ if _, ok := adj.adjRibOut[rf]; !ok {
+ return 0
+ }
return len(adj.adjRibOut[rf])
}
func (adj *AdjRib) DropAllIn(rf bgp.RouteFamily) {
- // replace old one
- adj.adjRibIn[rf] = make(map[string]*ReceivedRoute)
+ if _, ok := adj.adjRibIn[rf]; ok {
+ // replace old one
+ adj.adjRibIn[rf] = make(map[string]*ReceivedRoute)
+ }
}
type ReceivedRoute struct {