Ejemplo n.º 1
0
 // Token: 0x06001780 RID: 6016 RVA: 0x000613DC File Offset: 0x0005F5DC
 internal ExchangeNetwork LookupEndPoint(IPAddress ipAddr, out NetworkEndPoint matchingEndPoint)
 {
     matchingEndPoint = null;
     ipAddr           = ExchangeNetworkMap.ConvertIP4Over6To4(ipAddr);
     this.GetReaderLock();
     try
     {
         foreach (KeyValuePair <string, ExchangeNetwork> keyValuePair in this.m_networks)
         {
             ExchangeNetwork value = keyValuePair.Value;
             if (value.EndPoints != null)
             {
                 foreach (NetworkNodeEndPoints networkNodeEndPoints in value.EndPoints)
                 {
                     if (networkNodeEndPoints != null && networkNodeEndPoints.EndPoints.Count > 0)
                     {
                         NetworkEndPoint networkEndPoint = networkNodeEndPoints.EndPoints[0];
                         if (networkEndPoint.IPAddress.Equals(ipAddr))
                         {
                             matchingEndPoint = networkEndPoint;
                             return(value);
                         }
                     }
                 }
             }
         }
     }
     finally
     {
         this.ReleaseReaderLock();
     }
     return(null);
 }
Ejemplo n.º 2
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);
 }
Ejemplo n.º 3
0
		internal static ExchangeNetworkPerfmonCounters GetPerfCounters(string netName)
		{
			ExchangeNetwork network = NetworkManager.GetNetwork(netName);
			if (network != null)
			{
				return network.PerfCounters;
			}
			return null;
		}
Ejemplo n.º 4
0
		private void DriveMapRefreshInternal()
		{
			lock (this.m_mapRefreshLock)
			{
				bool flag2 = false;
				Exception ex = null;
				int num = 4;
				for (int i = 1; i <= num; i++)
				{
					try
					{
						this.EnumerateNetworkMap();
						flag2 = true;
						break;
					}
					catch (ClusterNetworkDeletedException ex2)
					{
						ex = ex2;
					}
					catch (ClusterException ex3)
					{
						ex = ex3;
					}
					if (i < num)
					{
						NetworkManager.TraceError("DriveMapRefresh hit an exception during EnumerateNetworkMap, sleeping for 1 second and re-trying: {0}", new object[]
						{
							ex
						});
						Thread.Sleep(1000);
					}
				}
				if (!flag2)
				{
					throw ex;
				}
				if (this.m_netMap != null)
				{
					ExchangeNetwork exchangeNetwork = null;
					foreach (KeyValuePair<string, ExchangeNetwork> keyValuePair in this.m_netMap.Networks)
					{
						ExchangeNetwork value = keyValuePair.Value;
						if (value.ReplicationEnabled)
						{
							exchangeNetwork = value;
							break;
						}
					}
					if (exchangeNetwork == null)
					{
						ReplayEventLogConstants.Tuple_NetworkReplicationDisabled.LogEvent("AllNetsDisabled", new object[0]);
					}
				}
			}
		}
Ejemplo n.º 5
0
 // Token: 0x0600177B RID: 6011 RVA: 0x00060F58 File Offset: 0x0005F158
 internal ExchangeNetwork GetNetwork(string netName)
 {
     if (netName != null)
     {
         ExchangeNetwork result = null;
         if (this.Networks.TryGetValue(netName, out result))
         {
             return(result);
         }
     }
     return(null);
 }
Ejemplo n.º 6
0
 // Token: 0x06001778 RID: 6008 RVA: 0x000609A0 File Offset: 0x0005EBA0
 internal void SetupPerfmon()
 {
     foreach (KeyValuePair <string, ExchangeNetwork> keyValuePair in this.Networks)
     {
         ExchangeNetwork value = keyValuePair.Value;
         if (value.ReplicationEnabled && !value.IgnoreNetwork && value.Subnets.Count > 0)
         {
             NetworkManagerPerfmonInstance  instance     = NetworkManagerPerfmon.GetInstance(value.Name);
             ExchangeNetworkPerfmonCounters perfCounters = new ExchangeNetworkPerfmonCounters(instance);
             value.PerfCounters = perfCounters;
         }
     }
 }
Ejemplo n.º 7
0
        // Token: 0x06001782 RID: 6018 RVA: 0x00061644 File Offset: 0x0005F844
        internal DatabaseAvailabilityGroupNetwork[] GetDagNets()
        {
            if (this.m_networks.Count <= 0)
            {
                return(null);
            }
            DatabaseAvailabilityGroupNetwork[] array = new DatabaseAvailabilityGroupNetwork[this.m_networks.Count];
            int num = 0;

            foreach (KeyValuePair <string, ExchangeNetwork> keyValuePair in this.m_networks)
            {
                ExchangeNetwork value = keyValuePair.Value;
                array[num++] = this.DescribeDagNetwork(value);
            }
            return(array);
        }
