Skip to contentSkip to conversation

Quake III Arena conntracker

PATCH Filip Sneppe (Cronos) 1 participant 1 message Oct 5, 2002

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi,

This patch (against netfilter CVS and against 2.4.20-pre8) adds a conntrack/NAT helper for Quake3 Arena Master server connections.

Brad Chapman showed some interest and has been running a version with NAT support for at least a month now (see mail below).

Feel free to include it in p-o-m.

Brad, thanks for sparking my interest in this again, and for volunteering to test it out on your network.

Regards,
Filip

From: Brad Chapman <[email protected]>
To: Filip Sneppe (Cronos) <[email protected]>
Subject: RE: [PATCH] Quake III Arena conntracker
Date: 29 Sep 2002 16:42:18 -0700

Mr. Filip,

Quoted 5 lines · --- "Filip Sneppe (Cronos)
Quoted 2 lines · Brad Chapman

It does. ATM the only thing tested is the Quake3 helper, and not with a fully

closed

Quoted 1 line

rulset (I'm allowing 27950 and 27960 in TCP/UDP already). However, so far

Quoted 8 lines

nothing

Quoted 1 line

seems to be crashing or Oopsing.

Hi Brad,

Have you had any issues with the quake3 conntrack/nat patch I sent you ? If not, I guess it wouldn't harm to have it in patch-o-matic so more people can test it.

No. I've had no issues whatsoever. The patch works great and even appears to work for Quake2 traffic as well. It belongs in p-o-m; maybe once it's put there I'll try it to see if it acts any differently.

Quoted 5 lines

Thanks for your testing,
Filip

Brad

=====
Brad Chapman

Permanent e-mail: [email protected]

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

Documentation/Configure.help +10 -0
diff -urN -X dontdiff linux-2.4.20-pre8/Documentation/Configure.help linux-2.4.20-pre8-quake3/Documentation/Configure.help
@@ -2499,6 +2499,16 @@
   If you want to compile it as a module, say M here and read
   <file:Documentation/modules.txt>.  If unsure, say `Y'.
 
+Quake III Arena protocol support
+CONFIG_IP_NF_QUAKE3
+  Quake III Arena  connection tracking helper. This module allows for a
+  stricter firewall rulebase if one only allows traffic to a master
+  server. Connections to Quake III server IP addresses and ports returned
+  by the master server will be tracked automatically.
+
+  If you want to compile it as a module, say M here and read
+  Documentation/modules.txt.  If unsure, say `Y'.
+
 User space queueing via NETLINK
 CONFIG_IP_NF_QUEUE
   Netfilter has the ability to queue packets to user space: the
include/linux/netfilter_ipv4/ip_conntrack_quake3.h +21 -0
diff -urN -X dontdiff linux-2.4.20-pre8/include/linux/netfilter_ipv4/ip_conntrack_quake3.h linux-2.4.20-pre8-quake3/include/linux/netfilter_ipv4/ip_conntrack_quake3.h
@@ -0,0 +1,21 @@
+#ifndef _IP_CT_QUAKE3
+#define _IP_CT_QUAKE3
+
+/* Don't confuse with 27960, often used as the Server Port */
+#define QUAKE3_MASTER_PORT 27950
+
+struct quake3_search {
+	const char marker[4]; /* always 0xff 0xff 0xff 0xff ? */
+	const char *pattern;
+	size_t plen;
+}; 
+
+/* This structure is per expected connection */
+struct ip_ct_quake3_expect {
+};
+
+/* This structure exists only once per master */
+struct ip_ct_quake3_master {
+};
+
+#endif /* _IP_CT_QUAKE3 */
net/ipv4/netfilter/Config.in +8 -0
diff -urN -X dontdiff linux-2.4.20-pre8/net/ipv4/netfilter/Config.in linux-2.4.20-pre8-quake3/net/ipv4/netfilter/Config.in
@@ -8,6 +8,7 @@
 if [ "$CONFIG_IP_NF_CONNTRACK" != "n" ]; then
   dep_tristate '  FTP protocol support' CONFIG_IP_NF_FTP $CONFIG_IP_NF_CONNTRACK
   dep_tristate '  IRC protocol support' CONFIG_IP_NF_IRC $CONFIG_IP_NF_CONNTRACK
+  dep_tristate '  Quake III protocol support' CONFIG_IP_NF_QUAKE3 $CONFIG_IP_NF_CONNTRACK
 fi
 
 if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
@@ -60,6 +61,13 @@
       if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
         dep_tristate '    Basic SNMP-ALG support (EXPERIMENTAL)' CONFIG_IP_NF_NAT_SNMP_BASIC $CONFIG_IP_NF_NAT
       fi
+      if [ "$CONFIG_IP_NF_QUAKE3" = "m" ]; then
+        define_tristate CONFIG_IP_NF_NAT_QUAKE3 m 
+      else
+        if [ "$CONFIG_IP_NF_QUAKE3" = "y" ]; then
+	  define_tristate CONFIG_IP_NF_NAT_QUAKE3 $CONFIG_IP_NF_NAT
+	fi
+      fi
       if [ "$CONFIG_IP_NF_IRC" = "m" ]; then
         define_tristate CONFIG_IP_NF_NAT_IRC m
       else
net/ipv4/netfilter/Makefile +6 -0
diff -urN -X dontdiff linux-2.4.20-pre8/net/ipv4/netfilter/Makefile linux-2.4.20-pre8-quake3/net/ipv4/netfilter/Makefile
@@ -42,9 +42,15 @@
 	export-objs += ip_conntrack_irc.o
 endif
 
+obj-$(CONFIG_IP_NF_QUAKE3) += ip_conntrack_quake3.o
+ifdef CONFIG_IP_NF_NAT_QUAKE3
+	export-objs += ip_conntrack_quake3.o
+endif
+
 # NAT helpers 
 obj-$(CONFIG_IP_NF_NAT_FTP) += ip_nat_ftp.o
 obj-$(CONFIG_IP_NF_NAT_IRC) += ip_nat_irc.o
+obj-$(CONFIG_IP_NF_NAT_QUAKE3) += ip_nat_quake3.o
 
 # generic IP tables 
 obj-$(CONFIG_IP_NF_IPTABLES) += ip_tables.o
net/ipv4/netfilter/ip_conntrack_quake3.c +156 -0

156 lines not on this page · raw message

net/ipv4/netfilter/ip_nat_quake3.c +249 -0

249 lines not on this page · raw message

patch-o-matic/extra/quake3-conntrack.patch +438 -0

438 lines not on this page · raw message

patch-o-matic/extra/quake3-conntrack.patch.config.in +2 -0
diff -urN netfilter-orig/patch-o-matic/extra/quake3-conntrack.patch.config.in netfilter/patch-o-matic/extra/quake3-conntrack.patch.config.in
@@ -0,0 +1,2 @@
+  dep_tristate '  IRC protocol support' CONFIG_IP_NF_IRC $CONFIG_IP_NF_CONNTRACK
+  dep_tristate '  Quake III protocol support' CONFIG_IP_NF_QUAKE3 $CONFIG_IP_NF_CONNTRACK
patch-o-matic/extra/quake3-conntrack.patch.config.in-2 +8 -0
diff -urN netfilter-orig/patch-o-matic/extra/quake3-conntrack.patch.config.in-2 netfilter/patch-o-matic/extra/quake3-conntrack.patch.config.in-2
@@ -0,0 +1,8 @@
+          define_tristate CONFIG_IP_NF_NAT_IRC $CONFIG_IP_NF_NAT
+        fi
+      fi
+      if [ "$CONFIG_IP_NF_QUAKE3" = "m" ]; then
+        define_tristate CONFIG_IP_NF_NAT_QUAKE3 m
+      else
+        if [ "$CONFIG_IP_NF_QUAKE3" = "y" ]; then
+         define_tristate CONFIG_IP_NF_NAT_QUAKE3 $CONFIG_IP_NF_NAT
patch-o-matic/extra/quake3-conntrack.patch.configure.help +10 -0
diff -urN netfilter-orig/patch-o-matic/extra/quake3-conntrack.patch.configure.help netfilter/patch-o-matic/extra/quake3-conntrack.patch.configure.help
@@ -0,0 +1,10 @@
+CONFIG_IP_NF_IRC
+Quake III Arena protocol support
+CONFIG_IP_NF_QUAKE3
+  Quake III Arena  connection tracking helper. This module allows for a
+  stricter firewall rulebase if one only allows traffic to a master
+  server. Connections to Quake III server IP addresses and ports returned
+  by the master server will be tracked automatically.
+
+  If you want to compile it as a module, say M here and read
+  <file:Documentation/modules.txt>.  If unsure, say `Y'.
patch-o-matic/extra/quake3-conntrack.patch.help +17 -0
diff -urN netfilter-orig/patch-o-matic/extra/quake3-conntrack.patch.help netfilter/patch-o-matic/extra/quake3-conntrack.patch.help
@@ -0,0 +1,17 @@
+Author: Filip Sneppe <[email protected]>
+Status: WorksForMe (tm)
+
+This adds CONFIG_IP_NF_QUAKE3: a Quake III Arena support module for
+netfilter connection tracking/NAT. 
+
+Quake III Arena Internet multiplayer works by querying an Internet
+master server on UDP port 27950 for specific Quake III servers. The
+master server responds with the IP addresses and UDP ports of
+registered game servers. Those UDP ports can be randomly chosen
+(although 27960 is often used).
+
+This connection tracking module will listen for UDP replies
+from a master server, and will add the necessary expectations
+for connections from client to game servers.
+
+Note: Requires newnat !
patch-o-matic/extra/quake3-conntrack.patch.makefile +5 -0
diff -urN netfilter-orig/patch-o-matic/extra/quake3-conntrack.patch.makefile netfilter/patch-o-matic/extra/quake3-conntrack.patch.makefile
@@ -0,0 +1,5 @@
+# connection tracking helpers
+obj-$(CONFIG_IP_NF_QUAKE3) += ip_conntrack_quake3.o
+ifdef CONFIG_IP_NF_NAT_QUAKE3
+	export-objs += ip_conntrack_quake3.o
+endif
patch-o-matic/extra/quake3-conntrack.patch.makefile-2 +2 -0
diff -urN netfilter-orig/patch-o-matic/extra/quake3-conntrack.patch.makefile-2 netfilter/patch-o-matic/extra/quake3-conntrack.patch.makefile-2
@@ -0,0 +1,2 @@
+obj-$(CONFIG_IP_NF_NAT_IRC) += ip_nat_irc.o
+obj-$(CONFIG_IP_NF_NAT_QUAKE3) += ip_nat_quake3.o