Пример #1
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);
 }
Пример #2
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);
 }
Пример #3
0
        // Token: 0x06001795 RID: 6037 RVA: 0x00061B28 File Offset: 0x0005FD28
        internal void GetDnsRecords()
        {
            Exception ex = null;

            try
            {
                if (MachineName.Comparer.Equals(this.Name, Environment.MachineName))
                {
                    List <IPAddress> list = ExchangeNetworkNode.FindCandidateDnsAddrs();
                    this.m_dnsAddresses = list.ToArray();
                }
                else
                {
                    this.m_dnsAddresses = Dns.GetHostAddresses(this.Name);
                }
                foreach (IPAddress ipaddress in this.m_dnsAddresses)
                {
                    NetworkManager.TraceDebug("Node {0} has DNS for {1}", new object[]
                    {
                        this.Name,
                        ipaddress
                    });
                }
            }
            catch (SocketException ex2)
            {
                ex = ex2;
            }
            catch (NetworkInformationException ex3)
            {
                ex = ex3;
            }
            finally
            {
                if (ex != null)
                {
                    NetworkManager.TraceError("NetworkMap.GetDnsRecords failed: {0}", new object[]
                    {
                        ex
                    });
                }
                this.m_hasDnsBeenChecked = true;
            }
        }
Пример #4
0
        // Token: 0x06001777 RID: 6007 RVA: 0x000608D4 File Offset: 0x0005EAD4
        public List <NetworkPath> EnumeratePaths(string targetNodeName, bool ignoreNodeDown)
        {
            this.m_rwLock.AcquireReaderLock(-1);
            List <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 && !ignoreNodeDown)
                    {
                        NetworkManager.TraceDebug("Node {0} is reported as down.", new object[]
                        {
                            exchangeNetworkNode.Name
                        });
                        result = null;
                    }
                    else
                    {
                        List <NetworkPath> list = new List <NetworkPath>();
                        this.EnumeratePaths(list, this.m_preferredNets, exchangeNetworkNode, num);
                        this.EnumeratePaths(list, this.m_regularNets, exchangeNetworkNode, num);
                        result = list;
                    }
                }
            }
            finally
            {
                this.m_rwLock.ReleaseReaderLock();
            }
            return(result);
        }
Пример #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: 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)
                    });
                }
            }
        }
Пример #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);
        }
Пример #9
0
 // Token: 0x06001796 RID: 6038 RVA: 0x00061C14 File Offset: 0x0005FE14
 internal bool IsEndPointMappedByDNS(IPAddress ipAddr)
 {
     return(ExchangeNetworkNode.IsAddressPresent(this.m_dnsAddresses, ipAddr));
 }