Пример #1
0
func (peer *Peer) getBestFromLocal(rfList []bgp.RouteFamily) ([]*table.Path, []*table.Path) {
	pathList := []*table.Path{}
	filtered := []*table.Path{}
	options := &table.PolicyOptions{
		Neighbor: peer.fsm.peerInfo.Address,
	}
	for _, path := range peer.localRib.GetBestPathList(peer.TableID(), rfList) {
		p := peer.policy.ApplyPolicy(peer.TableID(), table.POLICY_DIRECTION_EXPORT, filterpath(peer, path), options)
		if p == nil {
			filtered = append(filtered, path)
			continue
		}
		if !peer.isRouteServerClient() {
			p = p.Clone(p.IsWithdraw)
			p.UpdatePathAttrs(peer.fsm.gConf, peer.fsm.pConf)
		}
		pathList = append(pathList, p)
	}
	if peer.isGracefulRestartEnabled() {
		for _, family := range rfList {
			pathList = append(pathList, table.NewEOR(family))
		}
	}
	return pathList, filtered
}
Пример #2
0
func (peer *Peer) getBestFromLocal(rfList []bgp.RouteFamily) ([]*table.Path, []*table.Path) {
	pathList := []*table.Path{}
	filtered := []*table.Path{}
	for _, path := range peer.localRib.GetBestPathList(peer.TableID(), rfList) {
		if p := peer.filterpath(path); p != nil {
			pathList = append(pathList, p)
		} else {
			filtered = append(filtered, path)
		}

	}
	if peer.isGracefulRestartEnabled() {
		for _, family := range rfList {
			pathList = append(pathList, table.NewEOR(family))
		}
	}
	return pathList, filtered
}