Пример #1
0
 internal void CopyClusterNicState(AmNetInterfaceState clusterNicState)
 {
     this.ClusterNicState = NetworkEndPoint.MapNicState(clusterNicState);
     if (this.ClusterNicState != DatabaseAvailabilityGroupNetworkInterface.InterfaceState.Up && this.ClusterNicState != DatabaseAvailabilityGroupNetworkInterface.InterfaceState.Unreachable)
     {
         NetworkManager.TraceError("NIC {0} is down: {1}", new object[]
         {
             this.IPAddress,
             clusterNicState
         });
         this.Usable = false;
     }
 }
Пример #2
0
        // Token: 0x06001788 RID: 6024 RVA: 0x00061924 File Offset: 0x0005FB24
        private void EnumeratePaths(List <NetworkPath> possiblePaths, List <ExchangeNetwork> netList, ExchangeNetworkNode xNode, int targetNodeIndex)
        {
            NetworkEndPoint networkEndPoint  = null;
            NetworkEndPoint networkEndPoint2 = null;

            foreach (ExchangeNetwork exchangeNetwork in netList)
            {
                if (this.ExtractEndpoints(exchangeNetwork, xNode, targetNodeIndex, out networkEndPoint, out networkEndPoint2))
                {
                    possiblePaths.Add(new NetworkPath(xNode.Name, networkEndPoint2.IPAddress, (int)this.m_mgr.ReplicationPort, networkEndPoint.IPAddress)
                    {
                        NetworkName = exchangeNetwork.Name,
                        CrossSubnet = (networkEndPoint.Subnet != networkEndPoint2.Subnet)
                    });
                }
            }
        }
Пример #3
0
 // Token: 0x0600177F RID: 6015 RVA: 0x00061348 File Offset: 0x0005F548
 internal void ReportError(NetworkPath path, ExchangeNetwork xNet)
 {
     this.GetWriterLock();
     try
     {
         int num = this.Nodes.IndexOfKey(path.TargetNodeName);
         if (num >= 0)
         {
             NetworkNodeEndPoints[] endPoints = xNet.EndPoints;
             if (endPoints != null && endPoints[num] != null && endPoints[num].EndPoints.Count != 0)
             {
                 NetworkEndPoint networkEndPoint = endPoints[num].EndPoints[0];
                 if (networkEndPoint.IPAddress.Equals(path.TargetEndPoint.Address))
                 {
                     networkEndPoint.Usable = false;
                 }
             }
         }
     }
     finally
     {
         this.ReleaseWriterLock();
     }
 }
Пример #4
0
 // Token: 0x06001787 RID: 6023 RVA: 0x00061814 File Offset: 0x0005FA14
 private bool ExtractEndpoints(ExchangeNetwork xNet, ExchangeNetworkNode xNode, int targetNodeIndex, out NetworkEndPoint sourceEp, out NetworkEndPoint targetEp)
 {
     sourceEp = null;
     targetEp = null;
     NetworkNodeEndPoints[] endPoints = xNet.EndPoints;
     if (endPoints == null || endPoints[this.SourceNodeIndex] == null || endPoints[targetNodeIndex] == null || endPoints[this.SourceNodeIndex].EndPoints.Count == 0 || endPoints[targetNodeIndex].EndPoints.Count == 0)
     {
         NetworkManager.TraceDebug("Node {0} is not reachable over network {1}", new object[]
         {
             xNode.Name,
             xNet.Name
         });
         return(false);
     }
     sourceEp = endPoints[this.SourceNodeIndex].EndPoints[0];
     targetEp = endPoints[targetNodeIndex].EndPoints[0];
     if (!sourceEp.Usable || !targetEp.Usable)
     {
         NetworkManager.TraceDebug("Node {0} is not reachable over network {1}. EP({2})Usable:{3}. EP({4})Usable:{5}", new object[]
         {
             xNode.Name,
             xNet.Name,
             sourceEp.IPAddress,
             sourceEp.Usable,
             targetEp.IPAddress,
             targetEp.Usable
         });
         return(false);
     }
     return(true);
 }
