From 93dffe17773ee5af552ac64a7902f66d8acac1b3 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 14 Aug 2013 22:33:12 +0100 Subject: [PATCH] Add stat clientstack..IncomingPacketsOrphanedCount to record well-formed packets that were not initial connection packets and could not be associated with a connected viewer. --- .../ClientStack/Linden/UDP/LLUDPServer.cs | 33 ++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 553250c851..102e581c5e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -119,6 +119,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP stat => stat.Value = m_udpServer.IncomingMalformedPacketCount, StatVerbosity.Info)); + StatsManager.RegisterStat( + new Stat( + "IncomingPacketsOrphanedCount", + "Number of inbound packets that were not initial connections packets and could not be associated with a viewer.", + "", + "", + "clientstack", + scene.Name, + StatType.Pull, + MeasuresOfInterest.AverageChangeOverTime, + stat => stat.Value = m_udpServer.IncomingOrphanedPacketCount, + StatVerbosity.Info)); + StatsManager.RegisterStat( new Stat( "OutgoingUDPSendsCount", @@ -286,6 +299,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public int IncomingMalformedPacketCount { get; private set; } + /// + /// Record how many inbound packets could not be associated with a simulator circuit. + /// + public int IncomingOrphanedPacketCount { get; private set; } + /// /// Record current outgoing client for monitoring purposes. /// @@ -1206,7 +1224,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if ((IncomingMalformedPacketCount % 10000) == 0) m_log.WarnFormat( - "[LLUDPSERVER]: Received {0} malformed packets so far, probable network attack. Last malformed was from {1}", + "[LLUDPSERVER]: Received {0} malformed packets so far, probable network attack. Last was from {1}", IncomingMalformedPacketCount, endPoint); } @@ -1279,9 +1297,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (IncomingMalformedPacketCount < 100) { - m_log.ErrorFormat("[LLUDPSERVER]: Malformed data, cannot parse {0} byte packet from {1}:", - buffer.DataLength, buffer.RemoteEndPoint); - m_log.Error(Utils.BytesToHexString(buffer.Data, buffer.DataLength, null)); + m_log.WarnFormat("[LLUDPSERVER]: Malformed data, cannot parse {0} byte packet from {1}, data {2}:", + buffer.DataLength, buffer.RemoteEndPoint, Utils.BytesToHexString(buffer.Data, buffer.DataLength, null)); } RecordMalformedInboundPacket(endPoint); @@ -1323,6 +1340,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (!m_scene.TryGetClient(endPoint, out client) || !(client is LLClientView)) { //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); + + IncomingOrphanedPacketCount++; + + if ((IncomingOrphanedPacketCount % 10000) == 0) + m_log.WarnFormat( + "[LLUDPSERVER]: Received {0} orphaned packets so far. Last was from {1}", + IncomingOrphanedPacketCount, endPoint); + return; }