Skip to contentSkip to conversation

active ftp doesn't work since 2.6.9-rc1

BUG Vitezslav Samel 3 participants 5 messages Oct 1, 2004 – Oct 4, 2004

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

After upgrade to 2.6.9-rc3 on the firewall (with NAT), active ftp stopped
working. The first kernel, which doesn't work is 2.6.9-rc1.
Sympotms: passive ftp works O.K., active FTP doesn't open data stream (and in logs there entries about invalid packets - using
iptables ... -m state --state INVALID -j LOG)

If you need any extra data point, mail me.

Cheers,
Vita Samel

#1 lore raw
Quoted 7 lines · Vitezslav Samel
	Hi!

After upgrade to 2.6.9-rc3 on the firewall (with NAT), active ftp stopped
working. The first kernel, which doesn't work is 2.6.9-rc1.
Sympotms: passive ftp works O.K., active FTP doesn't open data stream (and in logs there entries about invalid packets - using
iptables ... -m state --state INVALID -j LOG)

I just tried to reproduce the problem. Can you confirm the problem disappears after executing

echo 1 > /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_be_liberal

on your NAT box?

Quoted 2 lines

Cheers,
Vita Samel

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
#2 lore raw
Quoted 8 lines · Harald Welte
Quoted 7 lines · Vitezslav Samel
	Hi!

After upgrade to 2.6.9-rc3 on the firewall (with NAT), active ftp stopped
working. The first kernel, which doesn't work is 2.6.9-rc1.
Sympotms: passive ftp works O.K., active FTP doesn't open data stream (and in logs there entries about invalid packets - using iptables ... -m state --state INVALID -j LOG)

Please use the following (attached) fix:

DaveM: Please apply and push to Linus:

Thanks!

Fix NAT helper code to update TCP window tracking information if it resizes payload (and thus alrers sequence numbers).

This patchlet was somehow lost during 2.4.x->2.6.x port of TCP window tracking :(

net/ipv4/netfilter/ip_nat_helper.c +7 -2
@@ -347,7 +347,7 @@
 	return 1;
 }
 
-/* TCP sequence number adjustment.  Returns true or false.  */
+/* TCP sequence number adjustment.  Returns 1 on success, 0 on failure */
 int
 ip_nat_seq_adjust(struct sk_buff **pskb, 
 		  struct ip_conntrack *ct, 
@@ -396,7 +396,12 @@
 	tcph->seq = newseq;
 	tcph->ack_seq = newack;
 
-	return ip_nat_sack_adjust(pskb, tcph, ct, ctinfo);
+	if (!ip_nat_sack_adjust(pskb, tcph, ct, ctinfo))
+		return 0;
+
+	ip_conntrack_tcp_update(*pskb, ct, dir);
+
+	return 1;
 }
 
 static inline int
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
#3 lore raw
Quoted 10 lines · On Fri, 1 Oct 2004 16:10:50 +0200 Harald Welte <[email protected]> wrote:
Quoted 8 lines · Harald Welte
Quoted 7 lines · Vitezslav Samel
	Hi!

After upgrade to 2.6.9-rc3 on the firewall (with NAT), active ftp stopped
working. The first kernel, which doesn't work is 2.6.9-rc1.
Sympotms: passive ftp works O.K., active FTP doesn't open data stream (and in logs there entries about invalid packets - using iptables ... -m state --state INVALID -j LOG)

Quoted 3 lines

Please use the following (attached) fix:

DaveM: Please apply and push to Linus:

Will do, thanks Harald.

#4 lore raw
In reply to Harald Welte
	Hi!
Quoted 12 lines
Quoted 5 lines

After upgrade to 2.6.9-rc3 on the firewall (with NAT), active ftp stopped
working. The first kernel, which doesn't work is 2.6.9-rc1.
Sympotms: passive ftp works O.K., active FTP doesn't open data stream (and in logs there entries about invalid packets - using
iptables ... -m state --state INVALID -j LOG)

I just tried to reproduce the problem. Can you confirm the problem disappears after executing

echo 1 > /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_be_liberal

on your NAT box?

[...]

Quoted 25 lines

Please use the following (attached) fix:

Fix NAT helper code to update TCP window tracking information if it resizes payload (and thus alrers sequence numbers).

This patchlet was somehow lost during 2.4.x->2.6.x port of TCP window tracking :(

net/ipv4/netfilter/ip_nat_helper.c +1 -1
@@ -347,7 +347,7 @@
 	return 1;
 }
 
-/* TCP sequence number adjustment.  Returns true or false.  */
+/* TCP sequence number adjustment.  Returns 1 on success, 0 on failure */
 int
 ip_nat_seq_adjust(struct sk_buff **pskb, 
 		  struct ip_conntrack *ct, 
@@ -396,7 +396,12 @@
 	tcph->seq = newseq;
 	tcph->ack_seq = newack;
 

net/ipv4/netfilter/ip_nat_helper.c line 407

Quoted 10 lines
net/ipv4/netfilter/ip_nat_helper.c +6 -1
-	return ip_nat_sack_adjust(pskb, tcph, ct, ctinfo);
+	if (!ip_nat_sack_adjust(pskb, tcph, ct, ctinfo))
+		return 0;
+
+	ip_conntrack_tcp_update(*pskb, ct, dir);
+
+	return 1;
 }
 
 static inline int

Both solutions are working fine here.

Thanks,
Vita Samel