Пример #5
0
        // Token: 0x06001786 RID: 6022 RVA: 0x000617A0 File Offset: 0x0005F9A0
        private ExchangeNetwork UseNetwork(string selectedNetworkName, ExchangeNetworkNode xNode, int targetNodeIndex, out NetworkEndPoint sourceEp, out NetworkEndPoint targetEp)
        {
            sourceEp = null;
            targetEp = null;
            ExchangeNetwork exchangeNetwork;

            if (!this.Networks.TryGetValue(selectedNetworkName, out exchangeNetwork))
            {
                throw new NetworkNameException(selectedNetworkName);
            }
            if (!exchangeNetwork.ReplicationEnabled)
            {
                throw new NetworkNotUsableException(selectedNetworkName, xNode.Name, ReplayStrings.NetworkIsDisabled);
            }
            if (!this.ExtractEndpoints(exchangeNetwork, xNode, targetNodeIndex, out sourceEp, out targetEp))
            {
                throw new NetworkNotUsableException(selectedNetworkName, xNode.Name, ReplayStrings.NetworkNoUsableEndpoints);
            }
            return(exchangeNetwork);
        }
Пример #6
0
 // Token: 0x06001785 RID: 6021 RVA: 0x0006172C File Offset: 0x0005F92C
 private ExchangeNetwork ChooseNetwork(List <ExchangeNetwork> lruList, ExchangeNetworkNode xNode, int targetNodeIndex, out NetworkEndPoint sourceEp, out NetworkEndPoint targetEp)
 {
     sourceEp = null;
     targetEp = null;
     foreach (ExchangeNetwork exchangeNetwork in lruList)
     {
         if (this.ExtractEndpoints(exchangeNetwork, xNode, targetNodeIndex, out sourceEp, out targetEp))
         {
             lruList.Remove(exchangeNetwork);
             lruList.Add(exchangeNetwork);
             return(exchangeNetwork);
         }
     }
     return(null);
 }
Пример #7
0
        // Token: 0x0600177A RID: 6010 RVA: 0x00060C0C File Offset: 0x0005EE0C
        internal void Load(NetworkDiscovery netConfig)
        {
            this.m_preferredNets = new List <ExchangeNetwork>();
            this.m_regularNets   = new List <ExchangeNetwork>();
            foreach (ClusterNode clusterNode in netConfig.Nodes)
            {
                ExchangeNetworkNode exchangeNetworkNode = new ExchangeNetworkNode(clusterNode.Name.NetbiosName);
                exchangeNetworkNode.ClusterState = clusterNode.ClusterState;
                this.m_nodes.Add(exchangeNetworkNode.Name, exchangeNetworkNode);
            }
            string machineName     = Environment.MachineName;
            int    sourceNodeIndex = this.Nodes.IndexOfKey(machineName);

            this.SourceNodeIndex = sourceNodeIndex;
            foreach (LogicalNetwork logicalNetwork in netConfig.LogicalNetworks)
            {
                ExchangeNetwork exchangeNetwork = new ExchangeNetwork(logicalNetwork.Name, this);
                exchangeNetwork.Description        = logicalNetwork.Description;
                exchangeNetwork.ReplicationEnabled = logicalNetwork.ReplicationEnabled;
                exchangeNetwork.IgnoreNetwork      = logicalNetwork.IgnoreNetwork;
                exchangeNetwork.MapiAccessEnabled  = logicalNetwork.HasDnsNic();
                this.m_networks.Add(exchangeNetwork.Name, exchangeNetwork);
                foreach (Subnet subnet in logicalNetwork.Subnets)
                {
                    if (this.m_subnets.ContainsKey(subnet.SubnetId))
                    {
                        exchangeNetwork.IsMisconfigured = true;
                        string errorText = string.Format("Ignoring subnet {0}. It was mapped to multiple nets.", subnet.SubnetId);
                        this.RecordInconsistency(errorText);
                    }
                    else
                    {
                        ExchangeSubnet exchangeSubnet = this.AddSubnetToMap(subnet.SubnetId, exchangeNetwork);
                        ClusterNetwork clusterNetwork = subnet.ClusterNetwork;
                        if (clusterNetwork == null)
                        {
                            exchangeNetwork.IsMisconfigured = true;
                            string errorText2 = string.Format("Subnet {0} configured but no cluster network matched.", subnet.SubnetId);
                            this.RecordInconsistency(errorText2);
                        }
                        else
                        {
                            exchangeSubnet.SubnetAndState.State = ExchangeSubnet.MapSubnetState(clusterNetwork.ClusterState);
                            foreach (ClusterNic clusterNic in clusterNetwork.Nics)
                            {
                                int num = this.Nodes.IndexOfKey(clusterNic.NodeName);
                                if (num < 0)
                                {
                                    string errorText3 = string.Format("Nic {0} has unknown Node {1}.", clusterNic.IPAddress, clusterNic.NodeName);
                                    this.RecordInconsistency(errorText3);
                                }
                                else
                                {
                                    NetworkEndPoint networkEndPoint = new NetworkEndPoint(clusterNic.IPAddress, clusterNic.NodeName, exchangeSubnet);
                                    exchangeSubnet.Network.AddEndPoint(networkEndPoint, num);
                                    networkEndPoint.CopyClusterNicState(clusterNic.ClusterState);
                                }
                            }
                        }
                    }
                }
                if (!exchangeNetwork.IgnoreNetwork && exchangeNetwork.Subnets.Count != 0 && exchangeNetwork.ReplicationEnabled)
                {
                    if (exchangeNetwork.MapiAccessEnabled)
                    {
                        this.m_regularNets.Add(exchangeNetwork);
                    }
                    else
                    {
                        this.m_preferredNets.Add(exchangeNetwork);
                    }
                }
            }
        }
