Skip to contentSkip to conversation

Fixes for netns initializations

PATCH In review Julian Anastasov 3 participants 7 messages Apr 24, 2012 – Apr 26, 2012

Subsystems (3)
lore
Share & tools
lore

Julian Anastasov

author maintainer
#0 lore raw

v2 cover Fixes for netns initializations

This changeset fixes problems with failed netns
initializations. Hans should provide similar fix for LBLC and LBLCR. This is for the stable tree.

Julian Anastasov (2):
ipvs: reset ipvs pointer in netns
ipvs: add check in ftp for initialized core

 net/netfilter/ipvs/ip_vs_core.c |    2 ++
 net/netfilter/ipvs/ip_vs_ftp.c  |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)
Signature · 1 line
1.7.3.4
author maintainer
#1 lore raw

PATCH v2 1/2 ipvs: reset ipvs pointer in netns

	Make sure net->ipvs is reset on netns cleanup or failed

initialization. It is needed for IPVS applications to know that IPVS core is not loaded in netns.

---
 net/netfilter/ipvs/ip_vs_core.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
net/netfilter/ipvs/ip_vs_core.c +2 -0
index 2555816..260b9ef 100644
@@ -1924,6 +1924,7 @@ protocol_fail:
 control_fail:
 	ip_vs_estimator_net_cleanup(net);
 estimator_fail:
+	net->ipvs = NULL;
 	return -ENOMEM;
 }
 
@@ -1936,6 +1937,7 @@ static void __net_exit __ip_vs_cleanup(struct net *net)
 	ip_vs_control_net_cleanup(net);
 	ip_vs_estimator_net_cleanup(net);
 	IP_VS_DBG(2, "ipvs netns %d released\n", net_ipvs(net)->gen);
+	net->ipvs = NULL;
 }
 
 static void __net_exit __ip_vs_dev_cleanup(struct net *net)
Signature · 1 line
1.7.3.4
Acked-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] ipvs: reset ipvs pointer in netns

Hello

Quoted 5 lines · On Tuesday 24 April 2012 23:29:58 Julian Anastasov wrote:
	Make sure net->ipvs is reset on netns cleanup or failed

initialization. It is needed for IPVS applications to know that IPVS core is not loaded in netns.

Quoted 24 lines
---
 net/netfilter/ipvs/ip_vs_core.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
net/netfilter/ipvs/ip_vs_core.c +2 -0
index 2555816..260b9ef 100644
@@ -1924,6 +1924,7 @@ protocol_fail:
 control_fail:
 	ip_vs_estimator_net_cleanup(net);
 estimator_fail:
+	net->ipvs = NULL;
 	return -ENOMEM;
 }
 
@@ -1936,6 +1937,7 @@ static void __net_exit __ip_vs_cleanup(struct net *net)
 	ip_vs_control_net_cleanup(net);
 	ip_vs_estimator_net_cleanup(net);
 	IP_VS_DBG(2, "ipvs netns %d released\n", net_ipvs(net)->gen);
+	net->ipvs = NULL;
 }
 
 static void __net_exit __ip_vs_dev_cleanup(struct net *net)
Signature · 2 lines
Regards
Hans Schillstrom <[email protected]>
author maintainer
#3 lore raw

PATCH v2 2/2 ipvs: add check in ftp for initialized core

In reply to Julian Anastasov

Avoid crash when registering ip_vs_ftp after
the IPVS core initialization for netns fails. Do this by checking for present core (net->ipvs).

---
 net/netfilter/ipvs/ip_vs_ftp.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
net/netfilter/ipvs/ip_vs_ftp.c +2 -0
index 538d74e..e39f693 100644
@@ -439,6 +439,8 @@ static int __net_init __ip_vs_ftp_init(struct net *net)
 	struct ip_vs_app *app;
 	struct netns_ipvs *ipvs = net_ipvs(net);
 
+	if (!ipvs)
+		return -ENOENT;
 	app = kmemdup(&ip_vs_ftp, sizeof(struct ip_vs_app), GFP_KERNEL);
 	if (!app)
 		return -ENOMEM;
Signature · 1 line
1.7.3.4
Acked-by on v2 2/2
#4 lore raw

Re: [PATCH v2 2/2] ipvs: add check in ftp for initialized core

Quoted 5 lines · On Tuesday 24 April 2012 23:29:59 Julian Anastasov wrote:

Avoid crash when registering ip_vs_ftp after
the IPVS core initialization for netns fails. Do this by checking for present core (net->ipvs).

Quoted 17 lines
---
 net/netfilter/ipvs/ip_vs_ftp.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
net/netfilter/ipvs/ip_vs_ftp.c +2 -0
index 538d74e..e39f693 100644
@@ -439,6 +439,8 @@ static int __net_init __ip_vs_ftp_init(struct net *net)
 	struct ip_vs_app *app;
 	struct netns_ipvs *ipvs = net_ipvs(net);
 
+	if (!ipvs)
+		return -ENOENT;
 	app = kmemdup(&ip_vs_ftp, sizeof(struct ip_vs_app), GFP_KERNEL);
 	if (!app)
 		return -ENOMEM;
Signature · 2 lines
Regards
Hans Schillstrom <[email protected]>
maintainer
#5 lore raw
In reply to Julian Anastasov
Quoted 11 lines · Julian Anastasov

This changeset fixes problems with failed netns
initializations. Hans should provide similar fix for LBLC and LBLCR. This is for the stable tree.

Julian Anastasov (2):
ipvs: reset ipvs pointer in netns
ipvs: add check in ftp for initialized core

 net/netfilter/ipvs/ip_vs_core.c |    2 ++
 net/netfilter/ipvs/ip_vs_ftp.c  |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

Thanks, both patches pushed to ipvs.
I plan to will wait for Hans's fixes to be finalised before sending a pull request.

maintainer
#6 lore raw
Quoted 9 lines · Simon Horman
Quoted 8 lines · Julian Anastasov

This changeset fixes problems with failed netns
initializations. Hans should provide similar fix for LBLC and LBLCR. This is for the stable tree.

Julian Anastasov (2):
ipvs: reset ipvs pointer in netns
ipvs: add check in ftp for initialized core

Quoted 7 lines
Quoted 3 lines
 net/netfilter/ipvs/ip_vs_core.c |    2 ++
 net/netfilter/ipvs/ip_vs_ftp.c  |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

Thanks, both patches pushed to ipvs.
I plan to will wait for Hans's fixes to be finalised before sending a pull request.

Incidently, I have rebased the ipvs tree to include the latest merged patches in Pablo's net tree.