All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2][RESEND] netns: complete igmp per-netns
@ 2008-12-19 14:25 Benjamin Thery
  2008-12-19 14:25 ` [PATCH 1/2] netns: igmp: allow IPPROTO_IGMP sockets in netns Benjamin Thery
  2008-12-19 14:25 ` [PATCH 2/2] netns: igmp: make /proc/net/{igmp,mcfilter} per netns Benjamin Thery
  0 siblings, 2 replies; 5+ messages in thread
From: Benjamin Thery @ 2008-12-19 14:25 UTC (permalink / raw)
  To: Dave Miller; +Cc: netdev, Alexey Dobriyan, Daniel Lezcano, Benjamin Thery

These two patches where originally posted by Alexey Dobriyan in September.

They complete network namespaces support for IGMP:
* Allow IPPROTO_IGMP sockets
* Make igmp proc entries per-netns

One of the reasons I'm resending them is they are needed to benefit
from IPv4 multicast routing per-netns. Patchset coming soon.

They applies on top of net-next-2.6.

Regards,
Benjamin


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] netns: igmp: allow IPPROTO_IGMP sockets in netns
  2008-12-19 14:25 [PATCH 0/2][RESEND] netns: complete igmp per-netns Benjamin Thery
@ 2008-12-19 14:25 ` Benjamin Thery
  2008-12-26  0:42   ` David Miller
  2008-12-19 14:25 ` [PATCH 2/2] netns: igmp: make /proc/net/{igmp,mcfilter} per netns Benjamin Thery
  1 sibling, 1 reply; 5+ messages in thread
From: Benjamin Thery @ 2008-12-19 14:25 UTC (permalink / raw)
  To: Dave Miller; +Cc: netdev, Alexey Dobriyan, Daniel Lezcano, Benjamin Thery

Looks like everything is already ready.

Required for ebtables(8) for one thing.

Also, required for ipmr per-netns (coming soon). (Benjamin)

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Benjamin Thery <benjamin.thery@bull.net>
---
 net/ipv4/af_inet.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 664ff0e..743f554 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1402,6 +1402,7 @@ EXPORT_SYMBOL_GPL(snmp_mib_free);
 #ifdef CONFIG_IP_MULTICAST
 static struct net_protocol igmp_protocol = {
 	.handler =	igmp_rcv,
+	.netns_ok =	1,
 };
 #endif
 


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] netns: igmp: make /proc/net/{igmp,mcfilter} per netns
  2008-12-19 14:25 [PATCH 0/2][RESEND] netns: complete igmp per-netns Benjamin Thery
  2008-12-19 14:25 ` [PATCH 1/2] netns: igmp: allow IPPROTO_IGMP sockets in netns Benjamin Thery
