提交 790a3532 编写于 作者: P Pavel Emelyanov 提交者: David S. Miller

[NET] sysctl: prepare core tables to point to netns variables

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: NPavel Emelyanov <xemul@openvz.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 024626e3
......@@ -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,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册