|
From: <cn...@us...> - 2023-03-15 18:24:34
|
Revision: 1344
http://sourceforge.net/p/seq/svn/1344
Author: cn187
Date: 2023-03-15 18:24:31 +0000 (Wed, 15 Mar 2023)
Log Message:
-----------
Check sessionId before processing disconnect packet
Random UDP traffic on the LAN can cause unexpectes session disconnects if
the packet payload happens to start with the SessionDisconnect net
opcode.
By checking the sessionId in the disconnect packet against the current
sessionId, we can ignore packets that look like disconnect packets but
really aren't.
This also means that users who have enabled "session tracking" for the
sole purpose of reducing random disconnects may be able to disable it if
they don't otherwise need it.
Modified Paths:
--------------
showeq/trunk/src/everquest.h
showeq/trunk/src/packetstream.cpp
Modified: showeq/trunk/src/everquest.h
===================================================================
--- showeq/trunk/src/everquest.h 2023-03-15 18:24:23 UTC (rev 1343)
+++ showeq/trunk/src/everquest.h 2023-03-15 18:24:31 UTC (rev 1344)
@@ -414,12 +414,14 @@
* Session disconnect on a stream. This is the server telling the client to
* close a stream.
*
- * Size: 8 Octets
+ * Size: 9 Octets
*/
struct SessionDisconnectStruct
{
-/*0000*/ uint8_t unknown[8];
-/*0008*/
+/*0000*/ uint8_t unknown0000;
+/*0001*/ uint32_t sessionId;
+/*0005*/ uint8_t unknown[4];
+/*0009*/
};
/*
Modified: showeq/trunk/src/packetstream.cpp
===================================================================
--- showeq/trunk/src/packetstream.cpp 2023-03-15 18:24:23 UTC (rev 1343)
+++ showeq/trunk/src/packetstream.cpp 2023-03-15 18:24:31 UTC (rev 1344)
@@ -1144,6 +1144,19 @@
break;
case OP_SessionDisconnect:
{
+
+ // When session tracking isn't enabled, random UDP traffic on the LAN can
+ // cause unexpected session disconnects if the packet payload happens
+ // to start with the same bytes as the OP_SessionDisconnect netOp.
+ //
+ // So check the sessionId in the disconnect packet, and only process
+ // it if it matches the current sessionId.
+ SessionDisconnectStruct* disconnect = (SessionDisconnectStruct*) packet.payload();
+ uint32_t disconnectedSessionId = eqntohuint32((uint8_t*)&(disconnect->sessionId));
+ if (m_sessionId != disconnectedSessionId) {
+ break;
+ }
+
#if defined(PACKET_PROCESS_DIAG) || defined(PACKET_SESSION_DIAG)
seqDebug("EQPacket: SessionDisconnect found %s:%u->%s:%u, resetting expected seq, stream %s (%d) (session tracking %s)",
((EQUDPIPPacketFormat&) packet).getIPv4SourceA().ascii(),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|