diff --git a/OpenSim/Client/Linden/LLStandaloneLoginService.cs b/OpenSim/Client/Linden/LLStandaloneLoginService.cs index 73cc7a3cc1..ea3a74a747 100644 --- a/OpenSim/Client/Linden/LLStandaloneLoginService.cs +++ b/OpenSim/Client/Linden/LLStandaloneLoginService.cs @@ -163,11 +163,17 @@ namespace OpenSim.Client.Linden if (m_serversInfo.HttpUsesSSL) { - seedcap = "https://" + m_serversInfo.HttpSSLCN + ":" + m_serversInfo.httpSSLPort + capsSeedPath; + // For NAT + string host = NetworkUtil.GetHostFor(remoteClient.Address, m_serversInfo.HttpSSLCN); + + seedcap = "https://" + host + ":" + m_serversInfo.httpSSLPort + capsSeedPath; } else { - seedcap = "http://" + regionInfo.ExternalHostName + ":" + m_serversInfo.HttpListenerPort + capsSeedPath; + // For NAT + string host = NetworkUtil.GetHostFor(remoteClient.Address, regionInfo.ExternalHostName); + + seedcap = "http://" + host + ":" + m_serversInfo.HttpListenerPort + capsSeedPath; } response.SeedCapability = seedcap; diff --git a/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs b/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs index 1de0d4d8a7..0637a1e2a3 100644 --- a/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs +++ b/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs @@ -279,11 +279,17 @@ namespace OpenSim.Framework.Communications.Services if (m_serversInfo.HttpUsesSSL) { - seedcap = "https://" + m_serversInfo.HttpSSLCN + ":" + regionInfo.HttpPort + capsSeedPath; + // For NAT + string host = NetworkUtil.GetHostFor(remoteClient.Address, m_serversInfo.HttpSSLCN); + + seedcap = "https://" + host + ":" + m_serversInfo.httpSSLPort + capsSeedPath; } else { - seedcap = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + capsSeedPath; + // For NAT + string host = NetworkUtil.GetHostFor(remoteClient.Address, regionInfo.ExternalHostName); + + seedcap = "http://" + host + ":" + m_serversInfo.HttpListenerPort + capsSeedPath; } response.SeedCapability = seedcap; diff --git a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs index 323dc480d7..bb032525e7 100644 --- a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs +++ b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs @@ -270,10 +270,12 @@ namespace OpenSim.Grid.UserServer.Modules string capsPath = CapsUtil.GetRandomCapsObjectPath(); - // Take off trailing / so that the caps path isn't //CAPS/someUUID - if (regionInfo.httpServerURI.EndsWith("/")) - regionInfo.httpServerURI = regionInfo.httpServerURI.Substring(0, regionInfo.httpServerURI.Length - 1); - response.SeedCapability = regionInfo.httpServerURI + CapsUtil.GetCapsSeedPath(capsPath); + // For NAT + string host = NetworkUtil.GetHostFor(remoteClient.Address, regionInfo.ServerIP); + // TODO: This doesnt support SSL. -Adam + string serverURI = "http://" + host + ":" + regionInfo.ServerPort; + + response.SeedCapability = serverURI + CapsUtil.GetCapsSeedPath(capsPath); // Notify the target of an incoming user m_log.InfoFormat( diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 85a3d96e5d..b89a5f2b3b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -812,17 +812,32 @@ namespace OpenSim.Region.Framework.Scenes if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) { - capsPath - = "http://" - + reg.ExternalHostName - + ":" - + reg.HttpPort - + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); + #region IP Translation for NAT + IClientIPEndpoint ipepClient; + if (avatar.ClientView.TryGet(out ipepClient)) + { + capsPath + = "http://" + + NetworkUtil.GetHostFor(ipepClient.EndPoint, reg.ExternalHostName) + + ":" + + reg.HttpPort + + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); + } + else + { + capsPath + = "http://" + + reg.ExternalHostName + + ":" + + reg.HttpPort + + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); + } + #endregion if (eq != null) { #region IP Translation for NAT - IClientIPEndpoint ipepClient; + // Uses ipepClient above if (avatar.ClientView.TryGet(out ipepClient)) { endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address);