netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-2.6.25 2/3]sysctl: prepare core tables to point to netns variables
@ 2007-12-07 13:10 Pavel Emelyanov
  2007-12-08  8:12 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Emelyanov @ 2007-12-07 13:10 UTC (permalink / raw)
  To: David Miller; +Cc: Linux Netdev List, Linux Containers, devel

Some of ctl variables are going to be on the struct 
net. Here's the way to adjust the ->data pointer on the
ctl_table-s to point on the right variable.

Since some pointers still point on the global variables,
I keep turning the write bits off on such tables.

This looks to become a common procedure for net sysctls,
so later parts of this code may migrate to some more
generic place.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index 57a7ead..dc4cf7d 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -167,8 +167,13 @@ static __net_init int sysctl_core_net_init(struct net *net)
 		if (tbl == NULL)
 			goto err_dup;
 
-		for (tmp = tbl; tmp->procname; tmp++)
-			tmp->mode &= ~0222;
+		for (tmp = tbl; tmp->procname; tmp++) {
+			if (tmp->data >= (void *)&init_net &&
+					tmp->data < (void *)(&init_net + 1))
+				tmp->data += (char *)net - (char *)&init_net;
+			else
+				tmp->mode &= ~0222;
+		}
 	}
 
 	net->sysctl_core_hdr = register_net_sysctl_table(net,
-- 
1.5.3.4


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

* Re: [PATCH net-2.6.25 2/3]sysctl: prepare core tables to point to netns variables
  2007-12-07 13:10 [PATCH net-2.6.25 2/3]sysctl: prepare core tables to point to netns variables Pavel Emelyanov
@ 2007-12-08  8:12 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2007-12-08  8:12 UTC (permalink / raw)
  To: xemul; +Cc: netdev, containers, devel

From: Pavel Emelyanov <xemul@openvz.org>
Date: Fri, 07 Dec 2007 16:10:49 +0300

> Some of ctl variables are going to be on the struct 
> net. Here's the way to adjust the ->data pointer on the
> ctl_table-s to point on the right variable.
> 
> Since some pointers still point on the global variables,
> I keep turning the write bits off on such tables.
> 
> This looks to become a common procedure for net sysctls,
> so later parts of this code may migrate to some more
> generic place.
> 
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

Applied, but please see if you can find a more pretty way to
do this, thanks.

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

end of thread, other threads:[~2007-12-08  8:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-07 13:10 [PATCH net-2.6.25 2/3]sysctl: prepare core tables to point to netns variables Pavel Emelyanov
2007-12-08  8:12 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).