From ffe07527fcd95c1bd8a8d29432fe33e350354538 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 6 Jun 2014 11:04:53 -0700 Subject: Added simulation version compatibility check so that agents coming from 0.7.6 to a varregion running in 0.8 and above will be denied teleport, rather than be allowed and crash the viewer. --- .../EntityTransfer/EntityTransferModule.cs | 10 +++++---- .../Simulation/LocalSimulationConnector.cs | 26 +++++++++++++++++++--- .../Simulation/RemoteSimulationConnector.cs | 6 ++--- 3 files changed, 32 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index e583590..b157e6b 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -208,7 +208,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer protected virtual void InitialiseCommon(IConfigSource source) { string transferVersionName = "SIMULATION"; - float maxTransferVersion = 0.2f; + float maxTransferVersion = 0.3f; IConfig hypergridConfig = source.Configs["Hypergrid"]; if (hypergridConfig != null) @@ -760,8 +760,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer string reason; string version; + string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion); if (!Scene.SimulationService.QueryAccess( - finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, out version, out reason)) + finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, myversion, out version, out reason)) { sp.ControllingClient.SendTeleportFailed(reason); @@ -833,7 +834,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (versionComponents.Length >= 2) float.TryParse(versionComponents[1], out versionNumber); - if (versionNumber == 0.2f && MaxOutgoingTransferVersion >= versionNumber) + if (versionNumber >= 0.2f && MaxOutgoingTransferVersion >= versionNumber) TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason); else TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason); @@ -1509,8 +1510,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } // Check to see if we have access to the target region. + string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion); if (neighbourRegion != null - && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, out version, out failureReason)) + && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, myversion, out version, out failureReason)) { // remember banned m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index 926ef05..e6de0b6 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs @@ -52,6 +52,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation /// Currently valid versions are "SIMULATION/0.1" and "SIMULATION/0.2" /// public string ServiceVersion { get; set; } + private float m_VersionNumber = 0.3f; /// /// Map region ID to scene. @@ -84,15 +85,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation public void InitialiseService(IConfigSource configSource) { - ServiceVersion = "SIMULATION/0.2"; + ServiceVersion = "SIMULATION/0.3"; IConfig config = configSource.Configs["SimulationService"]; if (config != null) { ServiceVersion = config.GetString("ConnectorProtocolVersion", ServiceVersion); - if (ServiceVersion != "SIMULATION/0.1" && ServiceVersion != "SIMULATION/0.2") + if (ServiceVersion != "SIMULATION/0.1" && ServiceVersion != "SIMULATION/0.2" && ServiceVersion != "SIMULATION/0.3") throw new Exception(string.Format("Invalid ConnectorProtocolVersion {0}", ServiceVersion)); + string[] versionComponents = ServiceVersion.Split(new char[] { '/' }); + if (versionComponents.Length >= 2) + float.TryParse(versionComponents[1], out m_VersionNumber); + m_log.InfoFormat( "[LOCAL SIMULATION CONNECTOR]: Initialized with connector protocol version {0}", ServiceVersion); } @@ -264,7 +269,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation return true; } - public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string version, out string reason) + public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string theirversion, out string version, out string reason) { reason = "Communications failure"; version = ServiceVersion; @@ -276,6 +281,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation // m_log.DebugFormat( // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", // s.RegionInfo.RegionName, destination.RegionHandle); + uint size = m_scenes[destination.RegionID].RegionInfo.RegionSizeX; + + float theirVersionNumber = 0f; + string[] versionComponents = theirversion.Split(new char[] { '/' }); + if (versionComponents.Length >= 2) + float.TryParse(versionComponents[1], out theirVersionNumber); + + // Var regions here, and the requesting simulator is in an older version. + // We will forbide this, because it crashes the viewers + if (theirVersionNumber < 0.3f && size > 256) + { + reason = "Destination is a variable-sized region, and source is an old simulator. Consider upgrading."; + m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Request to access this variable-sized region from {0} simulator was denied", theirVersionNumber); + return false; + } return m_scenes[destination.RegionID].QueryAccess(agentID, agentHomeURI, viaTeleport, position, out reason); } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index 0444e49..6ecc327 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs @@ -207,7 +207,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation return m_remoteConnector.UpdateAgent(destination, cAgentData); } - public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string version, out string reason) + public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, out string version, out string reason) { reason = "Communications failure"; version = "Unknown"; @@ -216,12 +216,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation return false; // Try local first - if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, out version, out reason)) + if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, out version, out reason)) return true; // else do the remote thing if (!m_localBackend.IsLocalRegion(destination.RegionID)) - return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, out version, out reason); + return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, out version, out reason); return false; } -- cgit v1.1