|
From: <cn...@us...> - 2020-10-23 01:50:42
|
Revision: 1054
http://sourceforge.net/p/seq/svn/1054
Author: cn187
Date: 2020-10-23 01:50:40 +0000 (Fri, 23 Oct 2020)
Log Message:
-----------
Update capture and client detection rules
* Update capture rules to capture world server traffic on ports 9000-9007
instead of just port 9000
* Updated client detection rules to consider world server traffic on ports
9000-9007 instead of just port 9000
* Update capture rules to ignore multicast and broadcast traffic. This should
reduce random issues caused by non-EQ network traffic.
Modified Paths:
--------------
showeq/branches/pre_6_0_beta/src/packet.cpp
showeq/branches/pre_6_0_beta/src/packetcapture.cpp
Modified: showeq/branches/pre_6_0_beta/src/packet.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/packet.cpp 2020-10-23 00:55:37 UTC (rev 1053)
+++ showeq/branches/pre_6_0_beta/src/packet.cpp 2020-10-23 01:50:40 UTC (rev 1054)
@@ -73,7 +73,8 @@
//----------------------------------------------------------------------
// constants
-const in_port_t WorldServerGeneralPort = 9000;
+const in_port_t WorldServerGeneralMinPort = 9000;
+const in_port_t WorldServerGeneralMaxPort = 9007;
const in_port_t WorldServerChatPort = 9876;
const in_port_t WorldServerChat2Port = 9875; // xgame tells, mail
const in_port_t LoginServerMinPort = 15900;
@@ -603,7 +604,9 @@
void EQPacket::dispatchPacket(EQUDPIPPacketFormat& packet)
{
// Detect client by world server port traffic...
- if (m_detectingClient && packet.getSourcePort() == WorldServerGeneralPort)
+ if (m_detectingClient &&
+ (packet.getSourcePort() >= WorldServerGeneralMinPort
+ && packet.getSourcePort() <= WorldServerGeneralMaxPort))
{
m_ip = packet.getIPv4DestA();
m_client_addr = packet.getIPv4DestN();
@@ -611,7 +614,9 @@
emit clientChanged(m_client_addr);
seqInfo("Client Detected: %s", (const char*)m_ip);
}
- else if (m_detectingClient && packet.getDestPort() == WorldServerGeneralPort)
+ else if (m_detectingClient &&
+ (packet.getDestPort() >= WorldServerGeneralMinPort
+ && packet.getDestPort() <= WorldServerGeneralMaxPort))
{
m_ip = packet.getIPv4SourceA();
m_client_addr = packet.getIPv4SourceN();
@@ -647,8 +652,10 @@
// Drop login server traffic
return;
}
- else if (packet.getDestPort() == WorldServerGeneralPort ||
- packet.getSourcePort() == WorldServerGeneralPort)
+ else if ((packet.getDestPort() >= WorldServerGeneralMinPort &&
+ packet.getDestPort() <= WorldServerGeneralMaxPort) ||
+ (packet.getSourcePort() >= WorldServerGeneralMinPort &&
+ packet.getSourcePort() <= WorldServerGeneralMaxPort))
{
// World server traffic. Dispatch it.
if (packet.getIPv4SourceN() == m_client_addr)
Modified: showeq/branches/pre_6_0_beta/src/packetcapture.cpp
===================================================================
--- showeq/branches/pre_6_0_beta/src/packetcapture.cpp 2020-10-23 00:55:37 UTC (rev 1053)
+++ showeq/branches/pre_6_0_beta/src/packetcapture.cpp 2020-10-23 01:50:40 UTC (rev 1054)
@@ -121,18 +121,18 @@
if (strcmp(host, AUTOMATIC_CLIENT_IP) == 0)
{
seqInfo("Filtering packets on device %s, searching for EQ client...", device);
- sprintf (filter_buf, "udp[0:2] > 1024 and udp[2:2] > 1024 and ether proto 0x0800");
+ sprintf (filter_buf, "udp[0:2] > 1024 and udp[2:2] > 1024 and ether proto 0x0800 and not broadcast and not multicast");
}
else
{
seqInfo("Filtering packets on device %s, IP host %s", device, host);
- sprintf (filter_buf, "udp[0:2] > 1024 and udp[2:2] > 1024 and host %s and ether proto 0x0800", host);
+ sprintf (filter_buf, "udp[0:2] > 1024 and udp[2:2] > 1024 and host %s and ether proto 0x0800 and not broadcast and not multicast", host);
}
}
else if (address_type == MAC_ADDRESS_TYPE)
{
seqInfo("Filtering packets on device %s, MAC host %s", device, host);
- sprintf (filter_buf, "udp[0:2] > 1024 and udp[2:2] > 1024 and ether host %s and ether proto 0x0800", host);
+ sprintf (filter_buf, "udp[0:2] > 1024 and udp[2:2] > 1024 and ether host %s and ether proto 0x0800 and not broadcast and not multicast", host);
}
else
{
@@ -457,35 +457,35 @@
{
// Restrict to client port and ip, plus world streams.
sprintf(filter_buf,
- "(udp[0:2] = 9000 or udp[2:2] = 9000 or udp[0:2] = 9876 or udp[0:2] = %d or udp[2:2] = %d) and host %s and ether proto 0x0800",
- client_port, client_port, hostname);
+ "udp and (portrange 9000-9007 or port 9876 or port %d) and host %s and ether proto 0x0800 and not broadcast and not multicast",
+ client_port, hostname);
}
else if (address_type == IP_ADDRESS_TYPE && zone_port)
{
// Restrict to zone port and world streams.
sprintf(filter_buf,
- "(udp[0:2] = 9000 or udp[2:2] = 9000 or udp[0:2] = 9876 or udp[0:2] = %d or udp[2:2] = %d) and host %s and ether proto 0x0800",
- zone_port, zone_port, hostname);
+ "udp and (portrange 9000-9007 or port 9876 or port %d) and host %s and ether proto 0x0800 and not broadcast and not multicast",
+ zone_port, hostname);
}
else if (address_type == MAC_ADDRESS_TYPE && client_port)
{
// Restrict to client port and world streams.
sprintf(filter_buf,
- "(udp[0:2] = 9000 or udp[2:2] = 9000 or udp[0:2] = 9876 or udp[0:2] = %d or udp[2:2] = %d) and ether host %s and ether proto 0x0800",
- client_port, client_port, hostname);
+ "udp and (portrange 9000-9007 or port 9876 or port %d) and ether host %s and ether proto 0x0800 and not broadcast and not multicast",
+ client_port, hostname);
}
else if (address_type == MAC_ADDRESS_TYPE && zone_port)
{
// Restrict to zone port and world streams.
sprintf(filter_buf,
- "(udp[0:2] = 9000 or udp[2:2] = 9000 or udp[0:2] = 9876 or udp[0:2] = %d or udp[2:2] = %d) and ether host %s and ether proto 0x0800",
- zone_port, zone_port, hostname);
+ "udp and (portrange 9000-9007 or port 9876 or port %d) and ether host %s and ether proto 0x0800 and not broadcast and not multicast",
+ zone_port, hostname);
}
else if (hostname != NULL && !client_port && !zone_port)
{
// Leave wide open.
sprintf(filter_buf,
- "udp[0:2] > 1024 and udp[2:2] > 1024 and ether proto 0x0800 and host %s",
+ "udp[0:2] > 1024 and udp[2:2] > 1024 and ether proto 0x0800 and host %s and not broadcast and not multicast",
hostname);
}
else
@@ -494,7 +494,7 @@
seqInfo("Filtering packets on device %s, searching for EQ client...",
device);
sprintf(filter_buf,
- "udp[0:2] > 1024 and udp[2:2] > 1024 and ether proto 0x0800");
+ "udp[0:2] > 1024 and udp[2:2] > 1024 and ether proto 0x0800 and not broadcast and not multicast");
}
if (pcap_compile (m_pcache_pcap, &bpp, filter_buf, 1, net) == -1)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|