Ejemplo n.º 8
0
        // Token: 0x06001781 RID: 6017 RVA: 0x000614B8 File Offset: 0x0005F6B8
        internal DatabaseAvailabilityGroupNetwork DescribeDagNetwork(ExchangeNetwork xNet)
        {
            DatabaseAvailabilityGroupNetwork databaseAvailabilityGroupNetwork = new DatabaseAvailabilityGroupNetwork();

            databaseAvailabilityGroupNetwork.Name               = xNet.Name;
            databaseAvailabilityGroupNetwork.Description        = xNet.Description;
            databaseAvailabilityGroupNetwork.MapiAccessEnabled  = xNet.MapiAccessEnabled;
            databaseAvailabilityGroupNetwork.ReplicationEnabled = xNet.ReplicationEnabled;
            databaseAvailabilityGroupNetwork.IgnoreNetwork      = xNet.IgnoreNetwork;
            List <DatabaseAvailabilityGroupNetworkSubnet> list = new List <DatabaseAvailabilityGroupNetworkSubnet>();

            foreach (ExchangeSubnet exchangeSubnet in xNet.Subnets)
            {
                if (xNet.IsMisconfigured)
                {
                    exchangeSubnet.SubnetAndState.State = DatabaseAvailabilityGroupNetworkSubnet.SubnetState.Misconfigured;
                }
                list.Add(exchangeSubnet.SubnetAndState);
            }
            databaseAvailabilityGroupNetwork.Subnets = list.ToArray();
            List <DatabaseAvailabilityGroupNetworkInterface> list2 = new List <DatabaseAvailabilityGroupNetworkInterface>();

            if (xNet.EndPoints != null)
            {
                foreach (NetworkNodeEndPoints networkNodeEndPoints in xNet.EndPoints)
                {
                    if (networkNodeEndPoints != null)
                    {
                        foreach (NetworkEndPoint networkEndPoint in networkNodeEndPoints.EndPoints)
                        {
                            list2.Add(new DatabaseAvailabilityGroupNetworkInterface
                            {
                                NodeName  = networkEndPoint.NodeName,
                                State     = networkEndPoint.ClusterNicState,
                                IPAddress = networkEndPoint.IPAddress
                            });
                        }
                    }
                }
            }
            databaseAvailabilityGroupNetwork.Interfaces = list2.ToArray();
            return(databaseAvailabilityGroupNetwork);
        }
Ejemplo n.º 9
0
        // Token: 0x06001893 RID: 6291 RVA: 0x00064ED4 File Offset: 0x000630D4
        private TcpServerChannel(Socket socket, NegotiateStream stream, int ioTimeoutInMSec, TimeSpan idleLimit) : base(socket, stream, ioTimeoutInMSec, idleLimit)
        {
            IPEndPoint      ipendPoint = (IPEndPoint)socket.RemoteEndPoint;
            NetworkEndPoint networkEndPoint;
            ExchangeNetwork exchangeNetwork = NetworkManager.LookupEndPoint(ipendPoint.Address, out networkEndPoint);

            if (exchangeNetwork != null)
            {
                this.m_networkName         = exchangeNetwork.Name;
                this.m_clientNodeName      = networkEndPoint.NodeName;
                this.m_networkPerfCounters = exchangeNetwork.PerfCounters;
                base.PartnerNodeName       = this.m_clientNodeName;
                ExTraceGlobals.TcpChannelTracer.TraceDebug <string, string, EndPoint>((long)this.GetHashCode(), "Opening server channel with DAG member {0} on network {1} from ip {2}", this.m_clientNodeName, this.m_networkName, socket.RemoteEndPoint);
            }
            else
            {
                base.PartnerNodeName = socket.RemoteEndPoint.ToString();
                ExTraceGlobals.TcpChannelTracer.TraceDebug <EndPoint>((long)this.GetHashCode(), "Opening server channel with unknown client on ip {0}", socket.RemoteEndPoint);
            }
            ReplayCrimsonEvents.ServerNetworkConnectionOpen.Log <string, string, string>(base.PartnerNodeName, base.RemoteEndpointString, base.LocalEndpointString);
        }
