diff options
Diffstat (limited to '')
3 files changed, 57 insertions, 45 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index fe84498..061743d 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -1009,6 +1009,9 @@ namespace OpenSim.Framework | |||
1009 | public static IPAddress GetHostFromDNS(string dnsAddress) | 1009 | public static IPAddress GetHostFromDNS(string dnsAddress) |
1010 | { | 1010 | { |
1011 | // If it is already an IP, avoid possible broken mono from seeing it | 1011 | // If it is already an IP, avoid possible broken mono from seeing it |
1012 | if(String.IsNullOrWhiteSpace(dnsAddress)) | ||
1013 | return null; | ||
1014 | |||
1012 | IPAddress ia = null; | 1015 | IPAddress ia = null; |
1013 | if (IPAddress.TryParse(dnsAddress, out ia) && ia != null) | 1016 | if (IPAddress.TryParse(dnsAddress, out ia) && ia != null) |
1014 | { | 1017 | { |
@@ -1016,31 +1019,31 @@ namespace OpenSim.Framework | |||
1016 | return null; | 1019 | return null; |
1017 | return ia; | 1020 | return ia; |
1018 | } | 1021 | } |
1019 | // Reset for next check | 1022 | |
1020 | ia = null; | 1023 | IPHostEntry IPH; |
1021 | try | 1024 | try |
1022 | { | 1025 | { |
1023 | foreach (IPAddress Adr in Dns.GetHostAddresses(dnsAddress)) | 1026 | IPH = Dns.GetHostEntry(dnsAddress); |
1024 | { | ||
1025 | if (ia == null) | ||
1026 | ia = Adr; | ||
1027 | |||
1028 | if (Adr.AddressFamily == AddressFamily.InterNetwork) | ||
1029 | { | ||
1030 | ia = Adr; | ||
1031 | break; | ||
1032 | } | ||
1033 | } | ||
1034 | } | 1027 | } |
1035 | catch // (SocketException e) | 1028 | catch // (SocketException e) |
1036 | { | 1029 | { |
1037 | /*throw new Exception( | 1030 | return null; |
1038 | "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + | 1031 | } |
1039 | e + "' attached to this exception", e);*/ | 1032 | |
1040 | // Don't throw a fatal exception here, instead, return Null and handle it in the caller. | 1033 | if(IPH == null || IPH.AddressList.Length == 0) |
1041 | // Reason is, on systems such as OSgrid it has occured that known hostnames stop | ||
1042 | // resolving and thus make surrounding regions crash out with this exception. | ||
1043 | return null; | 1034 | return null; |
1035 | |||
1036 | ia = null; | ||
1037 | foreach (IPAddress Adr in IPH.AddressList) | ||
1038 | { | ||
1039 | if (ia == null) | ||
1040 | ia = Adr; | ||
1041 | |||
1042 | if (Adr.AddressFamily == AddressFamily.InterNetwork) | ||
1043 | { | ||
1044 | ia = Adr; | ||
1045 | break; | ||
1046 | } | ||
1044 | } | 1047 | } |
1045 | return ia; | 1048 | return ia; |
1046 | } | 1049 | } |
@@ -1075,26 +1078,31 @@ namespace OpenSim.Framework | |||
1075 | return null; | 1078 | return null; |
1076 | return getEndPoint(ia, port); | 1079 | return getEndPoint(ia, port); |
1077 | } | 1080 | } |
1078 | 1081 | ||
1079 | // Reset for next check | 1082 | IPHostEntry IPH; |
1080 | ia = null; | ||
1081 | try | 1083 | try |
1082 | { | 1084 | { |
1083 | foreach (IPAddress Adr in Dns.GetHostAddresses(hostname)) | 1085 | IPH = Dns.GetHostEntry(hostname); |
1084 | { | ||
1085 | if (ia == null) | ||
1086 | ia = Adr; | ||
1087 | |||
1088 | if (Adr.AddressFamily == AddressFamily.InterNetwork) | ||
1089 | { | ||
1090 | ia = Adr; | ||
1091 | break; | ||
1092 | } | ||
1093 | } | ||
1094 | } | 1086 | } |
1095 | catch // (SocketException e) | 1087 | catch // (SocketException e) |
1096 | { | 1088 | { |
1097 | ia = null; | 1089 | return null; |
1090 | } | ||
1091 | |||
1092 | if(IPH == null || IPH.AddressList.Length == 0) | ||
1093 | return null; | ||
1094 | |||
1095 | ia = null; | ||
1096 | foreach (IPAddress Adr in IPH.AddressList) | ||
1097 | { | ||
1098 | if (ia == null) | ||
1099 | ia = Adr; | ||
1100 | |||
1101 | if (Adr.AddressFamily == AddressFamily.InterNetwork) | ||
1102 | { | ||
1103 | ia = Adr; | ||
1104 | break; | ||
1105 | } | ||
1098 | } | 1106 | } |
1099 | 1107 | ||
1100 | return getEndPoint(ia,port); | 1108 | return getEndPoint(ia,port); |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 9959f6e..7214414 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -157,7 +157,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
157 | m_idCache = new ExpiringCache<ulong, DateTime>(); | 157 | m_idCache = new ExpiringCache<ulong, DateTime>(); |
158 | m_bannedRegions.Add(pAgentID, m_idCache, TimeSpan.FromSeconds(newTime)); | 158 | m_bannedRegions.Add(pAgentID, m_idCache, TimeSpan.FromSeconds(newTime)); |
159 | } | 159 | } |
160 | m_idCache.Add(pRegionHandle, DateTime.UtcNow + TimeSpan.FromSeconds(extendTime), TimeSpan.FromSeconds(extendTime)); | 160 | m_idCache.Add(pRegionHandle, DateTime.UtcNow + TimeSpan.FromSeconds(extendTime), extendTime); |
161 | } | 161 | } |
162 | 162 | ||
163 | // Remove the agent from the region's banned list | 163 | // Remove the agent from the region's banned list |
@@ -1488,13 +1488,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1488 | Math.Max(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY)); | 1488 | Math.Max(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY)); |
1489 | 1489 | ||
1490 | if (neighbourRegion == null) | 1490 | if (neighbourRegion == null) |
1491 | { | ||
1492 | failureReason = "no region found"; // debug -> to remove | ||
1493 | return null; | 1491 | return null; |
1494 | } | 1492 | |
1495 | if (m_bannedRegionCache.IfBanned(neighbourRegion.RegionHandle, agentID)) | 1493 | if (m_bannedRegionCache.IfBanned(neighbourRegion.RegionHandle, agentID)) |
1496 | { | 1494 | { |
1497 | failureReason = "Access Denied"; | 1495 | failureReason = "Access Denied or Temporary not possible"; |
1498 | return null; | 1496 | return null; |
1499 | } | 1497 | } |
1500 | 1498 | ||
@@ -1506,14 +1504,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1506 | pos.Z); | 1504 | pos.Z); |
1507 | 1505 | ||
1508 | string homeURI = scene.GetAgentHomeURI(agentID); | 1506 | string homeURI = scene.GetAgentHomeURI(agentID); |
1509 | 1507 | ||
1510 | if (!scene.SimulationService.QueryAccess( | 1508 | if (!scene.SimulationService.QueryAccess( |
1511 | neighbourRegion, agentID, homeURI, false, newpos, | 1509 | neighbourRegion, agentID, homeURI, false, newpos, |
1512 | scene.GetFormatsOffered(), ctx, out failureReason)) | 1510 | scene.GetFormatsOffered(), ctx, out failureReason)) |
1513 | { | 1511 | { |
1514 | // remember the fail | 1512 | // remember the fail |
1515 | m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); | 1513 | m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); |
1516 | failureReason = "Access Denied"; | 1514 | if(String.IsNullOrWhiteSpace(failureReason)) |
1515 | failureReason = "Access Denied"; | ||
1517 | return null; | 1516 | return null; |
1518 | } | 1517 | } |
1519 | 1518 | ||
@@ -2171,7 +2170,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2171 | InformClientOfNeighbourAsync(sp, cagents[count], neighbour, ipe, true); | 2170 | InformClientOfNeighbourAsync(sp, cagents[count], neighbour, ipe, true); |
2172 | else | 2171 | else |
2173 | { | 2172 | { |
2174 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: DNS for neighbour {0} lost", neighbour.ExternalHostName); | 2173 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: lost DNS resolution for neighbour {0}", neighbour.ExternalHostName); |
2175 | } | 2174 | } |
2176 | count++; | 2175 | count++; |
2177 | } | 2176 | } |
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index b261675..f2bb52a 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | |||
@@ -70,9 +70,14 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
70 | { | 70 | { |
71 | Uri m_Uri = new Uri(m_ServerURL); | 71 | Uri m_Uri = new Uri(m_ServerURL); |
72 | IPAddress ip = Util.GetHostFromDNS(m_Uri.Host); | 72 | IPAddress ip = Util.GetHostFromDNS(m_Uri.Host); |
73 | m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString()); | 73 | if(ip != null) |
74 | if (!m_ServerURL.EndsWith("/")) | 74 | { |
75 | m_ServerURL += "/"; | 75 | m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString()); |
76 | if (!m_ServerURL.EndsWith("/")) | ||
77 | m_ServerURL += "/"; | ||
78 | } | ||
79 | else | ||
80 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Failed to resolv address of {0}", url); | ||
76 | } | 81 | } |
77 | catch (Exception e) | 82 | catch (Exception e) |
78 | { | 83 | { |