From e849b95b11762383c922a3abaf547dfd0f15ba54 Mon Sep 17 00:00:00 2001 From: ISHIDA Wataru Date: Tue, 2 Feb 2016 12:03:16 +0900 Subject: cli/server: fix address family handling Signed-off-by: ISHIDA Wataru --- server/server.go | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'server/server.go') diff --git a/server/server.go b/server/server.go index c90f8306..25ccb9e5 100644 --- a/server/server.go +++ b/server/server.go @@ -1884,7 +1884,11 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) []*SenderMsg { for _, peer := range peers { pathList := []*table.Path{} - for _, path := range peer.adjRibIn.PathList([]bgp.RouteFamily{grpcReq.RouteFamily}, false) { + families := []bgp.RouteFamily{grpcReq.RouteFamily} + if families[0] == bgp.RouteFamily(0) { + families = peer.configuredRFlist() + } + for _, path := range peer.adjRibIn.PathList(families, false) { exResult := path.Filtered(peer.ID()) path.Filter(peer.ID(), table.POLICY_DIRECTION_NONE) if server.policy.ApplyPolicy(peer.ID(), table.POLICY_DIRECTION_IN, path, nil) != nil { @@ -1896,7 +1900,7 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) []*SenderMsg { } } } - peer.adjRibIn.RefreshAcceptedNumber([]bgp.RouteFamily{grpcReq.RouteFamily}) + peer.adjRibIn.RefreshAcceptedNumber(families) m, _ := server.propagateUpdate(peer, pathList) msgs = append(msgs, m...) } @@ -1919,10 +1923,13 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) []*SenderMsg { if peer.fsm.state != bgp.BGP_FSM_ESTABLISHED { continue } - rfList := peer.configuredRFlist() - sentPathList := peer.adjRibOut.PathList(rfList, false) - peer.adjRibOut.Drop(rfList) - pathList, filtered := peer.getBestFromLocal(rfList) + families := []bgp.RouteFamily{grpcReq.RouteFamily} + if families[0] == bgp.RouteFamily(0) { + families = peer.configuredRFlist() + } + sentPathList := peer.adjRibOut.PathList(families, false) + peer.adjRibOut.Drop(families) + pathList, filtered := peer.getBestFromLocal(families) if len(pathList) > 0 { peer.adjRibOut.Update(pathList) msgs = append(msgs, newSenderMsg(peer, table.CreateUpdateMsgFromPaths(pathList))) -- cgit v1.2.3