From e80bcc0049c9e60e052969aaf8582fa2b867f879 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 9 Jan 2011 16:52:41 -0800 Subject: Improved debug messages to track what is going on with the XFF header --- OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs | 2 ++ OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | 2 ++ OpenSim/Services/HypergridService/UserAgentService.cs | 12 +++++++----- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs index a5ec4f2..0066bd4 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs @@ -217,6 +217,8 @@ namespace OpenSim.Server.Handlers.Hypergrid Hashtable headers = (Hashtable)request["headers"]; if (headers.ContainsKey("X-Forwarded-For") && headers["X-Forwarded-For"] != null) { + m_log.DebugFormat("[HOME AGENT HANDLER]: XFF is {0}", headers["X-Forwarded-For"]); + IPEndPoint ep = Util.GetClientIPFromXFF((string)headers["X-Forwarded-For"]); if (ep != null) return ep.Address.ToString(); diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 24ae81f..9c41bcb 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs @@ -202,6 +202,8 @@ namespace OpenSim.Server.Handlers.Simulation Hashtable headers = (Hashtable)request["headers"]; if (headers.ContainsKey("X-Forwarded-For") && headers["X-Forwarded-For"] != null) { + m_log.DebugFormat("[AGENT HANDLER]: XFF is {0}", headers["X-Forwarded-For"]); + IPEndPoint ep = Util.GetClientIPFromXFF((string)headers["X-Forwarded-For"]); if (ep != null) return ep.Address.ToString(); diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index 12dda48..3ead180 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -155,7 +155,7 @@ namespace OpenSim.Services.HypergridService string myExternalIP = string.Empty; string gridName = gatekeeper.ServerURI; - m_log.DebugFormat("[USER AGENT SERVICE]: m_grid - {0}, gn - {1}", m_GridName, gridName); + m_log.DebugFormat("[USER AGENT SERVICE]: this grid: {0}, desired grid: {1}", m_GridName, gridName); if (m_GridName == gridName) success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason); @@ -266,11 +266,13 @@ namespace OpenSim.Services.HypergridService if (m_TravelingAgents.ContainsKey(sessionID)) { - m_log.DebugFormat("[USER AGENT SERVICE]: Comparing with login IP {0} and MyIP {1}", - m_TravelingAgents[sessionID].ClientIPAddress, m_TravelingAgents[sessionID].MyIpAddress); - - return m_TravelingAgents[sessionID].ClientIPAddress == reportedIP || + bool result = m_TravelingAgents[sessionID].ClientIPAddress == reportedIP || m_TravelingAgents[sessionID].MyIpAddress == reportedIP; // NATed + + m_log.DebugFormat("[USER AGENT SERVICE]: Comparing {0} with login IP {1} and MyIP {1}; result is {3}", + reportedIP, m_TravelingAgents[sessionID].ClientIPAddress, m_TravelingAgents[sessionID].MyIpAddress, result); + + return result; } return false; -- cgit v1.1