aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/General/Types/RegionInfo.cs2
-rw-r--r--OpenSim/Framework/General/Util.cs25
-rw-r--r--OpenSim/Grid/UserServer/UserManager.cs2
3 files changed, 27 insertions, 2 deletions
diff --git a/OpenSim/Framework/General/Types/RegionInfo.cs b/OpenSim/Framework/General/Types/RegionInfo.cs
index c347918..251d7f8 100644
--- a/OpenSim/Framework/General/Types/RegionInfo.cs
+++ b/OpenSim/Framework/General/Types/RegionInfo.cs
@@ -212,7 +212,7 @@ namespace OpenSim.Framework.Types
212 212
213 string internalAddress = GetString(configData, "InternalIPAddress", "0.0.0.0", "Internal IP Address for UDP client connections").ToString(); 213 string internalAddress = GetString(configData, "InternalIPAddress", "0.0.0.0", "Internal IP Address for UDP client connections").ToString();
214 int internalPort = GetIPPort(configData, "InternalIPPort", "9000", "Internal IP Port for UDP client connections"); 214 int internalPort = GetIPPort(configData, "InternalIPPort", "9000", "Internal IP Port for UDP client connections");
215 IPAddress internalIPAddress = Dns.GetHostByName(internalAddress).AddressList[0]; 215 IPAddress internalIPAddress = Util.GetHostFromDNS(internalAddress);
216 m_internalEndPoint = new IPEndPoint(internalIPAddress, internalPort); 216 m_internalEndPoint = new IPEndPoint(internalIPAddress, internalPort);
217 217
218 m_externalHostName = GetString(configData, "ExternalHostName", "127.0.0.1", "External Host Name"); 218 m_externalHostName = GetString(configData, "ExternalHostName", "127.0.0.1", "External Host Name");
diff --git a/OpenSim/Framework/General/Util.cs b/OpenSim/Framework/General/Util.cs
index 3333ced..97fe7da 100644
--- a/OpenSim/Framework/General/Util.cs
+++ b/OpenSim/Framework/General/Util.cs
@@ -27,6 +27,7 @@
27*/ 27*/
28using System; 28using System;
29using System.Security.Cryptography; 29using System.Security.Cryptography;
30using System.Net;
30using System.Text; 31using System.Text;
31using libsecondlife; 32using libsecondlife;
32 33
@@ -176,6 +177,30 @@ namespace OpenSim.Framework.Utilities
176 177
177 return output.ToString(); 178 return output.ToString();
178 } 179 }
180
181 /// <summary>
182 /// Returns a IP address from a specified DNS, favouring IPv4 addresses.
183 /// </summary>
184 /// <param name="dnsAddress">DNS Hostname</param>
185 /// <returns>An IP address, or null</returns>
186 public static IPAddress GetHostFromDNS(string dnsAddress)
187 {
188 IPAddress[] hosts = Dns.GetHostEntry(dnsAddress).AddressList;
189
190 foreach (IPAddress host in hosts)
191 {
192 if (host.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
193 {
194 return host;
195 }
196 }
197
198 if (hosts.Length > 0)
199 return hosts[0];
200
201 return null;
202 }
203
179 public Util() 204 public Util()
180 { 205 {
181 206
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index 74d2248..c459b93 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -60,7 +60,7 @@ namespace OpenSim.Grid.UserServer
60 60
61 // Destination 61 // Destination
62 Console.WriteLine("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY); 62 Console.WriteLine("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY);
63 response.SimAddress = Dns.GetHostByName(SimInfo.serverIP).AddressList[0].ToString(); 63 response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString();
64 response.SimPort = (Int32)SimInfo.serverPort; 64 response.SimPort = (Int32)SimInfo.serverPort;
65 response.RegionX = SimInfo.regionLocX; 65 response.RegionX = SimInfo.regionLocX;
66 response.RegionY = SimInfo.regionLocY; 66 response.RegionY = SimInfo.regionLocY;