Пример #8
0
        // Token: 0x06001775 RID: 6005 RVA: 0x00060680 File Offset: 0x0005E880
        public NetworkPath ChoosePath(string targetNodeName, string selectedNetworkName)
        {
            this.m_rwLock.AcquireWriterLock(-1);
            NetworkPath result;

            try
            {
                int num = this.Nodes.IndexOfKey(targetNodeName);
                if (num < 0)
                {
                    NetworkManager.TraceDebug("Node {0} is not in the DAG", new object[]
                    {
                        targetNodeName
                    });
                    result = null;
                }
                else
                {
                    ExchangeNetworkNode exchangeNetworkNode = this.Nodes.Values[num];
                    if (exchangeNetworkNode.ClusterState == AmNodeState.Down)
                    {
                        NetworkManager.TraceDebug("Node {0} is reported as down.", new object[]
                        {
                            exchangeNetworkNode.Name
                        });
                        result = null;
                    }
                    else
                    {
                        ExchangeNetwork exchangeNetwork  = null;
                        NetworkEndPoint networkEndPoint  = null;
                        NetworkEndPoint networkEndPoint2 = null;
                        if (selectedNetworkName != null)
                        {
                            exchangeNetwork = this.UseNetwork(selectedNetworkName, exchangeNetworkNode, num, out networkEndPoint, out networkEndPoint2);
                        }
                        else
                        {
                            if (this.m_preferredNets != null)
                            {
                                exchangeNetwork = this.ChooseNetwork(this.m_preferredNets, exchangeNetworkNode, num, out networkEndPoint, out networkEndPoint2);
                            }
                            if (exchangeNetwork == null && this.m_regularNets != null)
                            {
                                exchangeNetwork = this.ChooseNetwork(this.m_regularNets, exchangeNetworkNode, num, out networkEndPoint, out networkEndPoint2);
                            }
                        }
                        if (exchangeNetwork == null)
                        {
                            NetworkManager.TraceDebug("All paths to Node {0} are down", new object[]
                            {
                                targetNodeName
                            });
                            result = null;
                        }
                        else
                        {
                            IPAddress ipaddress = networkEndPoint2.IPAddress;
                            if (ipaddress.IsIPv6LinkLocal)
                            {
                                if (networkEndPoint.IPAddress.AddressFamily != AddressFamily.InterNetworkV6)
                                {
                                    NetworkManager.TraceError("Target {0} has linkLocal v6 addr {1} which is unreachable on outbound ip {2}", new object[]
                                    {
                                        targetNodeName,
                                        ipaddress,
                                        networkEndPoint.IPAddress
                                    });
                                    return(null);
                                }
                                byte[] addressBytes = ipaddress.GetAddressBytes();
                                ipaddress = new IPAddress(addressBytes, networkEndPoint.IPAddress.ScopeId);
                            }
                            result = new NetworkPath(targetNodeName, ipaddress, (int)this.m_mgr.ReplicationPort, networkEndPoint.IPAddress)
                            {
                                NetworkName = exchangeNetwork.Name,
                                CrossSubnet = (networkEndPoint.Subnet != networkEndPoint2.Subnet)
                            };
                        }
                    }
                }
            }
            finally
            {
                this.m_rwLock.ReleaseWriterLock();
            }
            return(result);
        }