aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2017-05-25 09:46:29 +0100
committerUbitUmarov2017-05-25 09:46:29 +0100
commit31b4a3124692a2b73a42bb994a61012d747b830c (patch)
tree9753d4a67655fa776de4b55894622d957b97d83d /OpenSim
parentmove assetsconnector threads to whatchdog; Abort all alive threads known to w... (diff)
downloadopensim-SC-31b4a3124692a2b73a42bb994a61012d747b830c.zip
opensim-SC-31b4a3124692a2b73a42bb994a61012d747b830c.tar.gz
opensim-SC-31b4a3124692a2b73a42bb994a61012d747b830c.tar.bz2
opensim-SC-31b4a3124692a2b73a42bb994a61012d747b830c.tar.xz
add some checks for valid endpoints
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs52
-rw-r--r--OpenSim/Services/Interfaces/IGridService.cs40
2 files changed, 33 insertions, 59 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 4b846f5..ca20604 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -527,15 +527,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
527 { 527 {
528 string homeURI = Scene.GetAgentHomeURI(sp.ControllingClient.AgentId); 528 string homeURI = Scene.GetAgentHomeURI(sp.ControllingClient.AgentId);
529 529
530 string message; 530 string reason = String.Empty;
531 finalDestination = GetFinalDestination(reg, sp.ControllingClient.AgentId, homeURI, out message); 531 finalDestination = GetFinalDestination(reg, sp.ControllingClient.AgentId, homeURI, out reason);
532 532
533 if (finalDestination == null) 533 if (finalDestination == null)
534 { 534 {
535 m_log.WarnFormat( "{0} Final destination is having problems. Unable to teleport {1} {2}: {3}", 535 m_log.WarnFormat( "{0} Final destination is having problems. Unable to teleport {1} {2}: {3}",
536 LogHeader, sp.Name, sp.UUID, message); 536 LogHeader, sp.Name, sp.UUID, reason);
537 537
538 sp.ControllingClient.SendTeleportFailed(message); 538 sp.ControllingClient.SendTeleportFailed(reason);
539 return; 539 return;
540 } 540 }
541 541
@@ -548,17 +548,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
548 return; 548 return;
549 } 549 }
550 550
551 // Validate assorted conditions
552 string reason = string.Empty;
553 if (!ValidateGenericConditions(sp, reg, finalDestination, teleportFlags, out reason)) 551 if (!ValidateGenericConditions(sp, reg, finalDestination, teleportFlags, out reason))
554 { 552 {
555 sp.ControllingClient.SendTeleportFailed(reason); 553 sp.ControllingClient.SendTeleportFailed(reason);
556 return; 554 return;
557 } 555 }
558 556
559 if (message != null)
560 sp.ControllingClient.SendAgentAlertMessage(message, true);
561
562 // 557 //
563 // This is it 558 // This is it
564 // 559 //
@@ -735,8 +730,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
735 IPEndPoint endPoint = finalDestination.ExternalEndPoint; 730 IPEndPoint endPoint = finalDestination.ExternalEndPoint;
736 if (endPoint == null || endPoint.Address == null) 731 if (endPoint == null || endPoint.Address == null)
737 { 732 {
738 sp.ControllingClient.SendTeleportFailed("Remote Region appears to be down"); 733 sp.ControllingClient.SendTeleportFailed("Could not resolve destination Address");
739
740 return; 734 return;
741 } 735 }
742 736
@@ -784,22 +778,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
784 // At least on LL 3.3.4, this is not strictly necessary - a teleport will succeed without sending this to 778 // At least on LL 3.3.4, this is not strictly necessary - a teleport will succeed without sending this to
785 // the viewer. However, it might mean that the viewer does not see the black teleport screen (untested). 779 // the viewer. However, it might mean that the viewer does not see the black teleport screen (untested).
786 sp.ControllingClient.SendTeleportStart(teleportFlags); 780 sp.ControllingClient.SendTeleportStart(teleportFlags);
787 781
788 // the avatar.Close below will clear the child region list. We need this below for (possibly)
789 // closing the child agents, so save it here (we need a copy as it is Clear()-ed).
790 //List<ulong> childRegions = avatar.KnownRegionHandles;
791 // Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport
792 // failure at this point (unlike a border crossing failure). So perhaps this can never fail
793 // once we reach here...
794 //avatar.Scene.RemoveCapsHandler(avatar.UUID);
795
796 AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); 782 AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
797 AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo(); 783 AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo();
798 agentCircuit.startpos = position; 784 agentCircuit.startpos = position;
799 agentCircuit.child = true; 785 agentCircuit.child = true;
800 786
801// agentCircuit.Appearance = sp.Appearance;
802// agentCircuit.Appearance = new AvatarAppearance(sp.Appearance, true, false);
803 agentCircuit.Appearance = new AvatarAppearance(); 787 agentCircuit.Appearance = new AvatarAppearance();
804 agentCircuit.Appearance.AvatarHeight = sp.Appearance.AvatarHeight; 788 agentCircuit.Appearance.AvatarHeight = sp.Appearance.AvatarHeight;
805 789
@@ -1673,6 +1657,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1673 return agent; 1657 return agent;
1674 } 1658 }
1675 1659
1660 IPEndPoint endpoint = neighbourRegion.ExternalEndPoint;
1661 if(endpoint == null)
1662 {
1663 m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: failed to resolve neighbour address {0} ",neighbourRegion.ExternalHostName);
1664 return agent;
1665 }
1666
1676 m_entityTransferStateMachine.SetInTransit(agent.UUID); 1667 m_entityTransferStateMachine.SetInTransit(agent.UUID);
1677 agent.RemoveFromPhysicalScene(); 1668 agent.RemoveFromPhysicalScene();
1678 1669
@@ -1683,7 +1674,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1683 return agent; 1674 return agent;
1684 } 1675 }
1685 1676
1686 CrossAgentToNewRegionPost(agent, pos, neighbourRegion, isFlying, ctx); 1677 CrossAgentToNewRegionPost(agent, pos, neighbourRegion, endpoint, isFlying, ctx);
1687 } 1678 }
1688 catch (Exception e) 1679 catch (Exception e)
1689 { 1680 {
@@ -1727,6 +1718,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1727 agent.AddNeighbourRegion(neighbourRegion, agentCircuit.CapsPath); 1718 agent.AddNeighbourRegion(neighbourRegion, agentCircuit.CapsPath);
1728 1719
1729 IPEndPoint endPoint = neighbourRegion.ExternalEndPoint; 1720 IPEndPoint endPoint = neighbourRegion.ExternalEndPoint;
1721 if(endPoint == null)
1722 {
1723 m_log.DebugFormat("CrossAgentCreateFarChild failed to resolve neighbour address {0}", neighbourRegion.ExternalHostName);
1724 return false;
1725 }
1730 if (Scene.SimulationService.CreateAgent(source, neighbourRegion, agentCircuit, (int)TeleportFlags.Default, ctx, out reason)) 1726 if (Scene.SimulationService.CreateAgent(source, neighbourRegion, agentCircuit, (int)TeleportFlags.Default, ctx, out reason))
1731 { 1727 {
1732 string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); 1728 string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
@@ -1821,7 +1817,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1821 } 1817 }
1822 1818
1823 public void CrossAgentToNewRegionPost(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, 1819 public void CrossAgentToNewRegionPost(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion,
1824 bool isFlying, EntityTransferContext ctx) 1820 IPEndPoint endpoint, bool isFlying, EntityTransferContext ctx)
1825 { 1821 {
1826 1822
1827 string agentcaps; 1823 string agentcaps;
@@ -1848,15 +1844,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1848 { 1844 {
1849 m_eqModule.CrossRegion( 1845 m_eqModule.CrossRegion(
1850 neighbourRegion.RegionHandle, pos, vel2 /* agent.Velocity */, 1846 neighbourRegion.RegionHandle, pos, vel2 /* agent.Velocity */,
1851 neighbourRegion.ExternalEndPoint, 1847 endpoint, capsPath, agent.UUID, agent.ControllingClient.SessionId,
1852 capsPath, agent.UUID, agent.ControllingClient.SessionId,
1853 neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY); 1848 neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY);
1854 } 1849 }
1855 else 1850 else
1856 { 1851 {
1857 m_log.ErrorFormat("{0} Using old CrossRegion packet. Varregion will not work!!", LogHeader); 1852 m_log.ErrorFormat("{0} Using old CrossRegion packet. Varregion will not work!!", LogHeader);
1858 agent.ControllingClient.CrossRegion(neighbourRegion.RegionHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, 1853 agent.ControllingClient.CrossRegion(neighbourRegion.RegionHandle, pos, agent.Velocity,
1859 capsPath); 1854 endpoint,capsPath);
1860 } 1855 }
1861 1856
1862 // SUCCESS! 1857 // SUCCESS!
@@ -1953,7 +1948,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1953 1948
1954 seeds.Add(regionhandler, agent.CapsPath); 1949 seeds.Add(regionhandler, agent.CapsPath);
1955 1950
1956
1957// agent.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds); 1951// agent.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds);
1958 agent.ChildrenCapSeeds = null; 1952 agent.ChildrenCapSeeds = null;
1959 1953
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index 66e5870..8068ff5 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -271,31 +271,6 @@ namespace OpenSim.Services.Interfaces
271 m_serverURI = string.Empty; 271 m_serverURI = string.Empty;
272 } 272 }
273 273
274 /*
275 public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri)
276 {
277 m_regionLocX = regionLocX;
278 m_regionLocY = regionLocY;
279 RegionSizeX = (int)Constants.RegionSize;
280 RegionSizeY = (int)Constants.RegionSize;
281
282 m_internalEndPoint = internalEndPoint;
283 m_externalHostName = externalUri;
284 }
285
286 public GridRegion(int regionLocX, int regionLocY, string externalUri, uint port)
287 {
288 m_regionLocX = regionLocX;
289 m_regionLocY = regionLocY;
290 RegionSizeX = (int)Constants.RegionSize;
291 RegionSizeY = (int)Constants.RegionSize;
292
293 m_externalHostName = externalUri;
294
295 m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)port);
296 }
297 */
298
299 public GridRegion(uint xcell, uint ycell) 274 public GridRegion(uint xcell, uint ycell)
300 { 275 {
301 m_regionLocX = (int)Util.RegionToWorldLoc(xcell); 276 m_regionLocX = (int)Util.RegionToWorldLoc(xcell);
@@ -489,14 +464,16 @@ namespace OpenSim.Services.Interfaces
489 { 464 {
490 get 465 get
491 { 466 {
492 // Old one defaults to IPv6
493 //return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port);
494
495 IPAddress ia = null; 467 IPAddress ia = null;
496 // If it is already an IP, don't resolve it - just return directly 468 // If it is already an IP, don't resolve it - just return directly
469 // we should not need this
497 if (IPAddress.TryParse(m_externalHostName, out ia)) 470 if (IPAddress.TryParse(m_externalHostName, out ia))
471 {
472 if (ia.Equals(IPAddress.Any) || ia.Equals(IPAddress.IPv6Any))
473 return null;
498 return new IPEndPoint(ia, m_internalEndPoint.Port); 474 return new IPEndPoint(ia, m_internalEndPoint.Port);
499 475 }
476
500 // Reset for next check 477 // Reset for next check
501 ia = null; 478 ia = null;
502 try 479 try
@@ -513,7 +490,7 @@ namespace OpenSim.Services.Interfaces
513 } 490 }
514 } 491 }
515 } 492 }
516 catch (SocketException e) 493 catch // (SocketException e)
517 { 494 {
518 /*throw new Exception( 495 /*throw new Exception(
519 "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + 496 "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" +
@@ -524,6 +501,9 @@ namespace OpenSim.Services.Interfaces
524 return null; 501 return null;
525 } 502 }
526 503
504 if(ia == null)
505 return null;
506
527 return new IPEndPoint(ia, m_internalEndPoint.Port); 507 return new IPEndPoint(ia, m_internalEndPoint.Port);
528 } 508 }
529 } 509 }