@ 2008-12-19 14:25 ` Benjamin Thery
  2008-12-26  0:42   ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Benjamin Thery @ 2008-12-19 14:25 UTC (permalink / raw)
  To: Dave Miller; +Cc: netdev, Alexey Dobriyan, Daniel Lezcano, Benjamin Thery

This patch makes the followinf proc entries per-netns:
/proc/net/igmp
/proc/net/mcfilter

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Acked-by: Benjamin Thery <benjamin.thery@bull.net>
---
 net/ipv4/igmp.c |   49 ++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 40 insertions(+), 9 deletions(-)

diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index f92733e..9eb6219 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -2275,6 +2275,7 @@ int ip_check_mc(struct in_device *in_dev, __be32 mc_addr, __be32 src_addr, u16 p
 
 #if defined(CONFIG_PROC_FS)
 struct igmp_mc_iter_state {
+	struct seq_net_private p;
 	struct net_device *dev;
 	struct in_device *in_dev;
 };
@@ -2283,11 +2284,12 @@ struct igmp_mc_iter_state {
 
 static inline struct ip_mc_list *igmp_mc_get_first(struct seq_file *seq)
 {
+	struct net *net = seq_file_net(seq);
 	struct ip_mc_list *im = NULL;
 	struct igmp_mc_iter_state *state = igmp_mc_seq_private(seq);
 
 	state->in_dev = NULL;
-	for_each_netdev(&init_net, state->dev) {
+	for_each_netdev(net, state->dev) {
 		struct in_device *in_dev;
 		in_dev = in_dev_get(state->dev);
 		if (!in_dev)
@@ -2408,7 +2410,7 @@ static const struct seq_operations igmp_mc_seq_ops = {
 
 static int igmp_mc_seq_open(struct inode *inode, struct file *file)
 {
-	return seq_open_private(file, &igmp_mc_seq_ops,
+	return seq_open_net(inode, file, &igmp_mc_seq_ops,
 			sizeof(struct igmp_mc_iter_state));
 }
 
@@ -2417,10 +2419,11 @@ static const struct file_operations igmp_mc_seq_fops = {
 	.open		=	igmp_mc_seq_open,
 	.read		=	seq_read,
 	.llseek		=	seq_lseek,
-	.release	=	seq_release_private,
+	.release	=	seq_release_net,
 };
 
 struct igmp_mcf_iter_state {
+	struct seq_net_private p;
 	struct net_device *dev;
 	struct in_device *idev;
 	struct ip_mc_list *im;
@@ -2430,13 +2433,14 @@ struct igmp_mcf_iter_state {
 
 static inline struct ip_sf_list *igmp_mcf_get_first(struct seq_file *seq)
 {
+	struct net *net = seq_file_net(seq);
 	struct ip_sf_list *psf = NULL;
 	struct ip_mc_list *im = NULL;
 	struct igmp_mcf_iter_state *state = igmp_mcf_seq_private(seq);
 
 	state->idev = NULL;
 	state->im = NULL;
-	for_each_netdev(&init_net, state->dev) {
+	for_each_netdev(net, state->dev) {
 		struct in_device *idev;
 		idev = in_dev_get(state->dev);
 		if (unlikely(idev == NULL))
@@ -2567,7 +2571,7 @@ static const struct seq_operations igmp_mcf_seq_ops = {
 
 static int igmp_mcf_seq_open(struct inode *inode, struct file *file)
 {
-	return seq_open_private(file, &igmp_mcf_seq_ops,
+	return seq_open_net(inode, file, &igmp_mcf_seq_ops,
 			sizeof(struct igmp_mcf_iter_state));
 }
 
@@ -2576,14 +2580,41 @@ static const struct file_operations igmp_mcf_seq_fops = {
 	.open		=	igmp_mcf_seq_open,
 	.read		=	seq_read,
 	.llseek		=	seq_lseek,
-	.release	=	seq_release_private,
+	.release	=	seq_release_net,
 };
 
-int __init igmp_mc_proc_init(void)
+static int igmp_net_init(struct net *net)
 {
-	proc_net_fops_create(&init_net, "igmp", S_IRUGO, &igmp_mc_seq_fops);
-	proc_net_fops_create(&init_net, "mcfilter", S_IRUGO, &igmp_mcf_seq_fops);
+	struct proc_dir_entry *pde;
+
+	pde = proc_net_fops_create(net, "igmp", S_IRUGO, &igmp_mc_seq_fops);
+	if (!pde)
+		goto out_igmp;
+	pde = proc_net_fops_create(net, "mcfilter", S_IRUGO, &igmp_mcf_seq_fops);
+	if (!pde)
+		goto out_mcfilter;
 	return 0;
+
+out_mcfilter:
+	proc_net_remove(net, "igmp");
+out_igmp:
+	return -ENOMEM;
+}
+
+static void igmp_net_exit(struct net *net)
+{
+	proc_net_remove(net, "mcfilter");
+	proc_net_remove(net, "igmp");
+}
+
+static struct pernet_operations igmp_net_ops = {
+	.init = igmp_net_init,
+	.exit = igmp_net_exit,
+};
+
+int __init igmp_mc_proc_init(void)
+{
+	return register_pernet_subsys(&igmp_net_ops);
 }
 #endif
 


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] netns: igmp: allow IPPROTO_IGMP sockets in netns
  2008-12-19 14:25 ` [PATCH 1/2] netns: igmp: allow IPPROTO_IGMP sockets in netns Benjamin Thery
@ 2008-12-26  0:42   ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2008-12-26  0:42 UTC (permalink / raw)
  To: benjamin.thery; +Cc: netdev, adobriyan, dlezcano

From: Benjamin Thery <benjamin.thery@bull.net>
Date: Fri, 19 Dec 2008 15:25:06 +0100

> Looks like everything is already ready.
> 
> Required for ebtables(8) for one thing.
> 
> Also, required for ipmr per-netns (coming soon). (Benjamin)
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> Acked-by: Benjamin Thery <benjamin.thery@bull.net>

Applied.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] netns: igmp: make /proc/net/{igmp,mcfilter} per netns
  2008-12-19 14:25 ` [PATCH 2/2] netns: igmp: make /proc/net/{igmp,mcfilter} per netns Benjamin Thery
@ 2008-12-26  0:42   ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2008-12-26  0:42 UTC (permalink / raw)
  To: benjamin.thery; +Cc: netdev, adobriyan, dlezcano

From: Benjamin Thery <benjamin.thery@bull.net>
Date: Fri, 19 Dec 2008 15:25:07 +0100

> This patch makes the followinf proc entries per-netns:
> /proc/net/igmp
> /proc/net/mcfilter
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> Acked-by: Daniel Lezcano <dlezcano@fr.ibm.com>
> Acked-by: Benjamin Thery <benjamin.thery@bull.net>

Also applied, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-12-26  0:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-19 14:25 [PATCH 0/2][RESEND] netns: complete igmp per-netns Benjamin Thery
2008-12-19 14:25 ` [PATCH 1/2] netns: igmp: allow IPPROTO_IGMP sockets in netns Benjamin Thery
2008-12-26  0:42   ` David Miller
2008-12-19 14:25 ` [PATCH 2/2] netns: igmp: make /proc/net/{igmp,mcfilter} per netns Benjamin Thery
2008-12-26  0:42   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.