Skip to contentSkip to conversation

ipvs: avoid oops for passive FTP

PATCH In review Julian Anastasov 2 participants 4 messages Sep 1, 2010 – Sep 2, 2010

Subsystems (3)
lore
Share & tools
lore

Julian Anastasov

author maintainer
#0 lore raw

PATCH 1/1 ipvs: avoid oops for passive FTP

Fix Passive FTP problem in ip_vs_ftp:

- Do not oops in nf_nat_set_seq_adjust (adjust_tcp_sequence) when iptable_nat module is not loaded

---

This patch is for 2.6.36

net/netfilter/ipvs/ip_vs_ftp.c renamed from linux/net/netfilter/ipvs/ip_vs_ftp.c +2 -1
@@ -45,6 +45,7 @@
 #include <linux/netfilter.h>
 #include <net/netfilter/nf_conntrack.h>
 #include <net/netfilter/nf_conntrack_expect.h>
+#include <net/netfilter/nf_nat.h>
 #include <net/netfilter/nf_nat_helper.h>
 #include <linux/gfp.h>
 #include <net/protocol.h>
@@ -359,7 +360,7 @@ static int ip_vs_ftp_out(struct ip_vs_ap
 		buf_len = strlen(buf);
 
 		ct = nf_ct_get(skb, &ctinfo);
-		if (ct && !nf_ct_is_untracked(ct)) {
+		if (ct && !nf_ct_is_untracked(ct) && nfct_nat(ct)) {
 			/* If mangling fails this function will return 0
 			 * which will cause the packet to be dropped.
 			 * Mangling can only fail under memory pressure,
maintainer
#1 lore raw
Quoted 10 lines · Julian Anastasov

Fix Passive FTP problem in ip_vs_ftp:

- Do not oops in nf_nat_set_seq_adjust (adjust_tcp_sequence) when iptable_nat module is not loaded

---

This patch is for 2.6.36

Thanks, looks good. Are you ready for me to send this to netdev and Dave Miller? Also, I know that you are working on the bigger picture for post 2.6.36, but I think it would be worth getting this change into net-next now. Likewise for the next patch.

Quoted 20 lines
net/netfilter/ipvs/ip_vs_ftp.c renamed from linux/net/netfilter/ipvs/ip_vs_ftp.c +2 -1
@@ -45,6 +45,7 @@
 #include <linux/netfilter.h>
 #include <net/netfilter/nf_conntrack.h>
 #include <net/netfilter/nf_conntrack_expect.h>
+#include <net/netfilter/nf_nat.h>
 #include <net/netfilter/nf_nat_helper.h>
 #include <linux/gfp.h>
 #include <net/protocol.h>
@@ -359,7 +360,7 @@ static int ip_vs_ftp_out(struct ip_vs_ap
 		buf_len = strlen(buf);
 
 		ct = nf_ct_get(skb, &ctinfo);
-		if (ct && !nf_ct_is_untracked(ct)) {
+		if (ct && !nf_ct_is_untracked(ct) && nfct_nat(ct)) {
 			/* If mangling fails this function will return 0
 			 * which will cause the packet to be dropped.
 			 * Mangling can only fail under memory pressure,
author maintainer
#2 lore raw

Hello,

Quoted 10 lines · Simon Horman
Quoted 9 lines · Julian Anastasov

Fix Passive FTP problem in ip_vs_ftp:

- Do not oops in nf_nat_set_seq_adjust (adjust_tcp_sequence) when iptable_nat module is not loaded

---

Quoted 6 lines
Quoted 1 line

This patch is for 2.6.36

Thanks, looks good. Are you ready for me to send this to netdev and Dave Miller? Also, I know that you are working on the bigger picture for post 2.6.36, but I think it would be worth getting this change into net-next now. Likewise for the next patch.

Yes, this patch should go both to 2.6.36 (stable) and
net-next, I think. I'm sending all my IPVS patches first to you for comments and proper merging for net-next. Thanks!

Quoted 16 lines
Quoted 14 lines
net/netfilter/ipvs/ip_vs_ftp.c renamed from linux/net/netfilter/ipvs/ip_vs_ftp.c +1 -0
@@ -45,6 +45,7 @@
 #include <linux/netfilter.h>
 #include <net/netfilter/nf_conntrack.h>
 #include <net/netfilter/nf_conntrack_expect.h>
+#include <net/netfilter/nf_nat.h>
 #include <net/netfilter/nf_nat_helper.h>
 #include <linux/gfp.h>
 #include <net/protocol.h>
@@ -359,7 +360,7 @@ static int ip_vs_ftp_out(struct ip_vs_ap
 		buf_len = strlen(buf);
 
Quoted 7 lines

net/netfilter/ipvs/ip_vs_ftp.c static int ip_vs_ftp_out(struct ip_vs_ap · line 366

Quoted 6 lines
net/netfilter/ipvs/ip_vs_ftp.c renamed from linux/net/netfilter/ipvs/ip_vs_ftp.c +1 -1
 		ct = nf_ct_get(skb, &ctinfo);
-		if (ct && !nf_ct_is_untracked(ct)) {
+		if (ct && !nf_ct_is_untracked(ct) && nfct_nat(ct)) {
 			/* If mangling fails this function will return 0
 			 * which will cause the packet to be dropped.
 			 * Mangling can only fail under memory pressure,

Regards

--
Julian Anastasov <[email protected]>

maintainer
#3 lore raw
Quoted 17 lines · Julian Anastasov

Hello,

Quoted 12 lines · Simon Horman
Quoted 10 lines · Julian Anastasov

Fix Passive FTP problem in ip_vs_ftp:

- Do not oops in nf_nat_set_seq_adjust (adjust_tcp_sequence) when iptable_nat module is not loaded

---

This patch is for 2.6.36

Quoted 8 lines
Quoted 4 lines

Thanks, looks good. Are you ready for me to send this to netdev and Dave Miller? Also, I know that you are working on the bigger picture for post 2.6.36, but I think it would be worth getting this change into net-next now. Likewise for the next patch.

Yes, this patch should go both to 2.6.36 (stable) and
net-next, I think. I'm sending all my IPVS patches first to you for comments and proper merging for net-next. Thanks!

Understood. I wasn't quite sure how you wanted to handle things.

Quoted 28 lines
Quoted 16 lines
Quoted 14 lines
net/netfilter/ipvs/ip_vs_ftp.c renamed from linux/net/netfilter/ipvs/ip_vs_ftp.c +1 -0
@@ -45,6 +45,7 @@
 #include <linux/netfilter.h>
 #include <net/netfilter/nf_conntrack.h>
 #include <net/netfilter/nf_conntrack_expect.h>
+#include <net/netfilter/nf_nat.h>
 #include <net/netfilter/nf_nat_helper.h>
 #include <linux/gfp.h>
 #include <net/protocol.h>
@@ -359,7 +360,7 @@ static int ip_vs_ftp_out(struct ip_vs_ap
 		buf_len = strlen(buf);
 
Quoted 7 lines

net/netfilter/ipvs/ip_vs_ftp.c static int ip_vs_ftp_out(struct ip_vs_ap · line 366

Quoted 6 lines
net/netfilter/ipvs/ip_vs_ftp.c renamed from linux/net/netfilter/ipvs/ip_vs_ftp.c +1 -1
 		ct = nf_ct_get(skb, &ctinfo);
-		if (ct && !nf_ct_is_untracked(ct)) {
+		if (ct && !nf_ct_is_untracked(ct) && nfct_nat(ct)) {
 			/* If mangling fails this function will return 0
 			 * which will cause the packet to be dropped.
 			 * Mangling can only fail under memory pressure,

Regards

--
Julian Anastasov <[email protected]>