diff options
author | Diva Canto | 2014-06-06 11:04:53 -0700 |
---|---|---|
committer | Justin Clark-Casey | 2014-06-10 20:28:47 +0100 |
commit | ffe07527fcd95c1bd8a8d29432fe33e350354538 (patch) | |
tree | 614ff2e79275c3aef16bd55be8345e68eb4e6ebd /OpenSim | |
parent | Better comment regarding SizeX and SizeY (diff) | |
download | opensim-SC_OLD-ffe07527fcd95c1bd8a8d29432fe33e350354538.zip opensim-SC_OLD-ffe07527fcd95c1bd8a8d29432fe33e350354538.tar.gz opensim-SC_OLD-ffe07527fcd95c1bd8a8d29432fe33e350354538.tar.bz2 opensim-SC_OLD-ffe07527fcd95c1bd8a8d29432fe33e350354538.tar.xz |
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.
Diffstat (limited to 'OpenSim')
6 files changed, 42 insertions, 14 deletions
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 | |||
208 | protected virtual void InitialiseCommon(IConfigSource source) | 208 | protected virtual void InitialiseCommon(IConfigSource source) |
209 | { | 209 | { |
210 | string transferVersionName = "SIMULATION"; | 210 | string transferVersionName = "SIMULATION"; |
211 | float maxTransferVersion = 0.2f; | 211 | float maxTransferVersion = 0.3f; |
212 | 212 | ||
213 | IConfig hypergridConfig = source.Configs["Hypergrid"]; | 213 | IConfig hypergridConfig = source.Configs["Hypergrid"]; |
214 | if (hypergridConfig != null) | 214 | if (hypergridConfig != null) |
@@ -760,8 +760,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
760 | 760 | ||
761 | string reason; | 761 | string reason; |
762 | string version; | 762 | string version; |
763 | string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion); | ||
763 | if (!Scene.SimulationService.QueryAccess( | 764 | if (!Scene.SimulationService.QueryAccess( |
764 | finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, out version, out reason)) | 765 | finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, myversion, out version, out reason)) |
765 | { | 766 | { |
766 | sp.ControllingClient.SendTeleportFailed(reason); | 767 | sp.ControllingClient.SendTeleportFailed(reason); |
767 | 768 | ||
@@ -833,7 +834,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
833 | if (versionComponents.Length >= 2) | 834 | if (versionComponents.Length >= 2) |
834 | float.TryParse(versionComponents[1], out versionNumber); | 835 | float.TryParse(versionComponents[1], out versionNumber); |
835 | 836 | ||
836 | if (versionNumber == 0.2f && MaxOutgoingTransferVersion >= versionNumber) | 837 | if (versionNumber >= 0.2f && MaxOutgoingTransferVersion >= versionNumber) |
837 | TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason); | 838 | TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason); |
838 | else | 839 | else |
839 | TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason); | 840 | 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 | |||
1509 | } | 1510 | } |
1510 | 1511 | ||
1511 | // Check to see if we have access to the target region. | 1512 | // Check to see if we have access to the target region. |
1513 | string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion); | ||
1512 | if (neighbourRegion != null | 1514 | if (neighbourRegion != null |
1513 | && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, out version, out failureReason)) | 1515 | && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, myversion, out version, out failureReason)) |
1514 | { | 1516 | { |
1515 | // remember banned | 1517 | // remember banned |
1516 | m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); | 1518 | 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 | |||
52 | /// Currently valid versions are "SIMULATION/0.1" and "SIMULATION/0.2" | 52 | /// Currently valid versions are "SIMULATION/0.1" and "SIMULATION/0.2" |
53 | /// </remarks> | 53 | /// </remarks> |
54 | public string ServiceVersion { get; set; } | 54 | public string ServiceVersion { get; set; } |
55 | private float m_VersionNumber = 0.3f; | ||
55 | 56 | ||
56 | /// <summary> | 57 | /// <summary> |
57 | /// Map region ID to scene. | 58 | /// Map region ID to scene. |
@@ -84,15 +85,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
84 | 85 | ||
85 | public void InitialiseService(IConfigSource configSource) | 86 | public void InitialiseService(IConfigSource configSource) |
86 | { | 87 | { |
87 | ServiceVersion = "SIMULATION/0.2"; | 88 | ServiceVersion = "SIMULATION/0.3"; |
88 | IConfig config = configSource.Configs["SimulationService"]; | 89 | IConfig config = configSource.Configs["SimulationService"]; |
89 | if (config != null) | 90 | if (config != null) |
90 | { | 91 | { |
91 | ServiceVersion = config.GetString("ConnectorProtocolVersion", ServiceVersion); | 92 | ServiceVersion = config.GetString("ConnectorProtocolVersion", ServiceVersion); |
92 | 93 | ||
93 | if (ServiceVersion != "SIMULATION/0.1" && ServiceVersion != "SIMULATION/0.2") | 94 | if (ServiceVersion != "SIMULATION/0.1" && ServiceVersion != "SIMULATION/0.2" && ServiceVersion != "SIMULATION/0.3") |
94 | throw new Exception(string.Format("Invalid ConnectorProtocolVersion {0}", ServiceVersion)); | 95 | throw new Exception(string.Format("Invalid ConnectorProtocolVersion {0}", ServiceVersion)); |
95 | 96 | ||
97 | string[] versionComponents = ServiceVersion.Split(new char[] { '/' }); | ||
98 | if (versionComponents.Length >= 2) | ||
99 | float.TryParse(versionComponents[1], out m_VersionNumber); | ||
100 | |||
96 | m_log.InfoFormat( | 101 | m_log.InfoFormat( |
97 | "[LOCAL SIMULATION CONNECTOR]: Initialized with connector protocol version {0}", ServiceVersion); | 102 | "[LOCAL SIMULATION CONNECTOR]: Initialized with connector protocol version {0}", ServiceVersion); |
98 | } | 103 | } |
@@ -264,7 +269,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
264 | return true; | 269 | return true; |
265 | } | 270 | } |
266 | 271 | ||
267 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string version, out string reason) | 272 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string theirversion, out string version, out string reason) |
268 | { | 273 | { |
269 | reason = "Communications failure"; | 274 | reason = "Communications failure"; |
270 | version = ServiceVersion; | 275 | version = ServiceVersion; |
@@ -276,6 +281,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
276 | // m_log.DebugFormat( | 281 | // m_log.DebugFormat( |
277 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", | 282 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", |
278 | // s.RegionInfo.RegionName, destination.RegionHandle); | 283 | // s.RegionInfo.RegionName, destination.RegionHandle); |
284 | uint size = m_scenes[destination.RegionID].RegionInfo.RegionSizeX; | ||
285 | |||
286 | float theirVersionNumber = 0f; | ||
287 | string[] versionComponents = theirversion.Split(new char[] { '/' }); | ||
288 | if (versionComponents.Length >= 2) | ||
289 | float.TryParse(versionComponents[1], out theirVersionNumber); | ||
290 | |||
291 | // Var regions here, and the requesting simulator is in an older version. | ||
292 | // We will forbide this, because it crashes the viewers | ||
293 | if (theirVersionNumber < 0.3f && size > 256) | ||
294 | { | ||
295 | reason = "Destination is a variable-sized region, and source is an old simulator. Consider upgrading."; | ||
296 | m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Request to access this variable-sized region from {0} simulator was denied", theirVersionNumber); | ||
297 | return false; | ||
298 | } | ||
279 | 299 | ||
280 | return m_scenes[destination.RegionID].QueryAccess(agentID, agentHomeURI, viaTeleport, position, out reason); | 300 | return m_scenes[destination.RegionID].QueryAccess(agentID, agentHomeURI, viaTeleport, position, out reason); |
281 | } | 301 | } |
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 | |||
207 | return m_remoteConnector.UpdateAgent(destination, cAgentData); | 207 | return m_remoteConnector.UpdateAgent(destination, cAgentData); |
208 | } | 208 | } |
209 | 209 | ||
210 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string version, out string reason) | 210 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, out string version, out string reason) |
211 | { | 211 | { |
212 | reason = "Communications failure"; | 212 | reason = "Communications failure"; |
213 | version = "Unknown"; | 213 | version = "Unknown"; |
@@ -216,12 +216,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
216 | return false; | 216 | return false; |
217 | 217 | ||
218 | // Try local first | 218 | // Try local first |
219 | if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, out version, out reason)) | 219 | if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, out version, out reason)) |
220 | return true; | 220 | return true; |
221 | 221 | ||
222 | // else do the remote thing | 222 | // else do the remote thing |
223 | if (!m_localBackend.IsLocalRegion(destination.RegionID)) | 223 | if (!m_localBackend.IsLocalRegion(destination.RegionID)) |
224 | return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, out version, out reason); | 224 | return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, out version, out reason); |
225 | 225 | ||
226 | return false; | 226 | return false; |
227 | } | 227 | } |
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 7291931..6d3a3a7 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -144,12 +144,16 @@ namespace OpenSim.Server.Handlers.Simulation | |||
144 | if (args.ContainsKey("agent_home_uri")) | 144 | if (args.ContainsKey("agent_home_uri")) |
145 | agentHomeURI = args["agent_home_uri"].AsString(); | 145 | agentHomeURI = args["agent_home_uri"].AsString(); |
146 | 146 | ||
147 | string theirVersion = string.Empty; | ||
148 | if (args.ContainsKey("my_version")) | ||
149 | theirVersion = args["my_version"].AsString(); | ||
150 | |||
147 | GridRegion destination = new GridRegion(); | 151 | GridRegion destination = new GridRegion(); |
148 | destination.RegionID = regionID; | 152 | destination.RegionID = regionID; |
149 | 153 | ||
150 | string reason; | 154 | string reason; |
151 | string version; | 155 | string version; |
152 | bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, out version, out reason); | 156 | bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, theirVersion, out version, out reason); |
153 | 157 | ||
154 | responsedata["int_response_code"] = HttpStatusCode.OK; | 158 | responsedata["int_response_code"] = HttpStatusCode.OK; |
155 | 159 | ||
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 099ba98..b6fde72 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -282,7 +282,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
282 | } | 282 | } |
283 | 283 | ||
284 | 284 | ||
285 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string version, out string reason) | 285 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string myversion, out string version, out string reason) |
286 | { | 286 | { |
287 | reason = "Failed to contact destination"; | 287 | reason = "Failed to contact destination"; |
288 | version = "Unknown"; | 288 | version = "Unknown"; |
@@ -298,6 +298,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
298 | OSDMap request = new OSDMap(); | 298 | OSDMap request = new OSDMap(); |
299 | request.Add("viaTeleport", OSD.FromBoolean(viaTeleport)); | 299 | request.Add("viaTeleport", OSD.FromBoolean(viaTeleport)); |
300 | request.Add("position", OSD.FromString(position.ToString())); | 300 | request.Add("position", OSD.FromString(position.ToString())); |
301 | request.Add("my_version", OSD.FromString(myversion)); | ||
301 | if (agentHomeURI != null) | 302 | if (agentHomeURI != null) |
302 | request.Add("agent_home_uri", OSD.FromString(agentHomeURI)); | 303 | request.Add("agent_home_uri", OSD.FromString(agentHomeURI)); |
303 | 304 | ||
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs index 8b87ac0..12ab478 100644 --- a/OpenSim/Services/Interfaces/ISimulationService.cs +++ b/OpenSim/Services/Interfaces/ISimulationService.cs | |||
@@ -85,10 +85,11 @@ namespace OpenSim.Services.Interfaces | |||
85 | /// <param name="agentHomeURI">The visitor's Home URI. Will be missing (null) in older OpenSims.</param> | 85 | /// <param name="agentHomeURI">The visitor's Home URI. Will be missing (null) in older OpenSims.</param> |
86 | /// <param name="viaTeleport">True: via teleport; False: via cross (walking)</param> | 86 | /// <param name="viaTeleport">True: via teleport; False: via cross (walking)</param> |
87 | /// <param name="position">Position in the region</param> | 87 | /// <param name="position">Position in the region</param> |
88 | /// <param name="version"></param> | 88 | /// <param name="sversion">version that the requesting simulator is runing</param> |
89 | /// <param name="version">version that the target simulator is running</param> | ||
89 | /// <param name="reason">[out] Optional error message</param> | 90 | /// <param name="reason">[out] Optional error message</param> |
90 | /// <returns>True: ok; False: not allowed</returns> | 91 | /// <returns>True: ok; False: not allowed</returns> |
91 | bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string version, out string reason); | 92 | bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, out string version, out string reason); |
92 | 93 | ||
93 | /// <summary> | 94 | /// <summary> |
94 | /// Message from receiving region to departing region, telling it got contacted by the client. | 95 | /// Message from receiving region to departing region, telling it got contacted by the client. |