Ejemplo n.º 10
0
        // Token: 0x0600177E RID: 6014 RVA: 0x0006121C File Offset: 0x0005F41C
        internal PersistentDagNetworkConfig UpdateNetConfig(SetDagNetworkRequest changeReq)
        {
            ExchangeNetwork network = this.GetNetwork(changeReq.Name);

            if (changeReq.NewName != null)
            {
                ExchangeNetwork network2 = this.GetNetwork(changeReq.NewName);
                if (network2 != null && network2 != network)
                {
                    NetworkManager.TraceError("SetDagNetwork Cannot rename {0} because {1} already exists", new object[]
                    {
                        changeReq.Name,
                        changeReq.NewName
                    });
                    throw new DagNetworkManagementException(ServerStrings.DagNetworkCreateDupName(changeReq.NewName));
                }
            }
            PersistentDagNetworkConfig persistentDagNetworkConfig = this.BuildNetConfigWithChange(changeReq);

            if (network == null)
            {
                PersistentDagNetwork persistentDagNetwork = new PersistentDagNetwork();
                persistentDagNetwork.Name               = changeReq.Name;
                persistentDagNetwork.Description        = changeReq.Description;
                persistentDagNetwork.IgnoreNetwork      = changeReq.IgnoreNetwork;
                persistentDagNetwork.ReplicationEnabled = changeReq.ReplicationEnabled;
                if (changeReq.Subnets.Count > 0)
                {
                    foreach (DatabaseAvailabilityGroupSubnetId databaseAvailabilityGroupSubnetId in changeReq.Subnets.Keys)
                    {
                        persistentDagNetwork.Subnets.Add(databaseAvailabilityGroupSubnetId.ToString());
                    }
                }
                persistentDagNetworkConfig.Networks.Add(persistentDagNetwork);
            }
            return(persistentDagNetworkConfig);
        }
Ejemplo n.º 11
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();
     }
 }
Ejemplo n.º 12
0
        // Token: 0x06001783 RID: 6019 RVA: 0x000616CC File Offset: 0x0005F8CC
        private ExchangeSubnet AddSubnetToMap(DatabaseAvailabilityGroupSubnetId subnetId, ExchangeNetwork owningNetwork)
        {
            ExchangeSubnet exchangeSubnet = new ExchangeSubnet(subnetId);

            exchangeSubnet.Network = owningNetwork;
            owningNetwork.Subnets.Add(exchangeSubnet);
            this.m_subnets.Add(exchangeSubnet.SubnetId, exchangeSubnet);
            return(exchangeSubnet);
        }
Ejemplo n.º 13
0
        // Token: 0x0600177D RID: 6013 RVA: 0x00060F88 File Offset: 0x0005F188
        private PersistentDagNetworkConfig BuildNetConfigWithChange(SetDagNetworkRequest changeReq)
        {
            PersistentDagNetworkConfig persistentDagNetworkConfig = new PersistentDagNetworkConfig();

            persistentDagNetworkConfig.ReplicationPort    = this.m_mgr.ReplicationPort;
            persistentDagNetworkConfig.NetworkCompression = this.m_mgr.NetworkCompression;
            persistentDagNetworkConfig.NetworkEncryption  = this.m_mgr.NetworkEncryption;
            foreach (KeyValuePair <string, ExchangeNetwork> keyValuePair in this.m_networks)
            {
                ExchangeNetwork      value = keyValuePair.Value;
                PersistentDagNetwork persistentDagNetwork = new PersistentDagNetwork();
                persistentDagNetwork.Name               = value.Name;
                persistentDagNetwork.Description        = value.Description;
                persistentDagNetwork.ReplicationEnabled = value.ReplicationEnabled;
                persistentDagNetwork.IgnoreNetwork      = value.IgnoreNetwork;
                bool flag = false;
                if (changeReq != null && DatabaseAvailabilityGroupNetwork.NameComparer.Equals(changeReq.Name, value.Name))
                {
                    if (changeReq.NewName != null)
                    {
                        persistentDagNetwork.Name = changeReq.NewName;
                    }
                    if (changeReq.Description != null)
                    {
                        persistentDagNetwork.Description = changeReq.Description;
                    }
                    if (changeReq.IsIgnoreChanged)
                    {
                        persistentDagNetwork.IgnoreNetwork = changeReq.IgnoreNetwork;
                    }
                    if (changeReq.IsReplicationChanged)
                    {
                        persistentDagNetwork.ReplicationEnabled = changeReq.ReplicationEnabled;
                    }
                    if (changeReq.SubnetListIsSet || changeReq.Subnets.Count > 0)
                    {
                        flag = true;
                        foreach (KeyValuePair <DatabaseAvailabilityGroupSubnetId, object> keyValuePair2 in changeReq.Subnets)
                        {
                            persistentDagNetwork.Subnets.Add(keyValuePair2.Key.ToString());
                        }
                    }
                }
                if (!flag)
                {
                    foreach (ExchangeSubnet exchangeSubnet in value.Subnets)
                    {
                        if (changeReq != null && changeReq.Subnets.Count > 0 && changeReq.Subnets.ContainsKey(exchangeSubnet.SubnetId))
                        {
                            NetworkManager.TraceDebug("Subnet '{0}' moving from net '{1}' to net '{2}'", new object[]
                            {
                                exchangeSubnet.SubnetId,
                                value.Name,
                                changeReq.LatestName
                            });
                        }
                        else
                        {
                            string item = exchangeSubnet.SubnetId.ToString();
                            persistentDagNetwork.Subnets.Add(item);
                        }
                    }
                }
                persistentDagNetworkConfig.Networks.Add(persistentDagNetwork);
            }
            return(persistentDagNetworkConfig);
        }
Ejemplo n.º 14
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);
                    }
                }
            }
        }
Ejemplo n.º 15
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);
        }