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.

bullet-2.82
Diva Canto 2014-06-06 11:04:53 -07:00
parent 90de9df3e8
commit fe779128b0
10 changed files with 67 additions and 23 deletions

View File

@ -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);
@ -834,7 +835,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);
@ -1510,8 +1511,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);

View File

@ -52,6 +52,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
/// Currently valid versions are "SIMULATION/0.1" and "SIMULATION/0.2"
/// </remarks>
public string ServiceVersion { get; set; }
private float m_VersionNumber = 0.3f;
/// <summary>
/// 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);
}

View File

@ -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;
}

View File

@ -144,12 +144,16 @@ namespace OpenSim.Server.Handlers.Simulation
if (args.ContainsKey("agent_home_uri"))
agentHomeURI = args["agent_home_uri"].AsString();
string theirVersion = string.Empty;
if (args.ContainsKey("my_version"))
theirVersion = args["my_version"].AsString();
GridRegion destination = new GridRegion();
destination.RegionID = regionID;
string reason;
string version;
bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, out version, out reason);
bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, theirVersion, out version, out reason);
responsedata["int_response_code"] = HttpStatusCode.OK;

View File

@ -282,7 +282,7 @@ namespace OpenSim.Services.Connectors.Simulation
}
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 myversion, out string version, out string reason)
{
reason = "Failed to contact destination";
version = "Unknown";
@ -298,6 +298,7 @@ namespace OpenSim.Services.Connectors.Simulation
OSDMap request = new OSDMap();
request.Add("viaTeleport", OSD.FromBoolean(viaTeleport));
request.Add("position", OSD.FromString(position.ToString()));
request.Add("my_version", OSD.FromString(myversion));
if (agentHomeURI != null)
request.Add("agent_home_uri", OSD.FromString(agentHomeURI));

View File

@ -85,10 +85,11 @@ namespace OpenSim.Services.Interfaces
/// <param name="agentHomeURI">The visitor's Home URI. Will be missing (null) in older OpenSims.</param>
/// <param name="viaTeleport">True: via teleport; False: via cross (walking)</param>
/// <param name="position">Position in the region</param>
/// <param name="version"></param>
/// <param name="sversion">version that the requesting simulator is runing</param>
/// <param name="version">version that the target simulator is running</param>
/// <param name="reason">[out] Optional error message</param>
/// <returns>True: ok; False: not allowed</returns>
bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string version, out string reason);
bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, out string version, out string reason);
/// <summary>
/// Message from receiving region to departing region, telling it got contacted by the client.

View File

@ -33,13 +33,17 @@
[SimulationService]
; This is the protocol version which the simulator advertises to the source destination when acting as a target destination for a teleport
; It is used to control the teleport handoff process.
; Valid values are
; Valid values are
; "SIMULATION/0.3"
; - This is the default, and it supports teleports to variable-sized regions
; - Older versions can teleport to this one, but only if the destination region
; is 256x256
; "SIMULATION/0.2"
; - this is the default. A source simulator which only implements "SIMULATION/0.1" can still teleport with that protocol
; - A source simulator which only implements "SIMULATION/0.1" can still teleport with that protocol
; - this protocol is more efficient than "SIMULATION/0.1"
; "SIMULATION/0.1"
; - this is an older teleport protocol used in OpenSimulator 0.7.5 and before.
ConnectorProtocolVersion = "SIMULATION/0.2"
ConnectorProtocolVersion = "SIMULATION/0.3"
[SimulationDataStore]
LocalServiceModule = "OpenSim.Services.Connectors.dll:SimulationDataService"

View File

@ -39,12 +39,16 @@
; This is the protocol version which the simulator advertises to the source destination when acting as a target destination for a teleport
; It is used to control the teleport handoff process.
; Valid values are
; "SIMULATION/0.3"
; - This is the default, and it supports teleports to variable-sized regions
; - Older versions can teleport to this one, but only if the destination region
; is 256x256
; "SIMULATION/0.2"
; - this is the default. A source simulator which only implements "SIMULATION/0.1" can still teleport with that protocol
; - A source simulator which only implements "SIMULATION/0.1" can still teleport with that protocol
; - this protocol is more efficient than "SIMULATION/0.1"
; "SIMULATION/0.1"
; - this is an older teleport protocol used in OpenSimulator 0.7.5 and before.
ConnectorProtocolVersion = "SIMULATION/0.2"
ConnectorProtocolVersion = "SIMULATION/0.3"
[Profile]
Module = "BasicProfileModule"

View File

@ -31,12 +31,16 @@
; This is the protocol version which the simulator advertises to the source destination when acting as a target destination for a teleport
; It is used to control the teleport handoff process.
; Valid values are
; "SIMULATION/0.3"
; - This is the default, and it supports teleports to variable-sized regions
; - Older versions can teleport to this one, but only if the destination region
; is 256x256
; "SIMULATION/0.2"
; - this is the default. A source simulator which only implements "SIMULATION/0.1" can still teleport with that protocol
; - A source simulator which only implements "SIMULATION/0.1" can still teleport with that protocol
; - this protocol is more efficient than "SIMULATION/0.1"
; "SIMULATION/0.1"
; - this is an older teleport protocol used in OpenSimulator 0.7.5 and before.
ConnectorProtocolVersion = "SIMULATION/0.2"
ConnectorProtocolVersion = "SIMULATION/0.3"
[SimulationDataStore]
LocalServiceModule = "OpenSim.Services.Connectors.dll:SimulationDataService"

View File

@ -42,12 +42,16 @@
; This is the protocol version which the simulator advertises to the source destination when acting as a target destination for a teleport
; It is used to control the teleport handoff process.
; Valid values are
; "SIMULATION/0.3"
; - This is the default, and it supports teleports to variable-sized regions
; - Older versions can teleport to this one, but only if the destination region
; is 256x256
; "SIMULATION/0.2"
; - this is the default. A source simulator which only implements "SIMULATION/0.1" can still teleport with that protocol
; - A source simulator which only implements "SIMULATION/0.1" can still teleport with that protocol
; - this protocol is more efficient than "SIMULATION/0.1"
; "SIMULATION/0.1"
; - this is an older teleport protocol used in OpenSimulator 0.7.5 and before.
ConnectorProtocolVersion = "SIMULATION/0.2"
ConnectorProtocolVersion = "SIMULATION/0.3"
[Messaging]
MessageTransferModule = HGMessageTransferModule