lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 08 Sep 2008 11:35:02 +0200
From:	Daniel Lezcano <dlezcano@...ibm.com>
To:	Alexey Dobriyan <adobriyan@...il.com>
CC:	davem@...emloft.net, netdev@...r.kernel.org,
	containers@...ts.linux-foundation.org
Subject: Re: [PATCH] igmp: make /proc/net/{igmp,mcfilter} per netns

Alexey Dobriyan wrote:
> Signed-off-by: Alexey Dobriyan <adobriyan@...il.com>

I have exactly the same patch to be submitted :)

Acked-by: Daniel Lezcano <dlezcano@...ibm.com>

By the way, you are posting patches related to netns. As some of us are 
working in this area too, do you mind to sync with us for the network 
items you want to handle to avoid duplicate work ?

We are currently working on mroute[6].

Thanks.
   -- Daniel

> ---
> 
>  net/ipv4/igmp.c |   49 ++++++++++++++++++++++++++++++++++++++++---------
>  1 file changed, 40 insertions(+), 9 deletions(-)
> 
> --- a/net/ipv4/igmp.c
> +++ b/net/ipv4/igmp.c
> @@ -2272,6 +2272,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;
>  };
> @@ -2280,11 +2281,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)
> @@ -2405,7 +2407,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));
>  }
>  
> @@ -2414,10 +2416,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;
> @@ -2427,13 +2430,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))
> @@ -2564,7 +2568,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));
>  }
>  
> @@ -2573,14 +2577,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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