Skip to contentSkip to conversation

2.5.x new tftp conntrack + NAT support

PATCH Applied Harald Welte 2 participants 2 messages Mar 31, 2003

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

PATCH 1/1 2.5.x new tftp conntrack + NAT support

Hi Dave!

This is the 2.5.x merge of the 2.4.x tftp patch I've sent you yesterday.

Please apply, thanks.

include/linux/netfilter_ipv4/ip_conntrack_tftp.h renamed from linux-2.5.66-plain/include/linux/netfilter_ipv4/ip_conntrack_tftp.h +13 -0
diff -Nru ../linux-2.5.66-plain/include/linux/netfilter_ipv4/ip_conntrack_tftp.h ./include/linux/netfilter_ipv4/ip_conntrack_tftp.h
@@ -0,0 +1,13 @@
+#ifndef _IP_CT_TFTP
+#define _IP_CT_TFTP
+
+#define TFTP_PORT 69
+
+struct tftphdr {
+	u_int16_t opcode;
+};
+
+#define TFTP_OPCODE_READ	1
+#define TFTP_OPCODE_WRITE	2
+
+#endif /* _IP_CT_TFTP */
net/ipv4/netfilter/Kconfig renamed from linux-2.5.66-plain/net/ipv4/netfilter/Kconfig +20 -2
diff -Nru ../linux-2.5.66-plain/net/ipv4/netfilter/Kconfig ./net/ipv4/netfilter/Kconfig
@@ -44,8 +44,20 @@
 	  chats.  Note that you do NOT need this extension to get files or
 	  have others initiate chats, or everything else in IRC.
 
-	  If you want to compile it as a module, say 'M' here and read
-	  Documentation/modules.txt.  If unsure, say 'N'.
+	  If you want to compile it as a module, say M here and read
+	  <file:Documentation/modules.txt>.  If unsure, say `Y'.
+
+config IP_NF_TFTP
+	tristate "TFTP prtocol support"
+	depends on IP_NF_CONNTRACK
+	help
+	  TFTP connection tracking helper, this is required depending
+	  on how restrictive your ruleset is.
+	  If you are using a tftp client behind -j SNAT or -j MASQUERADING
+	  you will need this.
+
+	  If you want to compile it as a module, say M here and read
+	  <file:Documentation/modules.txt>.  If unsure, say `Y'.
 
 config IP_NF_QUEUE
 	tristate "Userspace queueing via NETLINK (EXPERIMENTAL)"
@@ -379,6 +391,12 @@
 	depends on IP_NF_IPTABLES!=n && IP_NF_CONNTRACK!=n && IP_NF_NAT!=n
 	default IP_NF_NAT if IP_NF_FTP=y
 	default m if IP_NF_FTP=m
+
+config IP_NF_NAT_TFTP
+	tristate
+	depends on IP_NF_IPTABLES!=n && IP_NF_CONNTRACK!=n && IP_NF_NAT!=n
+	default IP_NF_NAT if IP_NF_TFTP=y
+	default m if IP_NF_TFTP=m
 
 config IP_NF_MANGLE
 	tristate "Packet mangling"
net/ipv4/netfilter/Makefile renamed from linux-2.5.66-plain/net/ipv4/netfilter/Makefile +2 -0
diff -Nru ../linux-2.5.66-plain/net/ipv4/netfilter/Makefile ./net/ipv4/netfilter/Makefile
@@ -20,6 +20,7 @@
 obj-$(CONFIG_IP_NF_CONNTRACK) += ip_conntrack.o
 
 # connection tracking helpers
+obj-$(CONFIG_IP_NF_TFTP) += ip_conntrack_tftp.o
 obj-$(CONFIG_IP_NF_FTP) += ip_conntrack_ftp.o
 ifdef CONFIG_IP_NF_NAT_FTP
 endif
@@ -28,6 +29,7 @@
 endif
 
 # NAT helpers 
+obj-$(CONFIG_IP_NF_NAT_TFTP) += ip_nat_tftp.o
 obj-$(CONFIG_IP_NF_NAT_FTP) += ip_nat_ftp.o
 obj-$(CONFIG_IP_NF_NAT_IRC) += ip_nat_irc.o
 
net/ipv4/netfilter/ip_conntrack_tftp.c renamed from linux-2.5.66-plain/net/ipv4/netfilter/ip_conntrack_tftp.c +131 -0

131 lines not on this page · raw message

net/ipv4/netfilter/ip_nat_tftp.c renamed from linux-2.5.66-plain/net/ipv4/netfilter/ip_nat_tftp.c +197 -0

197 lines not on this page · raw message

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie
#1 lore raw

From: Harald Welte <[email protected]>
Date: Mon, 31 Mar 2003 18:11:45 +0200

This is the 2.5.x merge of the 2.4.x tftp patch I've sent you yesterday.

Applied, thanks.