summaryrefslogtreecommitdiffstats
path: root/net/ipv4/ip_fragment.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-05-19 13:53:02 -0700
committerDavid S. Miller <davem@davemloft.net>2008-05-19 13:53:02 -0700
commit7d291ebb834278e30c211b26fb7076adcb636ad9 (patch)
treea6f7c95feff3a4f40603bf79b5cce85dc1c96e9f /net/ipv4/ip_fragment.c
parent0002c630c4ee7a3c6b1d87e34bfd6ce9694b49be (diff)
downloadtalos-op-linux-7d291ebb834278e30c211b26fb7076adcb636ad9.tar.gz
talos-op-linux-7d291ebb834278e30c211b26fb7076adcb636ad9.zip
inet: Register fragmentation some ctls at read-only root.
Parts of fragments-related sysctls are read-only, but this is done by cloning all the tables and dropping write-bits from mode. Do the same but with read-only root. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_fragment.c')
-rw-r--r--net/ipv4/ip_fragment.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 7f102eeb618e..be1cb89a8d5a 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -624,6 +624,10 @@ static struct ctl_table ip4_frags_ns_ctl_table[] = {
.proc_handler = &proc_dointvec_jiffies,
.strategy = &sysctl_jiffies
},
+ { }
+};
+
+static struct ctl_table ip4_frags_ctl_table[] = {
{
.ctl_name = NET_IPV4_IPFRAG_SECRET_INTERVAL,
.procname = "ipfrag_secret_interval",
@@ -658,8 +662,6 @@ static int ip4_frags_ns_ctl_register(struct net *net)
table[0].data = &net->ipv4.frags.high_thresh;
table[1].data = &net->ipv4.frags.low_thresh;
table[2].data = &net->ipv4.frags.timeout;
- table[3].mode &= ~0222;
- table[4].mode &= ~0222;
}
hdr = register_net_sysctl_table(net, net_ipv4_ctl_path, table);
@@ -684,6 +686,11 @@ static void ip4_frags_ns_ctl_unregister(struct net *net)
unregister_net_sysctl_table(net->ipv4.frags_hdr);
kfree(table);
}
+
+static void ip4_frags_ctl_register(void)
+{
+ register_net_sysctl_rotable(net_ipv4_ctl_path, ip4_frags_ctl_table);
+}
#else
static inline int ip4_frags_ns_ctl_register(struct net *net)
{
@@ -693,6 +700,10 @@ static inline int ip4_frags_ns_ctl_register(struct net *net)
static inline void ip4_frags_ns_ctl_unregister(struct net *net)
{
}
+
+static inline void ip4_frags_ctl_register(void)
+{
+}
#endif
static int ipv4_frags_init_net(struct net *net)
@@ -730,6 +741,7 @@ static struct pernet_operations ip4_frags_ops = {
void __init ipfrag_init(void)
{
+ ip4_frags_ctl_register();
register_pernet_subsys(&ip4_frags_ops);
ip4_frags.hashfn = ip4_hashfn;
ip4_frags.constructor = ip4_frag_init;
OpenPOWER on IntegriCloud